From owner-freebsd-current@FreeBSD.ORG Sun Jun 14 12:53:51 2015 Return-Path: Delivered-To: freebsd-current@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B4C5B14; Sun, 14 Jun 2015 12:53:51 +0000 (UTC) (envelope-from jlehen@gmail.com) Received: from mail-lb0-x22e.google.com (mail-lb0-x22e.google.com [IPv6:2a00:1450:4010:c04::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B7827C8C; Sun, 14 Jun 2015 12:53:50 +0000 (UTC) (envelope-from jlehen@gmail.com) Received: by lblr1 with SMTP id r1so12902965lbl.0; Sun, 14 Jun 2015 05:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=i5mg66vDerIZnYZ6fxmrbq4s2As3Yr89ib/FXPdoS1Q=; b=gSgyX9O4lNQch7SyHiZN061bjboAS6muvdishHqyQ6HxVWDqymrvzjUbhWJIIUlEVu JbwRBdzW2pRabUPpxEvdmtPS4QrU8OxMqJvy3V8B5TtMa2EuvrjXCoCMw/QH4alqcUZy mBb8gmx3Uo01bBlBDYxeAr5XfZiDsgduGXDCX4+5hdzOn8Gy5gScd4Dq+8cOuKbhLzc6 nsUmVf2uJi5ajk5wACHOTvLgw9zUowNlqhvJ4Kc9nkLyeuMZ/zMZ03xW5mTCjDeNH13K qFpiNo2d2l3Tvw/AYDKNDhdFOnibj07fQ6kSiAbWqFy7PG+60FeXd0zmrVSmCOfjbtEY waTw== MIME-Version: 1.0 X-Received: by 10.112.180.201 with SMTP id dq9mr23607209lbc.78.1434286428592; Sun, 14 Jun 2015 05:53:48 -0700 (PDT) Sender: jlehen@gmail.com Received: by 10.112.58.169 with HTTP; Sun, 14 Jun 2015 05:53:48 -0700 (PDT) In-Reply-To: References: Date: Sun, 14 Jun 2015 14:53:48 +0200 X-Google-Sender-Auth: -_UUaMFP1m9XCpxtjZRaqi_MNpw Message-ID: Subject: Re: panic when RACCT_RSS still > 0 when struct racct destroyed From: Jeremie Le Hen To: freebsd-current@freebsd.org Cc: trasz@freebsd.org, Konstantin Belousov , alc@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2015 12:53:51 -0000 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? Cheers, -- Jeremie Le Hen jlh@FreeBSD.org