From: Vlastimil Babka <vbabka@suse.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>, stable@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Jann Horn <jannh@google.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Xu <peterx@redhat.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, Mark Brown <broonie@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Andreas Larsson <andreas@gaisler.com>,
"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
Helge Deller <deller@gmx.de>
Subject: Re: [PATCH 6.1.y 0/4] fix error handling in mmap_region() and refactor (hotfixes)
Date: Fri, 15 Nov 2024 20:11:35 +0100 [thread overview]
Message-ID: <1fd407b1-c061-4f24-b78a-ab90fa5d78d5@suse.cz> (raw)
In-Reply-To: <cover.1731671441.git.lorenzo.stoakes@oracle.com>
On 11/15/24 13:40, Lorenzo Stoakes wrote:
> Critical fixes for mmap_region(), backported to 6.1.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().
Seems adding 9a9d0b829901 ("mm: move dummy_vm_ops out of a header") as
prerequisity would have been less work, but I didn't find a bug in your
adjustments so seems fine to me.
>
> * 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.
>
> * This version of the kernel uses mas_preallocate() rather than the
> vma_iter_prealloc() wrapper and mas_destroy() rather than the
> vma_iter_free() wrapper, however the logic of rearranging the positioning
> of these remains the same, as well as avoiding the iterator leak we
> previously had on some error paths.
>
> 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
Aside from the suspected memory leak I reported for 4/4,
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
> arch/arm64/include/asm/mman.h | 10 ++-
> include/linux/mman.h | 7 +-
> mm/internal.h | 19 ++++++
> mm/mmap.c | 119 ++++++++++++++++++----------------
> mm/nommu.c | 9 ++-
> mm/shmem.c | 3 -
> mm/util.c | 33 ++++++++++
> 7 files changed, 129 insertions(+), 71 deletions(-)
>
> --
> 2.47.0
next prev parent reply other threads:[~2024-11-15 19:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 12:40 Lorenzo Stoakes
2024-11-15 12:40 ` [PATCH 6.1.y 1/4] mm: avoid unsafe VMA hook invocation when error arises on mmap hook Lorenzo Stoakes
2024-11-15 12:40 ` [PATCH 6.1.y 2/4] mm: unconditionally close VMAs on error Lorenzo Stoakes
2024-11-15 12:40 ` [PATCH 6.1.y 3/4] mm: refactor arch_calc_vm_flag_bits() and arm64 MTE handling Lorenzo Stoakes
2024-11-15 12:40 ` [PATCH 6.1.y 4/4] mm: resolve faulty mmap_region() error path behaviour Lorenzo Stoakes
2024-11-15 19:06 ` Vlastimil Babka
2024-11-15 19:28 ` Lorenzo Stoakes
2024-11-15 19:37 ` Liam R. Howlett
2024-11-17 21:11 ` Greg KH
2024-11-18 10:10 ` Lorenzo Stoakes
2024-11-15 19:11 ` Vlastimil Babka [this message]
2024-11-15 20:09 ` [PATCH 6.1.y 0/4] fix error handling in mmap_region() and refactor (hotfixes) Liam R. Howlett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1fd407b1-c061-4f24-b78a-ab90fa5d78d5@suse.cz \
--to=vbabka@suse.cz \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=andreas@gaisler.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=deller@gmx.de \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=peterx@redhat.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox