Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm/pagewalk: fix stale walk->action escaping walk_pmd_range()
@ 2026-08-11 16:18 Hyunwoo Kim
  2026-08-11 16:18 ` [PATCH v2 1/2] " Hyunwoo Kim
  2026-08-11 16:18 ` [PATCH v2 2/2] selftests/mm: add stale walk->action race test Hyunwoo Kim
  0 siblings, 2 replies; 11+ messages in thread
From: Hyunwoo Kim @ 2026-08-11 16:18 UTC (permalink / raw)
  To: akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko
  Cc: linux-mm, linux-kernel, imv4bel

walk_pmd_range() could return with walk->action left at ACTION_AGAIN,
which causes walk_pud_range() to retry the PUD walk and invoke the walk
callbacks twice over the same range.

Patch 1 is the fix.  Patch 2 adds a regression test for it.

Changes in v2:
- 1/2: reworked the changelog along the lines Lorenzo suggested and said
  how the bug was found; the fix itself is unchanged (Lorenzo)
- 2/2: new, races smaps against MADV_DONTNEED and checks that Rss does not
  come out twice as large as what was faulted in (Lorenzo)
- v1: https://lore.kernel.org/r/anmdrYGVqM-U4vlo@v4bel

Hyunwoo Kim (2):
  mm/pagewalk: fix stale walk->action escaping walk_pmd_range()
  selftests/mm: add stale walk->action race test

 mm/pagewalk.c                                 |   6 +-
 tools/testing/selftests/mm/.gitignore         |   1 +
 tools/testing/selftests/mm/Makefile           |   2 +
 tools/testing/selftests/mm/ksft_pagewalk.sh   |   4 +
 .../testing/selftests/mm/pagewalk_race_test.c | 138 ++++++++++++++++++
 tools/testing/selftests/mm/run_vmtests.sh     |   2 +
 tools/testing/selftests/mm/vm_util.h          |   1 +
 7 files changed, 150 insertions(+), 4 deletions(-)
 create mode 100755 tools/testing/selftests/mm/ksft_pagewalk.sh
 create mode 100644 tools/testing/selftests/mm/pagewalk_race_test.c

-- 
2.43.0



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

end of thread, other threads:[~2026-08-11 20:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 16:18 [PATCH v2 0/2] mm/pagewalk: fix stale walk->action escaping walk_pmd_range() Hyunwoo Kim
2026-08-11 16:18 ` [PATCH v2 1/2] " Hyunwoo Kim
2026-08-11 16:23   ` Lorenzo Stoakes (ARM)
2026-08-11 17:10   ` David Hildenbrand (Arm)
2026-08-11 19:37   ` Andrew Morton
2026-08-11 20:17     ` Hyunwoo Kim
2026-08-11 16:18 ` [PATCH v2 2/2] selftests/mm: add stale walk->action race test Hyunwoo Kim
2026-08-11 16:33   ` Lorenzo Stoakes (ARM)
2026-08-11 17:11   ` David Hildenbrand (Arm)
2026-08-11 18:23     ` Lorenzo Stoakes (ARM)
2026-08-11 18:49       ` David Hildenbrand (Arm)

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