[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1731670097.git.lorenzo.stoakes@oracle.com>
Date: Fri, 15 Nov 2024 12:36:50 +0000
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: stable@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Xu <peterx@...hat.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Mark Brown <broonie@...nel.org>,
"David S . Miller" <davem@...emloft.net>,
Andreas Larsson <andreas@...sler.com>,
"James E . J . Bottomley" <James.Bottomley@...senPartnership.com>,
Helge Deller <deller@....de>
Subject: [PATCH 5.10.y 0/4] fix error handling in mmap_region() and refactor (hotfixes)
Critical fixes for mmap_region(), backported to 5.10.y.
Some notes on differences from upstream:
* We do NOT take commit 0fb4a7ad270b ("mm: refactor
map_deny_write_exec()"), as this refactors code only introduced in 6.2.
* We make reference in "mm: refactor arch_calc_vm_flag_bits() and arm64 MTE
handling" to parisc, but the referenced functionality does not exist in
this kernel.
* In this kernel is_shared_maywrite() does not exist and the code uses
VM_SHARED to determine whether mapping_map_writable() /
mapping_unmap_writable() should be invoked. This backport therefore
follows suit.
* The vma_dummy_vm_ops static global doesn't exist in this kernel, so we
use a local static variable in mmap_file() and vma_close().
* Each version of these series is confronted by a slightly different
mmap_region(), so we must adapt the change for each stable version. The
approach remains the same throughout, however, and we correctly avoid
closing the VMA part way through any __mmap_region() operation.
* In 5.10 we must handle VM_DENYWRITE. Since this is done at the top of the
file-backed VMA handling logic, and importantly before mmap_file() invocation,
this does not imply any additional difficult error handling on partial
completion of mapping so has no significant impact.
Lorenzo Stoakes (4):
mm: avoid unsafe VMA hook invocation when error arises on mmap hook
mm: unconditionally close VMAs on error
mm: refactor arch_calc_vm_flag_bits() and arm64 MTE handling
mm: resolve faulty mmap_region() error path behaviour
arch/arm64/include/asm/mman.h | 10 +++--
include/linux/mman.h | 7 +--
mm/internal.h | 19 ++++++++
mm/mmap.c | 82 +++++++++++++++++++++--------------
mm/nommu.c | 9 ++--
mm/shmem.c | 3 --
mm/util.c | 33 ++++++++++++++
7 files changed, 117 insertions(+), 46 deletions(-)
--
2.47.0
Powered by blists - more mailing lists