All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get
@ 2022-07-13 18:13 ` Khalid Masum
  0 siblings, 0 replies; 10+ messages in thread
From: Khalid Masum @ 2022-07-13 18:13 UTC (permalink / raw)
  To: linux-kernel-mentees, linux-kernel, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev
  Cc: Shuah Khan, Pavel Skripkin, khalid.masum.92, Marc Kleine-Budde,
	Stefano Garzarella, Alexei Starovoitov, Florian Fainelli,
	Nikolay Aleksandrov, syzbot+1fa91bcd05206ff8cbb5

Using size of sk_psock as the size for kcm_psock_cache size no longer
reproduces the issue. There might be a better way to solve this issue
though so I would like to ask for feedback.

The patch was sent to the wrong mailing list so resending it. Please
ignore the previous one.

Reported-and-tested-by: syzbot+1fa91bcd05206ff8cbb5@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=1fa91bcd05206ff8cbb5

Khalid Masum (1):
  net: kcm: Use sk_psock size for kcm_psock_cache

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

-- 
2.36.1


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

* [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get
@ 2022-07-13 18:13 ` Khalid Masum
  0 siblings, 0 replies; 10+ messages in thread
From: Khalid Masum @ 2022-07-13 18:13 UTC (permalink / raw)
  To: linux-kernel-mentees, linux-kernel, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev
  Cc: Florian Fainelli, Pavel Skripkin, Alexei Starovoitov,
	syzbot+1fa91bcd05206ff8cbb5, Marc Kleine-Budde,
	Nikolay Aleksandrov, Stefano Garzarella

Using size of sk_psock as the size for kcm_psock_cache size no longer
reproduces the issue. There might be a better way to solve this issue
though so I would like to ask for feedback.

The patch was sent to the wrong mailing list so resending it. Please
ignore the previous one.

Reported-and-tested-by: syzbot+1fa91bcd05206ff8cbb5@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=1fa91bcd05206ff8cbb5

Khalid Masum (1):
  net: kcm: Use sk_psock size for kcm_psock_cache

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

-- 
2.36.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* [RFC PATCH 1/1] net: kcm: Use sk_psock size for kcm_psock_cache
  2022-07-13 18:13 ` Khalid Masum
@ 2022-07-13 18:13   ` Khalid Masum
  -1 siblings, 0 replies; 10+ messages in thread
From: Khalid Masum @ 2022-07-13 18:13 UTC (permalink / raw)
  To: linux-kernel-mentees, linux-kernel, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev
  Cc: Shuah Khan, Pavel Skripkin, khalid.masum.92, Marc Kleine-Budde,
	Stefano Garzarella, Alexei Starovoitov, Florian Fainelli,
	Nikolay Aleksandrov, syzbot+1fa91bcd05206ff8cbb5

`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@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=1fa91bcd05206ff8cbb5
Signed-off-by: Khalid Masum <khalid.masum.92@gmail.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


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

* [RFC PATCH 1/1] net: kcm: Use sk_psock size for kcm_psock_cache
@ 2022-07-13 18:13   ` Khalid Masum
  0 siblings, 0 replies; 10+ messages in thread
From: Khalid Masum @ 2022-07-13 18:13 UTC (permalink / raw)
  To: linux-kernel-mentees, linux-kernel, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev
  Cc: Florian Fainelli, Pavel Skripkin, Alexei Starovoitov,
	syzbot+1fa91bcd05206ff8cbb5, Marc Kleine-Budde,
	Nikolay Aleksandrov, Stefano Garzarella

`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@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=1fa91bcd05206ff8cbb5
Signed-off-by: Khalid Masum <khalid.masum.92@gmail.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

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* Re: [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get
  2022-07-13 18:13 ` Khalid Masum
@ 2022-07-13 18:56   ` Jakub Kicinski
  -1 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2022-07-13 18:56 UTC (permalink / raw)
  To: Khalid Masum
  Cc: linux-kernel-mentees, linux-kernel, David S . Miller,
	Eric Dumazet, Paolo Abeni, netdev, Shuah Khan, Pavel Skripkin,
	Marc Kleine-Budde, Stefano Garzarella, Alexei Starovoitov,
	Florian Fainelli, Nikolay Aleksandrov,
	syzbot+1fa91bcd05206ff8cbb5

On Thu, 14 Jul 2022 00:13:23 +0600 Khalid Masum wrote:
> Using size of sk_psock as the size for kcm_psock_cache size no longer
> reproduces the issue. There might be a better way to solve this issue
> though so I would like to ask for feedback.
> 
> The patch was sent to the wrong mailing list so resending it. Please
> ignore the previous one.

What happened to my other off-list feedback?

I pointed you at another solution which was already being discussed -
does it solve the issue you're fixing?

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

* Re: [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get
@ 2022-07-13 18:56   ` Jakub Kicinski
  0 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2022-07-13 18:56 UTC (permalink / raw)
  To: Khalid Masum
  Cc: Florian Fainelli, netdev, linux-kernel, Alexei Starovoitov,
	Eric Dumazet, Marc Kleine-Budde, Pavel Skripkin,
	Nikolay Aleksandrov, syzbot+1fa91bcd05206ff8cbb5, Paolo Abeni,
	linux-kernel-mentees, David S . Miller, Stefano Garzarella

On Thu, 14 Jul 2022 00:13:23 +0600 Khalid Masum wrote:
> Using size of sk_psock as the size for kcm_psock_cache size no longer
> reproduces the issue. There might be a better way to solve this issue
> though so I would like to ask for feedback.
> 
> The patch was sent to the wrong mailing list so resending it. Please
> ignore the previous one.

What happened to my other off-list feedback?

I pointed you at another solution which was already being discussed -
does it solve the issue you're fixing?
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* Re: [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get
  2022-07-13 18:56   ` Jakub Kicinski
@ 2022-07-14  3:55     ` Khalid Masum
  -1 siblings, 0 replies; 10+ messages in thread
From: Khalid Masum @ 2022-07-14  3:55 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: linux-kernel-mentees, linux-kernel, David S . Miller,
	Eric Dumazet, Paolo Abeni, netdev, Shuah Khan, Pavel Skripkin,
	Marc Kleine-Budde, Stefano Garzarella, Alexei Starovoitov,
	Florian Fainelli, Nikolay Aleksandrov,
	syzbot+1fa91bcd05206ff8cbb5

On Thu, Jul 14, 2022 at 12:56 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 14 Jul 2022 00:13:23 +0600 Khalid Masum wrote:
> > Using size of sk_psock as the size for kcm_psock_cache size no longer
> > reproduces the issue. There might be a better way to solve this issue
> > though so I would like to ask for feedback.
> >
> > The patch was sent to the wrong mailing list so resending it. Please
> > ignore the previous one.
>
> What happened to my other off-list feedback?
>
> I pointed you at another solution which was already being discussed -
> does it solve the issue you're fixing?

Yes, this patch solves the issue I am fixing.

thanks,
Khalid Masum

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

* Re: [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get
@ 2022-07-14  3:55     ` Khalid Masum
  0 siblings, 0 replies; 10+ messages in thread
From: Khalid Masum @ 2022-07-14  3:55 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Florian Fainelli, netdev, linux-kernel, Alexei Starovoitov,
	Eric Dumazet, Marc Kleine-Budde, Pavel Skripkin,
	Nikolay Aleksandrov, syzbot+1fa91bcd05206ff8cbb5, Paolo Abeni,
	linux-kernel-mentees, David S . Miller, Stefano Garzarella

On Thu, Jul 14, 2022 at 12:56 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 14 Jul 2022 00:13:23 +0600 Khalid Masum wrote:
> > Using size of sk_psock as the size for kcm_psock_cache size no longer
> > reproduces the issue. There might be a better way to solve this issue
> > though so I would like to ask for feedback.
> >
> > The patch was sent to the wrong mailing list so resending it. Please
> > ignore the previous one.
>
> What happened to my other off-list feedback?
>
> I pointed you at another solution which was already being discussed -
> does it solve the issue you're fixing?

Yes, this patch solves the issue I am fixing.

thanks,
Khalid Masum
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* Re: [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get
  2022-07-14  3:55     ` Khalid Masum
@ 2022-07-14  3:58       ` Jakub Kicinski
  -1 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2022-07-14  3:58 UTC (permalink / raw)
  To: Khalid Masum
  Cc: linux-kernel-mentees, linux-kernel, David S . Miller,
	Eric Dumazet, Paolo Abeni, netdev, Shuah Khan, Pavel Skripkin,
	Marc Kleine-Budde, Stefano Garzarella, Alexei Starovoitov,
	Florian Fainelli, Nikolay Aleksandrov,
	syzbot+1fa91bcd05206ff8cbb5

On Thu, 14 Jul 2022 09:55:18 +0600 Khalid Masum wrote:
> On Thu, Jul 14, 2022 at 12:56 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > On Thu, 14 Jul 2022 00:13:23 +0600 Khalid Masum wrote:  
> > > Using size of sk_psock as the size for kcm_psock_cache size no longer
> > > reproduces the issue. There might be a better way to solve this issue
> > > though so I would like to ask for feedback.
> > >
> > > The patch was sent to the wrong mailing list so resending it. Please
> > > ignore the previous one.  
> >
> > What happened to my other off-list feedback?
> >
> > I pointed you at another solution which was already being discussed -
> > does it solve the issue you're fixing?  
> 
> Yes, this patch solves the issue I am fixing.

Thanks for checking! You can send your

Tested-by:

tag in reply to the most recent posting if you'd like:

https://lore.kernel.org/all/165772238175.1757.4978340330606055982.stgit@oracle-102.nfsv4.dev/

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

* Re: [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get
@ 2022-07-14  3:58       ` Jakub Kicinski
  0 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2022-07-14  3:58 UTC (permalink / raw)
  To: Khalid Masum
  Cc: Florian Fainelli, netdev, linux-kernel, Alexei Starovoitov,
	Eric Dumazet, Marc Kleine-Budde, Pavel Skripkin,
	Nikolay Aleksandrov, syzbot+1fa91bcd05206ff8cbb5, Paolo Abeni,
	linux-kernel-mentees, David S . Miller, Stefano Garzarella

On Thu, 14 Jul 2022 09:55:18 +0600 Khalid Masum wrote:
> On Thu, Jul 14, 2022 at 12:56 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > On Thu, 14 Jul 2022 00:13:23 +0600 Khalid Masum wrote:  
> > > Using size of sk_psock as the size for kcm_psock_cache size no longer
> > > reproduces the issue. There might be a better way to solve this issue
> > > though so I would like to ask for feedback.
> > >
> > > The patch was sent to the wrong mailing list so resending it. Please
> > > ignore the previous one.  
> >
> > What happened to my other off-list feedback?
> >
> > I pointed you at another solution which was already being discussed -
> > does it solve the issue you're fixing?  
> 
> Yes, this patch solves the issue I am fixing.

Thanks for checking! You can send your

Tested-by:

tag in reply to the most recent posting if you'd like:

https://lore.kernel.org/all/165772238175.1757.4978340330606055982.stgit@oracle-102.nfsv4.dev/
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

end of thread, other threads:[~2022-07-14  3:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 18:13 [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get Khalid Masum
2022-07-13 18:13 ` Khalid Masum
2022-07-13 18:13 ` [RFC PATCH 1/1] net: kcm: Use sk_psock size for kcm_psock_cache Khalid Masum
2022-07-13 18:13   ` Khalid Masum
2022-07-13 18:56 ` [RFC PATCH 0/1][RESEND] Fix KASAN: slab-out-of-bounds Read in sk_psock_get Jakub Kicinski
2022-07-13 18:56   ` Jakub Kicinski
2022-07-14  3:55   ` Khalid Masum
2022-07-14  3:55     ` Khalid Masum
2022-07-14  3:58     ` Jakub Kicinski
2022-07-14  3:58       ` Jakub Kicinski

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.