Skip to contentSkip to conversation

mm/slub: Add SLUB_RANDOMIZE support

PATCH In review George Spelvin 3 participants 4 messages Mar 16, 2011 Memory management

lore
Share & tools
lore
#0 lore raw

cover mm/slub: Add SLUB_RANDOMIZE support

As a followup to the "[PATCH] Make /proc/slabinfo 0400" thread, this is a patch series to randomize the order of object allocations within a page. It can be extended to SLAB and SLOB if desired. Mostly it's for benchmarking and discussion.

It Boots For Me(tm).

Patches 1-4 and 8 touch drivers/char/random.c, to add support for efficiently generating a series of uniform random integers in small ranges. Is this okay with Herbert & Matt?

I did a bit of code cleanup while I was at it, but kept it to separate patches. Patches 4 and 7 are the heart of the new code, but I'd particularly like comments on patch 8, as I don't understand the kconfig stuff very well. Is the feature description good and are the control knobs adequate?

Checkpatch complains about a too-short CONFIG option description on 8/8; I think it's spurious.

#1 lore raw
Quoted 4 lines · George Spelvin

As a followup to the "[PATCH] Make /proc/slabinfo 0400" thread, this is a patch series to randomize the order of object allocations within a page. It can be extended to SLAB and SLOB if desired. Mostly it's for benchmarking and discussion.

I've spent a while thinking about this over the past few weeks, and I really don't think it's productive to try to randomize the allocators. It provides negligible defense and just makes life harder for kernel hackers.

(And you definitely can't randomize SLOB like this.)

Quoted 3 lines

Patches 1-4 and 8 touch drivers/char/random.c, to add support for efficiently generating a series of uniform random integers in small ranges. Is this okay with Herbert & Matt?

But I will look at these.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#2 lore raw

Hi Matt,

Quoted 4 lines · George Spelvin
Quoted 4 lines

As a followup to the "[PATCH] Make /proc/slabinfo 0400" thread, this is a patch series to randomize the order of object allocations within a page.  It can be extended to SLAB and SLOB if desired.  Mostly it's for benchmarking and discussion.

Quoted 4 lines · Matt Mackall

I've spent a while thinking about this over the past few weeks, and I really don't think it's productive to try to randomize the allocators. It provides negligible defense and just makes life harder for kernel hackers.

If it's an optional feature and the impact on the code is low (as it seems to be), what's the downside? Combined with disabling SLUB's slab merging, randomization should definitely make it more difficult to have full control over a full slab. I don't know how much defense it will provide but I think randomization is definitely an option worth exploring.

Quoted 1 line

(And you definitely can't randomize SLOB like this.)

No, you can't but heap exploits like the one we discuss are slightly harder with SLOB anyway, no?

Pekka

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 8 lines · Pekka Enberg

Hi Matt,

Quoted 4 lines · George Spelvin
Quoted 4 lines

As a followup to the "[PATCH] Make /proc/slabinfo 0400" thread, this is a patch series to randomize the order of object allocations within a page. It can be extended to SLAB and SLOB if desired. Mostly it's for benchmarking and discussion.

Quoted 8 lines
Quoted 4 lines · Matt Mackall

I've spent a while thinking about this over the past few weeks, and I really don't think it's productive to try to randomize the allocators. It provides negligible defense and just makes life harder for kernel hackers.

If it's an optional feature and the impact on the code is low (as it seems to be), what's the downside?

We still haven't established an upside, so from where I'm sitting it's all downside.

Quoted 3 lines

Combined with disabling SLUB's slab
merging, randomization should definitely make it more difficult to have full control over a full slab.

Turning off slab merging will help for object types that use their own slabs, kmalloced objects will still be vulnerable, independently of randomization. Randomization won't prevent anything but the most naive attack.

Again, we've already spent more time talking about this than it will take for the exploit community to work around it.

Quoted 2 lines

No, you can't but heap exploits like the one we discuss are slightly harder with SLOB anyway, no?

Only slightly, if at all.

Signature · 9 lines
Mathematics is the supreme nostalgia of our time.


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>