Patch "powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas()" has been added to the 6.10-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

    powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas()

to the 6.10-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:
     powerpc-rtas-prevent-spectre-v1-gadget-construction-.patch
and it can be found in the queue-6.10 subdirectory.

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



commit d61cfd990a36ab6a9e55d8c433c891b73cdd179a
Author: Nathan Lynch <nathanl@xxxxxxxxxxxxx>
Date:   Thu May 30 19:44:12 2024 -0500

    powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas()
    
    [ Upstream commit 0974d03eb479384466d828d65637814bee6b26d7 ]
    
    Smatch warns:
    
      arch/powerpc/kernel/rtas.c:1932 __do_sys_rtas() warn: potential
      spectre issue 'args.args' [r] (local cap)
    
    The 'nargs' and 'nret' locals come directly from a user-supplied
    buffer and are used as indexes into a small stack-based array and as
    inputs to copy_to_user() after they are subject to bounds checks.
    
    Use array_index_nospec() after the bounds checks to clamp these values
    for speculative execution.
    
    Signed-off-by: Nathan Lynch <nathanl@xxxxxxxxxxxxx>
    Reported-by: Breno Leitao <leitao@xxxxxxxxxx>
    Reviewed-by: Breno Leitao <leitao@xxxxxxxxxx>
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Link: https://msgid.link/20240530-sys_rtas-nargs-nret-v1-1-129acddd4d89@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 8064d9c3de86..f7e86e09c49f 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -19,6 +19,7 @@
 #include <linux/lockdep.h>
 #include <linux/memblock.h>
 #include <linux/mutex.h>
+#include <linux/nospec.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 #include <linux/reboot.h>
@@ -1916,6 +1917,9 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)
 	    || nargs + nret > ARRAY_SIZE(args.args))
 		return -EINVAL;
 
+	nargs = array_index_nospec(nargs, ARRAY_SIZE(args.args));
+	nret = array_index_nospec(nret, ARRAY_SIZE(args.args) - nargs);
+
 	/* Copy in args. */
 	if (copy_from_user(args.args, uargs->args,
 			   nargs * sizeof(rtas_arg_t)) != 0)




[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