From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: dcache: NULL ptr deref in dentry_kill Date: Sun, 05 Oct 2014 23:42:40 -0400 Message-ID: <54320FB0.7060403@oracle.com> References: <5431E203.9070501@oracle.com> <20141006031355.GA7996@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: linux-fsdevel , bfields@redhat.com, mszeredi@suse.cz, "Eric W. Biederman" , hch@lst.de, Dave Jones , LKML To: Al Viro Return-path: Received: from aserp1040.oracle.com ([141.146.126.69]:22239 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752180AbaJFDmx (ORCPT ); Sun, 5 Oct 2014 23:42:53 -0400 In-Reply-To: <20141006031355.GA7996@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 10/05/2014 11:13 PM, Al Viro wrote: > On Sun, Oct 05, 2014 at 08:27:47PM -0400, Sasha Levin wrote: > >> [ 434.580818] BUG: unable to handle kernel NULL pointer dereference at 0000000000000090 >> [ 434.582208] IP: do_raw_spin_trylock (./arch/x86/include/asm/spinlock.h:108 kernel/locking/spinlock_debug.c:143) > [snip] > spin_lock((void *)0x90) >> [ 434.590025] ? _raw_spin_trylock (include/linux/spinlock_api_smp.h:89 kernel/locking/spinlock.c:135) >> [ 434.590025] ? lockref_put_or_lock (lib/lockref.c:131) >> [ 434.590025] dput (fs/dcache.c:513 fs/dcache.c:616) > > ummm... lockref_put_or_lock(&dentry->d_lockref) ending up with 0x90 passed > to lockref_put_or_lock()... What offset does d_lockref have on your build? 0x90 > On my config it's 0x80 (i.e. that would mean dput((void *)0x10)); could you > check it on yours? Do you have CONFIG_DEBUG_LOCK_ALLOC and CONFIG_LOCK_STAT? I have both of the config options. >> [ 434.590025] __fput (fs/file_table.c:235) > > ... and here we have a struct file with ->f_path.dentry being a small positive > number. > > Might make sense to slap BUG_ON((unsigned long)dentry < PAGE_SIZE); into > __fput() and try to reproduce. And throw > BUG_ON((unsigned long)file->f_path.dentry < PAGE_SIZE); > into fput(), while we are at it, to see if that's bogus ->f_path.dentry at > fput() time or if it's getting corrupted between task_work_add() and actual > execution of __fput(). I'll put those BUG_ONs in and will update if they get hit. > And the value of offsetof(struct dentry, d_lock) on your build would be > interesting to see - that would tell us which value are we seeing passed > to dput(). This is 0x90 as well. Thanks, Sasha