lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190723181124.GM363@bombadil.infradead.org>
Date:   Tue, 23 Jul 2019 11:11:24 -0700
From:   Matthew Wilcox <willy@...radead.org>
To:     Jeff Layton <jlayton@...nel.org>
Cc:     akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk,
        lhenriques@...e.com, cmaiolino@...hat.com,
        Christoph Hellwig <hch@....de>
Subject: Re: [PATCH] mm: check for sleepable context in kvfree

On Tue, Jul 23, 2019 at 02:05:11PM -0400, Jeff Layton wrote:
> On Tue, 2019-07-23 at 10:55 -0700, Matthew Wilcox wrote:
> > > HCH points out that xfs uses kvfree as a generic "free this no matter
> > > what it is" sort of wrapper and expects the callers to work out whether
> > > they might be freeing a vmalloc'ed address. If that sort of usage turns
> > > out to be prevalent, then we may need another approach to clean this up.
> > 
> > I think it's a bit of a landmine, to be honest.  How about we have kvfree()
> > call vfree_atomic() instead?
> 
> Not a bad idea, though it means more overhead for the vfree case.
> 
> Since we're spitballing here...could we have kvfree figure out whether
> it's running in a context where it would need to queue it instead and
> only do it in that case?
> 
> We currently have to figure that out for the might_sleep_if anyway. We
> could just have it DTRT instead of printk'ing and dumping the stack in
> that case.

I don't think we have a generic way to determine if we're currently
holding a spinlock.  ie this can fail:

spin_lock(&my_lock);
kvfree(p);
spin_unlock(&my_lock);

If we're preemptible, we can check the preempt count, but !CONFIG_PREEMPT
doesn't record the number of spinlocks currently taken.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ