lkml.org 
[lkml]   [2020]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: SLUB: sysfs lets root force slab order below required minimum, causing memory corruption
From
Date
On 3/4/20 3:22 AM, Kees Cook wrote:
> On Tue, Mar 03, 2020 at 05:26:14PM -0800, David Rientjes 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?

Thanks,
Vlastimil

[1] https://lore.kernel.org/linux-mm/d3acc069-a5c6-f40a-f95c-b546664bc4ee@suse.cz/
[2]
https://lore.kernel.org/linux-mm/1383cd32-1ddc-4dac-b5f8-9c42282fa81c@codeaurora.org/

\
 
 \ /
  Last update: 2020-03-04 18:27    [W:0.086 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site