Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/mseal: always define VM_SEALED

Patch series "mseal cleanups", v4.

Perform a number of cleanups to the mseal logic. Firstly, VM_SEALED is
treated differently from every other VMA flag, it really doesn't make
sense to do this, so we start by making this consistent with everything
else.

Next we place the madvise logic where it belongs - in mm/madvise.c. It
really makes no sense to abstract this elsewhere. In doing so, we go to
great lengths to explain very clearly the previously very confusing logic
as to what sealed mappings are impacted here.

In doing so, we retain existing logic regarding treatment of madvise()
discard operations for a sealed, read-only MAP_PRIVATE file-backed
mapping. This is something we likely need to revisit.

We then abstract out and explain the 'are there are any gaps in this range
in the mm?' check being performed as a prerequisite to mseal being
performed.

Finally, we simplify the actual mseal logic which is really quite
straightforward.

No functional change is intended.


This patch (of 4):

There is no reason to treat VM_SEALED in a special way, in each other case
in which a VMA flag is unavailable due to configuration, we simply assign
that flag to VM_NONE, so make VM_SEALED consistent with all other VMA
flags in this respect.

Additionally, use the next available bit for VM_SEALED, 42, rather than
arbitrarily putting it at 63 and update the declaration to match all other
VMA flags.

No functional change intended.

Link: https://lkml.kernel.org/r/cover.1753431105.git.lorenzo.stoakes@oracle.com
Link: https://lkml.kernel.org/r/aeb398a77029b6e7377cd944328bc9bbc3c90537.1753431105.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Jeff Xu <jeffxu@chromium.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Lorenzo Stoakes and committed by
Andrew Morton
f225b34f dee3ab62

+8 -4
+4 -2
include/linux/mm.h
··· 414 414 #endif 415 415 416 416 #ifdef CONFIG_64BIT 417 - /* VM is sealed, in vm_flags */ 418 - #define VM_SEALED _BITUL(63) 417 + #define VM_SEALED_BIT 42 418 + #define VM_SEALED BIT(VM_SEALED_BIT) 419 + #else 420 + #define VM_SEALED VM_NONE 419 421 #endif 420 422 421 423 /* Bits set in the VMA until the stack is in its final location */
+4 -2
tools/testing/vma/vma_internal.h
··· 108 108 #define CAP_IPC_LOCK 14 109 109 110 110 #ifdef CONFIG_64BIT 111 - /* VM is sealed, in vm_flags */ 112 - #define VM_SEALED _BITUL(63) 111 + #define VM_SEALED_BIT 42 112 + #define VM_SEALED BIT(VM_SEALED_BIT) 113 + #else 114 + #define VM_SEALED VM_NONE 113 115 #endif 114 116 115 117 #define FIRST_USER_ADDRESS 0UL