linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Fixes for vma_merge() error path
@ 2023-09-29 18:30 Liam R. Howlett
  2023-09-29 18:30 ` [PATCH v3 1/3] mmap: Fix vma_iterator in error path of vma_merge() Liam R. Howlett
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Liam R. Howlett @ 2023-09-29 18:30 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Jann Horn, Lorenzo Stoakes,
	Vlastimil Babka, Suren Baghdasaryan, Matthew Wilcox,
	Liam R. Howlett

Jann Horn reported a potential vma iterator issue in the failure path of
the vma_merge() code.  After examining the interface, it seemed the best
course of action is to simply add an undo path in the unlikely case of
an error.

On examining the vma iterator issue, another issue was discovered that
would increase the memory usage during failure scenarios, so this is
addressed in patch 2.

Since it is unclear in the code, another patch adds comments to the
vma_merge() function on why dup_anon_vma() is safe in 'case 6'.

Changes since v2:
 - Updated dup_anon_vma() comment to include new argument.
 - Change vma iterator undo to a reset and rewalk to ensure
   vma_iter_config() changes are dropped. - Thanks Vlastimil Babka
 - Update user visible changes in patch 1 again. - Thanks Vlastimil
   Babka
 - Only set the anon_dup vma when the duplication is successful. -
   Thanks Vlastimil Babka

v2: https://lore.kernel.org/linux-mm/20230927160746.1928098-1-Liam.Howlett@oracle.com/
v1: https://lore.kernel.org/linux-mm/20230927160746.1928098-1-Liam.Howlett@oracle.com/

Liam R. Howlett (3):
  mmap: Fix vma_iterator in error path of vma_merge()
  mmap: Fix error paths with dup_anon_vma()
  mmap: Add clarifying comment to vma_merge() code

 mm/mmap.c | 45 +++++++++++++++++++++++++++++++++++----------
 1 file changed, 35 insertions(+), 10 deletions(-)

-- 
2.40.1



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-10-06 21:32 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-29 18:30 [PATCH v3 0/3] Fixes for vma_merge() error path Liam R. Howlett
2023-09-29 18:30 ` [PATCH v3 1/3] mmap: Fix vma_iterator in error path of vma_merge() Liam R. Howlett
2023-09-29 22:21   ` Lorenzo Stoakes
2023-10-02  7:09   ` Vlastimil Babka
2023-09-29 18:30 ` [PATCH v3 2/3] mmap: Fix error paths with dup_anon_vma() Liam R. Howlett
2023-09-29 22:28   ` Lorenzo Stoakes
2023-10-02  7:26     ` Vlastimil Babka
2023-10-02  7:43       ` Lorenzo Stoakes
2023-10-03 14:45         ` Liam R. Howlett
2023-10-02  7:11   ` Vlastimil Babka
2023-10-03 16:21   ` Suren Baghdasaryan
2023-10-03 18:51     ` Liam R. Howlett
2023-10-03 19:40       ` Suren Baghdasaryan
2023-10-06 21:08     ` Andrew Morton
2023-10-06 21:32       ` Suren Baghdasaryan
2023-09-29 18:30 ` [PATCH v3 3/3] mmap: Add clarifying comment to vma_merge() code Liam R. Howlett
2023-09-29 22:30   ` Lorenzo Stoakes
2023-10-02  7:11   ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox