Re: panic when RACCT_RSS still > 0 when struct racct destroyed

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Sun, 14 Jun 2015 22:00:13 +0300
On Sun, Jun 14, 2015 at 02:53:48PM +0200, Jeremie Le Hen wrote:
> Sorry for the early sending in the previous email.
> 
> Hi all,
> 
> I keep getting the following panic from time to time:
> % panic: destroying non-empty racct: 1142784 allocated for resource 4
> %
> % cpuid = 1
> % KDB: stack backtrace:
> % db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00e6240630
> % vpanic() at vpanic+0x189/frame 0xfffffe00e62406b0
> % kassert_panic() at kassert_panic+0x132/frame 0xfffffe00e6240720
> % racct_destroy() at racct_destroy+0x96/frame 0xfffffe00e6240750
> % uifree() at uifree+0x5e/frame 0xfffffe00e6240770
> % crfree() at crfree+0x48/frame 0xfffffe00e6240790
> % thread_wait() at thread_wait+0x8e/frame 0xfffffe00e62407b0
> % proc_reap() at proc_reap+0x40e/frame 0xfffffe00e6240800
> % proc_to_reap() at proc_to_reap+0x332/frame 0xfffffe00e6240850
> % kern_wait6() at kern_wait6+0x1f7/frame 0xfffffe00e62408f0
> % sys_wait4() at sys_wait4+0x73/frame 0xfffffe00e6240ae0
> % amd64_syscall() at amd64_syscall+0x27f/frame 0xfffffe00e6240bf0
> % Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe00e6240bf0
> 
> I had already reported this two years ago, but we couldn't find a solution:
> https://lists.freebsd.org/pipermail/freebsd-current/2013-June/042528.html
> 
> Note that since then I spotted an instance of this which wasn't for a
> jailed process.
> 
> 
> I made a bit more research today on RACCT_RSS throughout the kernel
> source.  It is only set using racct_set() from
> - vmspace_container_set() but it only zero a couple of resources
> - vm_daemon()
> 
> The first question, do you guys (kib, alc) think there could be a bug,
> or rather a race, in there?
> 
> 
> The other solution where the RSS resource can be modified is through:
> - racct_proc_ucred_changed()
> - racct_move()
> - racct_proc_fork()
> 
> I think this is pretty much the surface through which the bug can arise.
> 
> 
> In the thread pointed above, Edward advised me to create a rctl rule
> to cause the uidinfo to be held, but this can happen with various
> users (the last one with user 2 in the root jail).
> Any idea what I could do to narrow the issue?

vm_daemon() only runs periodically.  What does ensure that rss accounting
is reset to zero on the process exit ?
Received on Sun Jun 14 2015 - 17:00:19 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:58 UTC