Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758642Ab3DXXs1 (ORCPT ); Wed, 24 Apr 2013 19:48:27 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:49309 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757971Ab3DXXsX (ORCPT ); Wed, 24 Apr 2013 19:48:23 -0400 MIME-Version: 1.0 Reply-To: sedat.dilek@gmail.com In-Reply-To: <1366846719.1863.1.camel@buesod1.americas.hpqcorp.net> References: <1366741069.1802.12.camel@buesod1.americas.hpqcorp.net> <1366741394.1802.13.camel@buesod1.americas.hpqcorp.net> <1366841773.1790.7.camel@buesod1.americas.hpqcorp.net> <1366846719.1863.1.camel@buesod1.americas.hpqcorp.net> Date: Thu, 25 Apr 2013 01:48:21 +0200 Message-ID: Subject: Re: [PATCH -next] ipc: make refcounter atomic (was Re: linux-next: Tree for Apr 23 [ Call-Traces: lib/debugobjects.c | kernel/rcupdate.c | kernel/rcutree.c ]) From: Sedat Dilek To: Davidlohr Bueso Cc: Linus Torvalds , Rik van Riel , Andrew Morton , Paul McKenney , Paul McKenney , Emmanuel Benisty , linux-next , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3084 Lines: 70 On Thu, Apr 25, 2013 at 1:38 AM, Davidlohr Bueso wrote: > On Thu, 2013-04-25 at 01:05 +0200, Sedat Dilek wrote: >> On Thu, Apr 25, 2013 at 12:16 AM, Davidlohr Bueso >> wrote: >> > From: Davidlohr Bueso >> > >> > Sedat reported an issue leading to a NULL dereference in update_queue(): >> > >> > [ 178.490583] BUG: spinlock bad magic on CPU#1, sh/8066 >> > [ 178.490595] lock: 0xffff88008b53ea18, .magic: 6b6b6b6b, .owner: make/8068, .owner_cpu: 3 >> > [ 178.490599] BUG: unable to handle kernel NULL pointer dereference at (null) >> > [ 178.490608] IP: [] update_queue+0x70/0x210 >> > [ 178.490610] PGD 0 >> > [ 178.490612] Oops: 0000 [#1] SMP >> > ... >> > [ 178.490704] Call Trace: >> > [ 178.490710] [] do_smart_update+0xe1/0x140 >> > [ 178.490713] [] exit_sem+0x2b1/0x350 >> > [ 178.490718] [] do_exit+0x290/0xa70 >> > [ 178.490721] [] do_group_exit+0x44/0xa0 >> > [ 178.490724] [] SyS_exit_group+0x17/0x20 >> > [ 178.490728] [] system_call_fastpath+0x1a/0x1f >> > >> > Linus pin-pointed the problem to a race in the reference counter. To quote: >> > >> > "That dmesg spew very much implies that the same RCU head got added twice to the RCU >> > freeing list, and the only way that happens is if the refcount goes to >> > zero twice. Which implies that either we increment a zero, or we lack >> > locking and the coherency of the non-atomic access goes away." >> > >> > This patch converts the IPC RCU header's reference counter to atomic_t. The return of >> > ipc_rcu_getref() is modified to inform the callers if it actually succeeded. >> > >> > Now all callers return -EIDRM upon failure and abort the current operation. Two exceptions are >> > in semaphore code where sem_getref_and_unlock() and sem_getref() trigger a warning but proceed >> > to freeing up any held locks. >> > >> > Signed-off-by: Davidlohr Bueso >> > Suggested-by: Linus Torvalds >> > CC: Rik van Riel >> > CC: Paul McKenney >> > CC: Sedat Dilek >> > CC: Emmanuel Benisty >> > CC: Andrew Morton >> >> Missing my Reported-by ...! > > Not trying to take away credit or efforts from you, just wanted you to > reconfirm that *this* actual patch fixes things for you :) > No, I am not of those "bad guys" in OSS. I would not have invested so much time in helping to get this fixed. Did my usual test-case: A kernel-rebuild within same kernel-environment with no breakage or abnormalities in the logs. Hope I could help. - Sedat - > Thanks, > Davidlohr > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/