Patch "maple_tree: add mas_is_active() to detect in-tree walks" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    maple_tree: add mas_is_active() to detect in-tree walks

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     maple_tree-add-mas_is_active-to-detect-in-tree-walks.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 264d5a8c32f6ed81eb35ccd399db0183fe0bb583
Author: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
Date:   Thu Sep 21 14:12:35 2023 -0400

    maple_tree: add mas_is_active() to detect in-tree walks
    
    [ Upstream commit 5c590804b6b0ff933ed4e5cee5d76de3a5048d9f ]
    
    Patch series "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 patchset 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.
    
    This patch (of 2):
    
    Instead of constantly checking each possibility of the maple state,
    create a fast path that will skip over checking unlikely states.
    
    Link: https://lkml.kernel.org/r/20230921181236.509072-1-Liam.Howlett@xxxxxxxxxx
    Link: https://lkml.kernel.org/r/20230921181236.509072-2-Liam.Howlett@xxxxxxxxxx
    Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
    Cc: Pedro Falcato <pedro.falcato@xxxxxxxxx>
    Cc: <stable@xxxxxxxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h
index 295548cca8b36..e1e5f38384b20 100644
--- a/include/linux/maple_tree.h
+++ b/include/linux/maple_tree.h
@@ -503,6 +503,15 @@ static inline bool mas_is_paused(const struct ma_state *mas)
 	return mas->node == MAS_PAUSE;
 }
 
+/* Check if the mas is pointing to a node or not */
+static inline bool mas_is_active(struct ma_state *mas)
+{
+	if ((unsigned long)mas->node >= MAPLE_RESERVED_RANGE)
+		return true;
+
+	return false;
+}
+
 /**
  * mas_reset() - Reset a Maple Tree operation state.
  * @mas: Maple Tree operation state.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux