]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mseal: Replace can_modify_mm_madv with a vma variant
authorPedro Falcato <pedro.falcato@gmail.com>
Sat, 17 Aug 2024 00:18:32 +0000 (01:18 +0100)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 19 Aug 2024 20:11:54 +0000 (16:11 -0400)
commit71f36ce4e10c6bf4e9ab00dc88f8e79ac3804f32
treefdb1377da990418cce199633791b2dc273018bc3
parentdb28d8f5e9e68768c57a6cdcba19bd7b857ffeec
mseal: Replace can_modify_mm_madv with a vma variant

Replace can_modify_mm_madv() with a single vma variant, and associated
checks in madvise.

While we're at it, also invert the order of checks in:
 if (unlikely(is_ro_anon(vma) && !can_modify_vma(vma))

Checking if we can modify the vma itself (through vm_flags) is
certainly cheaper than is_ro_anon() due to arch_vma_access_permitted()
looking at e.g pkeys registers (with extra branches) in some
architectures.

This patch allows for partial madvise success when finding a sealed VMA,
which historically has been allowed in Linux.

Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
mm/internal.h
mm/madvise.c
mm/mseal.c
mm/vma.h