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]
Date:   Wed, 4 Mar 2020 12:39:52 -0800 (PST)
From:   David Rientjes <rientjes@...gle.com>
To:     Vlastimil Babka <vbabka@...e.cz>
cc:     Kees Cook <keescook@...omium.org>, Jann Horn <jannh@...gle.com>,
        Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux-MM <linux-mm@...ck.org>,
        kernel list <linux-kernel@...r.kernel.org>,
        Matthew Garrett <mjg59@...gle.com>,
        Vijayanand Jitta <vjitta@...eaurora.org>
Subject: Re: SLUB: sysfs lets root force slab order below required minimum,
 causing memory corruption

On Wed, 4 Mar 2020, Vlastimil Babka wrote:

> > Seems reasonable!
> > 
> > For the race concerns, should this logic just make sure the resulting
> > order can never shrink? Or does it need much stronger atomicity?
> 
> If order grows, I think we also need to recalculate the random sequence for
> freelist randomization [1]. I expect that would be rather problematic with
> parallel allocations/freeing going on.
> 
> As was also noted, the any_slab_objects(s) checks are racy - might return false
> and immediately some other CPU can allocate some.
> 
> I wonder if this race window could be fixed at all without introducing extra
> locking in the fast path? Which means it's probably not worth the trouble of
> having these runtime knobs. How about making the files read-only (if not remove
> completely). Vijayanand described a use case in [2], shouldn't it be possible to
> implement that scenario (all caches have debugging enabled except zram cache)
> with kernel parameters only?
> 

I'm not sure how dependent the CONFIG_SLUB_DEBUG users are on being able 
to modify these are runtime (they've been around for 12+ years) but I 
agree that it seems particularly dangerous.

I think they can be fixed by freezing allocations and frees for the 
particular kmem_cache on all cpus which would add the additional 
conditional in the fastpath and that's going to be required in the very 
small minority of cases where an admin actually wants to change these.

The slub_debug kernel command line options are already pretty 
comprehensive as described by Documentation/vm/slub.rst.  I *think* these 
tunables were primarily introduced for kernel debugging and not general 
purpose, perhaps with the exception of "order".

So I think we may be able to fix "order" with a combination of my patch as 
well as a fix to the freelist randomization and that the others should 
likely be made read only.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ