[PATCH v3 0/3] Actually fix freelist pointer vs redzoning

From: Kees Cook
Date: Wed Oct 14 2020 - 23:37:20 EST


v3:
- fix commit messages to properly reflect the direction of the overwrite
- justify the less-than-word-size patch better
- add Acks
- move some Fixes up into the commit log as just references
v2: https://lore.kernel.org/lkml/20201009195411.4018141-1-keescook@xxxxxxxxxxxx
v1: https://lore.kernel.org/lkml/20201008233443.3335464-1-keescook@xxxxxxxxxxxx

This fixes redzoning vs the freelist pointer (both for middle-position
and very small caches). Both are "theoretical" fixes, in that I see no
evidence of such small-sized caches actually be used in the kernel, but
that's no reason to let the bugs continue to exist. :)

Note on patch 2: Christopher NAKed it, but I actually think this is a
reasonable thing to add -- the "too small" check is only made when built
with CONFIG_DEBUG_VM, so it *is* actually possible for someone to trip
over this directly, even if it would never make it into a released
kernel. I see no reason to just leave this foot-gun in place, though, so
we might as well just fix it too. (Which seems to be what Longman was
similarly supporting, IIUC.)

Anyway, if patch 2 stays NAKed, that's fine. It's entirely separable,
and the other 2 can land. :)

Thanks!

-Kees


Kees Cook (3):
mm/slub: Clarify verification reporting
mm/slub: Fix redzoning for small allocations
mm/slub: Actually fix freelist pointer vs redzoning

Documentation/vm/slub.rst | 10 +++++-----
mm/slub.c | 36 +++++++++++++++---------------------
2 files changed, 20 insertions(+), 26 deletions(-)

--
2.25.1