Patch "scm: add user copy checks to put_cmsg()" has been added to the 5.15-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

    scm: add user copy checks to put_cmsg()

to the 5.15-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:
     scm-add-user-copy-checks-to-put_cmsg.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 14f69e43706984d6e588e4016320b348930768bb
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Fri Feb 17 18:24:54 2023 +0000

    scm: add user copy checks to put_cmsg()
    
    [ Upstream commit 5f1eb1ff58ea122e24adf0bc940f268ed2227462 ]
    
    This is a followup of commit 2558b8039d05 ("net: use a bounce
    buffer for copying skb->mark")
    
    x86 and powerpc define user_access_begin, meaning
    that they are not able to perform user copy checks
    when using user_write_access_begin() / unsafe_copy_to_user()
    and friends [1]
    
    Instead of waiting bugs to trigger on other arches,
    add a check_object_size() in put_cmsg() to make sure
    that new code tested on x86 with CONFIG_HARDENED_USERCOPY=y
    will perform more security checks.
    
    [1] We can not generically call check_object_size() from
    unsafe_copy_to_user() because UACCESS is enabled at this point.
    
    Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Cc: Kees Cook <keescook@xxxxxxxxxxxx>
    Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/scm.c b/net/core/scm.c
index 5c356f0dee30c..acb7d776fa6ec 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -229,6 +229,8 @@ int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
 	if (msg->msg_control_is_user) {
 		struct cmsghdr __user *cm = msg->msg_control_user;
 
+		check_object_size(data, cmlen - sizeof(*cm), true);
+
 		if (!user_write_access_begin(cm, cmlen))
 			goto efault;
 



[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