linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Avoid memory corruption caused by per-VMA locks
@ 2023-07-05 17:12 Suren Baghdasaryan
  2023-07-05 17:12 ` [PATCH v3 1/2] fork: lock VMAs of the parent process when forking Suren Baghdasaryan
  2023-07-05 17:12 ` [PATCH v3 2/2] mm: disable CONFIG_PER_VMA_LOCK until its fixed Suren Baghdasaryan
  0 siblings, 2 replies; 27+ messages in thread
From: Suren Baghdasaryan @ 2023-07-05 17:12 UTC (permalink / raw)
  To: akpm
  Cc: jirislaby, jacobly.alt, holger, hdegoede, michel, jglisse,
	mhocko, vbabka, hannes, mgorman, dave, willy, liam.howlett,
	peterz, ldufour, paulmck, mingo, will, luto, songliubraving,
	peterx, david, dhowells, hughd, bigeasy, kent.overstreet,
	punit.agrawal, lstoakes, peterjung1337, rientjes, chriscli,
	axelrasmussen, joelaf, minchan, rppt, jannh, shakeelb, tatashin,
	edumazet, gthelen, linux-mm, linux-kernel, stable,
	Suren Baghdasaryan

A memory corruption was reported in [1] with bisection pointing to the
patch [2] enabling per-VMA locks for x86. Based on the reproducer
provided in [1] we suspect this is caused by the lack of VMA locking
while forking a child process.

Patch 1/2 in the series implements proper VMA locking during fork.
I tested the fix locally using the reproducer and was unable to reproduce
the memory corruption problem.
This fix can potentially regress some fork-heavy workloads. Kernel build
time did not show noticeable regression on a 56-core machine while a
stress test mapping 10000 VMAs and forking 5000 times in a tight loop
shows ~5% regression. If such fork time regression is unacceptable,
disabling CONFIG_PER_VMA_LOCK should restore its performance. Further
optimizations are possible if this regression proves to be problematic.

Patch 2/2 disabled per-VMA locks until the fix is tested and verified.

Both patches apply cleanly over Linus' ToT and stable 6.4.y branch.

Changes from v2 posted at [3]:
- Move VMA locking before flush_cache_dup_mm, per David Hildenbrand

[1] https://bugzilla.kernel.org/show_bug.cgi?id=217624
[2] https://lore.kernel.org/all/20230227173632.3292573-30-surenb@google.com
[3] https://lore.kernel.org/all/20230705063711.2670599-1-surenb@google.com/

Suren Baghdasaryan (2):
  fork: lock VMAs of the parent process when forking
  mm: disable CONFIG_PER_VMA_LOCK until its fixed

 kernel/fork.c | 6 ++++++
 mm/Kconfig    | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

-- 
2.41.0.255.g8b1d071c50-goog



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

end of thread, other threads:[~2023-07-06  1:17 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 17:12 [PATCH v3 0/2] Avoid memory corruption caused by per-VMA locks Suren Baghdasaryan
2023-07-05 17:12 ` [PATCH v3 1/2] fork: lock VMAs of the parent process when forking Suren Baghdasaryan
2023-07-05 17:14   ` David Hildenbrand
2023-07-05 17:23     ` Suren Baghdasaryan
2023-07-05 23:06       ` Liam R. Howlett
2023-07-06  0:20         ` Suren Baghdasaryan
2023-07-06  0:32           ` Liam R. Howlett
2023-07-06  0:42             ` Suren Baghdasaryan
2023-07-05 17:12 ` [PATCH v3 2/2] mm: disable CONFIG_PER_VMA_LOCK until its fixed Suren Baghdasaryan
2023-07-05 17:15   ` David Hildenbrand
2023-07-05 17:22     ` Suren Baghdasaryan
2023-07-05 17:24       ` David Hildenbrand
2023-07-05 18:09         ` Suren Baghdasaryan
2023-07-05 18:14           ` Suren Baghdasaryan
2023-07-05 20:25       ` Peter Xu
2023-07-05 20:33         ` Suren Baghdasaryan
2023-07-06  0:24           ` Andrew Morton
2023-07-06  0:30             ` Suren Baghdasaryan
2023-07-06  0:32               ` Suren Baghdasaryan
2023-07-06  0:44                 ` Andrew Morton
2023-07-06  0:49                   ` Suren Baghdasaryan
2023-07-06  1:16                     ` Suren Baghdasaryan
2023-07-05 20:37         ` David Hildenbrand
2023-07-05 21:09           ` Suren Baghdasaryan
2023-07-05 21:27         ` Matthew Wilcox
2023-07-05 21:54           ` Suren Baghdasaryan
2023-07-05 21:55           ` Peter Xu

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