lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220713181324.14228-2-khalid.masum.92@gmail.com>
Date:   Thu, 14 Jul 2022 00:13:24 +0600
From:   Khalid Masum <khalid.masum.92@...il.com>
To:     linux-kernel-mentees@...ts.linuxfoundation.org,
        linux-kernel@...r.kernel.org,
        "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org
Cc:     Shuah Khan <skhan@...uxfoundation.org>,
        Pavel Skripkin <paskripkin@...il.com>,
        khalid.masum.92@...il.com, Marc Kleine-Budde <mkl@...gutronix.de>,
        Stefano Garzarella <sgarzare@...hat.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        Nikolay Aleksandrov <nikolay@...dia.com>,
        syzbot+1fa91bcd05206ff8cbb5@...kaller.appspotmail.com
Subject: [RFC PATCH 1/1] net: kcm: Use sk_psock size for kcm_psock_cache

`struct sock` has a member `sk_user_data`, which got its memory allocated
in `kcm_attach` by `kcm_psock_cache` with the size of `kcm_psock`. Which
is not enough when the member is used as `sk_psock` causing out of bound
read.

Use `sk_psock` size to allocate memory instead for `sk_user_data`.

Reported-by: syzbot+1fa91bcd05206ff8cbb5@...kaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=1fa91bcd05206ff8cbb5
Signed-off-by: Khalid Masum <khalid.masum.92@...il.com>

---
 net/kcm/kcmsock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 71899e5a5a11..688bee56f90c 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -23,6 +23,7 @@
 #include <linux/workqueue.h>
 #include <linux/syscalls.h>
 #include <linux/sched/signal.h>
+#include <linux/skmsg.h>
 
 #include <net/kcm.h>
 #include <net/netns/generic.h>
@@ -2041,7 +2042,7 @@ static int __init kcm_init(void)
 		goto fail;
 
 	kcm_psockp = kmem_cache_create("kcm_psock_cache",
-				       sizeof(struct kcm_psock), 0,
+				       sizeof(struct sk_psock), 0,
 					SLAB_HWCACHE_ALIGN, NULL);
 	if (!kcm_psockp)
 		goto fail;
-- 
2.36.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ