diff options
| author | Pedro Falcato <[email protected]> | 2024-08-07 17:33:35 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-08-16 05:16:13 +0000 |
| commit | e46bc2e7eb90a370bc27fa2fd98cb8251e7da1ec (patch) | |
| tree | 52b1322b4b246211b918524ac7ed61c6e6f8168c /mm/sparse.c | |
| parent | Linux 6.11-rc3 (diff) | |
| download | kernel-e46bc2e7eb90a370bc27fa2fd98cb8251e7da1ec.tar.gz kernel-e46bc2e7eb90a370bc27fa2fd98cb8251e7da1ec.zip | |
mseal: fix is_madv_discard()
is_madv_discard did its check wrong. MADV_ flags are not bitwise,
they're normal sequential numbers. So, for instance:
behavior & (/* ... */ | MADV_REMOVE)
tagged both MADV_REMOVE and MADV_RANDOM (bit 0 set) as discard
operations.
As a result the kernel could erroneously block certain madvises (e.g
MADV_RANDOM or MADV_HUGEPAGE) on sealed VMAs due to them sharing bits
with blocked MADV operations (e.g REMOVE or WIPEONFORK).
This is obviously incorrect, so use a switch statement instead.
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 8be7258aad44 ("mseal: add mseal syscall")
Signed-off-by: Pedro Falcato <[email protected]>
Tested-by: Jeff Xu <[email protected]>
Reviewed-by: Jeff Xu <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/sparse.c')
0 files changed, 0 insertions, 0 deletions
