All of lore.kernel.org
 help / color / mirror / Atom feed
* + lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch added to mm-new branch
@ 2026-03-06 21:33 Andrew Morton
       [not found] ` <CAHgTTC+i_wUady+CQkkHf+BaQhGcjA21Qrxp8a+UXqvtvp8dAA@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-03-06 21:33 UTC (permalink / raw)
  To: mm-commits, liam.howlett, andrewjballance, aliceryhl, objecting,
	akpm


The patch titled
     Subject: lib/maple_tree: fix swapped arguments in mas_safe_pivot() call
has been added to the -mm mm-new branch.  Its filename is
     lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Josh Law <objecting@objecting.org>
Subject: lib/maple_tree: fix swapped arguments in mas_safe_pivot() call
Date: Fri, 6 Mar 2026 20:08:20 +0000

The call to mas_safe_pivot() in mas_wr_extend_null() has the pivot index
and maple type arguments swapped.  The function signature expects (mas,
pivots, piv, type) but the call passes (mas, pivots, type, piv).

This causes the pivot index to be interpreted as a maple node type and
vice versa, leading to incorrect pivot lookups.  In practice, this means a
null-extending store into a maple tree node can read the wrong pivot
value, potentially corrupting the range tracked by the maple state.  For a
VMA maple tree, this could cause an incorrect vm_area_struct range to be
returned during operations like mmap or munmap, leading to silent memory
mapping corruption.

Every other mas_safe_pivot() call site in the file passes the arguments in
the correct (piv, type) order; this is the only one with them reversed.

Link: https://lkml.kernel.org/r/20260306200820.2819999-1-objecting@objecting.org
Fixes: 54a611b60590 ("Maple Tree: add new data structure")
Signed-off-by: Josh Law <objecting@objecting.org>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Andrew Ballance <andrewjballance@gmail.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/maple_tree.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/lib/maple_tree.c~lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call
+++ a/lib/maple_tree.c
@@ -2932,7 +2932,7 @@ static inline void mas_extend_spanning_n
 	    (r_mas->last < r_mas->max) &&
 	    !mas_slot_locked(r_mas, r_wr_mas->slots, r_mas->offset + 1)) {
 		r_mas->last = mas_safe_pivot(r_mas, r_wr_mas->pivots,
-					     r_wr_mas->type, r_mas->offset + 1);
+					     r_mas->offset + 1, r_wr_mas->type);
 		r_mas->offset++;
 		r_wr_mas->r_max = r_mas->last;
 	}
_

Patches currently in -mm which might be from objecting@objecting.org are

lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch
lib-glob-fix-grammar-and-replace-non-inclusive-terminology.patch
lib-glob-add-explicit-include-for-exporth.patch
lib-glob-replace-bitwise-or-with-logical-operation-on-boolean.patch
lib-glob-clean-up-bool-abuse-in-pointer-arithmetic.patch
lib-uuid-fix-typo-reversion-to-revision-in-comment.patch
lib-inflate-fix-memory-leak-in-inflate_fixed-on-inflate_codes-failure.patch
lib-inflate-fix-memory-leak-in-inflate_dynamic-on-inflate_codes-failure.patch
lib-inflate-fix-grammar-in-comment-variable-to-variables.patch
lib-inflate-fix-typo-this-results-to-the-results-in-comment.patch
lib-bug-fix-inconsistent-capitalization-in-bug-message.patch
lib-bug-remove-unnecessary-variable-initializations.patch
lib-idr-fix-ida_find_first_range-missing-ids-across-chunk-boundaries.patch


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

* Re: + lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch added to mm-new branch
       [not found] ` <CAHgTTC+i_wUady+CQkkHf+BaQhGcjA21Qrxp8a+UXqvtvp8dAA@mail.gmail.com>
@ 2026-03-06 22:52   ` Andrew Morton
  2026-03-06 22:54     ` Josh Law
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-03-06 22:52 UTC (permalink / raw)
  To: kek ma
  Cc: mm-commits, liam.howlett, andrewjballance, aliceryhl,
	techyguyperplexable

On Fri, 6 Mar 2026 21:36:11 +0000 kek ma <hlcj1234567@gmail.com> wrote:

> Hello, I'm using Gmail because this is very important
> 
> What needs to be improved to make it merge to linux-next?
> 
> It says in your email it won't be merged to next
> 

OK, I enhanced the message:


  The mm-new branch of mm.git is not included in linux-next
+
+ If a few days of testing in mm-new is successful, the patch will me moved
+ into mm.git's mm-unstable branch, which is included in linux-next



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

* Re: + lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch added to mm-new branch
  2026-03-06 22:52   ` Andrew Morton
@ 2026-03-06 22:54     ` Josh Law
  0 siblings, 0 replies; 3+ messages in thread
From: Josh Law @ 2026-03-06 22:54 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mm-commits, liam.howlett, andrewjballance, aliceryhl,
	techyguyperplexable

6 Mar 2026 22:52:40 Andrew Morton <akpm@linux-foundation.org>:

> On Fri, 6 Mar 2026 21:36:11 +0000 kek ma <hlcj1234567@gmail.com> wrote:
>
>> Hello, I'm using Gmail because this is very important
>>
>> What needs to be improved to make it merge to linux-next?
>>
>> It says in your email it won't be merged to next
>>
>
> OK, I enhanced the message:
>
>
>   The mm-new branch of mm.git is not included in linux-next
> +
> + If a few days of testing in mm-new is successful, the patch will me moved
> + into mm.git's mm-unstable branch, which is included in linux-next

Thanks Andrew, I submitted another patch with the Cc: stable
Because I think that it is needed

Better safe than sorry :)

V/R

V/R



Josh Law

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

end of thread, other threads:[~2026-03-06 22:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 21:33 + lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch added to mm-new branch Andrew Morton
     [not found] ` <CAHgTTC+i_wUady+CQkkHf+BaQhGcjA21Qrxp8a+UXqvtvp8dAA@mail.gmail.com>
2026-03-06 22:52   ` Andrew Morton
2026-03-06 22:54     ` Josh Law

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.