Skip to content

maple_tree: Fix mas_prev() state regression.

Liam R. Howlett linux-mm lkml stable 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesNew
  2. v12 patches 9 repliesApplied 2/2

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2maple_tree: Add mas_is_active() to detect in-tree walksinclude/linux/maple_tree.h+9 -00 replies
2/2maple_tree: Add MAS_UNDERFLOW and MAS_OVERFLOW statesinclude/linux/maple_tree.h lib/maple_tree.c lib/test_maple_tree.c+237 -730 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] maple_tree: Fix mas_prev() state regression.

Pedro Falcato retported an mprotect regression [1] which was bisected back to the iterator changes for maple tree. Root cause analysis showed the mas_prev() running off the end of the VMA space (previous from 0) followed by mas_find(), would skip the first value.

This patch set introduces maple state underflow/overflow so the sequence of calls on the maple state will return what the user expects.

Users who encounter this bug may see mprotect(), userfaultfd_register(), and mlock() fail on VMAs mapped with address 0.

[1] https://bugs.archlinux.org/task/79656

Liam R. Howlett (2):
maple_tree: Add mas_is_active() to detect in-tree walks
maple_tree: Add MAS_UNDERFLOW and MAS_OVERFLOW states

 include/linux/maple_tree.h |  11 ++
 lib/maple_tree.c           | 221 +++++++++++++++++++++++++++----------
 lib/test_maple_tree.c      |  87 ++++++++++++---
 3 files changed, 246 insertions(+), 73 deletions(-)
Signature · 1 line
2.40.1