netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
@ 2024-02-14 16:27 kovalev
  2024-02-14 16:49 ` Pablo Neira Ayuso
  2024-02-21 22:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 10+ messages in thread
From: kovalev @ 2024-02-14 16:27 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: edumazet, pablo, laforge, davem, kuba, pabeni, kovalev, nickel,
	oficerovas, dutyrok, stable

From: Vasiliy Kovalev <kovalev@altlinux.org>

The gtp_net_ops pernet operations structure for the subsystem must be
registered before registering the generic netlink family.

Syzkaller hit 'general protection fault in gtp_genl_dump_pdp' bug:

general protection fault, probably for non-canonical address
0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
CPU: 1 PID: 5826 Comm: gtp Not tainted 6.8.0-rc3-std-def-alt1 #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-alt1 04/01/2014
RIP: 0010:gtp_genl_dump_pdp+0x1be/0x800 [gtp]
Code: c6 89 c6 e8 64 e9 86 df 58 45 85 f6 0f 85 4e 04 00 00 e8 c5 ee 86
      df 48 8b 54 24 18 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80>
      3c 02 00 0f 85 de 05 00 00 48 8b 44 24 18 4c 8b 30 4c 39 f0 74
RSP: 0018:ffff888014107220 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88800fcda588 R14: 0000000000000001 R15: 0000000000000000
FS:  00007f1be4eb05c0(0000) GS:ffff88806ce80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1be4e766cf CR3: 000000000c33e000 CR4: 0000000000750ef0
PKRU: 55555554
Call Trace:
 <TASK>
 ? show_regs+0x90/0xa0
 ? die_addr+0x50/0xd0
 ? exc_general_protection+0x148/0x220
 ? asm_exc_general_protection+0x22/0x30
 ? gtp_genl_dump_pdp+0x1be/0x800 [gtp]
 ? __alloc_skb+0x1dd/0x350
 ? __pfx___alloc_skb+0x10/0x10
 genl_dumpit+0x11d/0x230
 netlink_dump+0x5b9/0xce0
 ? lockdep_hardirqs_on_prepare+0x253/0x430
 ? __pfx_netlink_dump+0x10/0x10
 ? kasan_save_track+0x10/0x40
 ? __kasan_kmalloc+0x9b/0xa0
 ? genl_start+0x675/0x970
 __netlink_dump_start+0x6fc/0x9f0
 genl_family_rcv_msg_dumpit+0x1bb/0x2d0
 ? __pfx_genl_family_rcv_msg_dumpit+0x10/0x10
 ? genl_op_from_small+0x2a/0x440
 ? cap_capable+0x1d0/0x240
 ? __pfx_genl_start+0x10/0x10
 ? __pfx_genl_dumpit+0x10/0x10
 ? __pfx_genl_done+0x10/0x10
 ? security_capable+0x9d/0xe0

Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
Cc: stable@vger.kernel.org
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
 drivers/net/gtp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index b1919278e931f4..2129ae42c70304 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -1907,20 +1907,20 @@ static int __init gtp_init(void)
 	if (err < 0)
 		goto error_out;
 
-	err = genl_register_family(&gtp_genl_family);
+	err = register_pernet_subsys(&gtp_net_ops);
 	if (err < 0)
 		goto unreg_rtnl_link;
 
-	err = register_pernet_subsys(&gtp_net_ops);
+	err = genl_register_family(&gtp_genl_family);
 	if (err < 0)
-		goto unreg_genl_family;
+		goto unreg_pernet_subsys;
 
 	pr_info("GTP module loaded (pdp ctx size %zd bytes)\n",
 		sizeof(struct pdp_ctx));
 	return 0;
 
-unreg_genl_family:
-	genl_unregister_family(&gtp_genl_family);
+unreg_pernet_subsys:
+	unregister_pernet_subsys(&gtp_net_ops);
 unreg_rtnl_link:
 	rtnl_link_unregister(&gtp_link_ops);
 error_out:
-- 
2.33.8


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

* Re: [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
  2024-02-14 16:27 [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp() kovalev
@ 2024-02-14 16:49 ` Pablo Neira Ayuso
  2024-02-14 17:06   ` kovalev
  2024-02-21 22:30 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 10+ messages in thread
From: Pablo Neira Ayuso @ 2024-02-14 16:49 UTC (permalink / raw)
  To: kovalev
  Cc: linux-kernel, netdev, edumazet, laforge, davem, kuba, pabeni,
	nickel, oficerovas, dutyrok, stable

On Wed, Feb 14, 2024 at 07:27:33PM +0300, kovalev@altlinux.org wrote:
> From: Vasiliy Kovalev <kovalev@altlinux.org>
> 
> The gtp_net_ops pernet operations structure for the subsystem must be
> registered before registering the generic netlink family.

Thanks for finding a remedy for this.

If your fix is correct, (I didn't test your patch yet) then maybe this
needs to be fixed in a few more spots in the tree?

net/devlink/core.c-static int __init devlink_init(void)
net/devlink/core.c-{
net/devlink/core.c-     int err;
net/devlink/core.c-
net/devlink/core.c-     err = genl_register_family(&devlink_nl_family);
net/devlink/core.c-     if (err)
net/devlink/core.c-             goto out;
net/devlink/core.c:     err = register_pernet_subsys(&devlink_pernet_ops);
net/devlink/core.c-     if (err)

net/handshake/netlink.c-        ret = genl_register_family(&handshake_nl_family);
net/handshake/netlink.c-        if (ret) {
net/handshake/netlink.c-                pr_warn("handshake: netlink registration failed (%d)\n", ret);
net/handshake/netlink.c-                handshake_req_hash_destroy();
net/handshake/netlink.c-                return ret;
net/handshake/netlink.c-        }
net/handshake/netlink.c-
net/handshake/netlink.c-        /*
net/handshake/netlink.c-         * ORDER: register_pernet_subsys must be done last.
net/handshake/netlink.c-         *
net/handshake/netlink.c-         *      If initialization does not make it past pernet_subsys
net/handshake/netlink.c-         *      registration, then handshake_net_id will remain 0. That
net/handshake/netlink.c-         *      shunts the handshake consumer API to return ENOTSUPP
net/handshake/netlink.c-         *      to prevent it from dereferencing something that hasn't
net/handshake/netlink.c-         *      been allocated.
net/handshake/netlink.c-         */
net/handshake/netlink.c:        ret = register_pernet_subsys(&handshake_genl_net_ops);

net/ipv4/tcp_metrics.c: ret = register_pernet_subsys(&tcp_net_metrics_ops);
net/ipv4/tcp_metrics.c- if (ret < 0)
net/ipv4/tcp_metrics.c-         panic("Could not register tcp_net_metrics_ops\n");
net/ipv4/tcp_metrics.c-
net/ipv4/tcp_metrics.c- ret = genl_register_family(&tcp_metrics_nl_family);
net/ipv4/tcp_metrics.c- if (ret < 0)
net/ipv4/tcp_metrics.c-         panic("Could not register tcp_metrics generic netlink\n");
net/ipv4/tcp_metrics.c-}

net/ipv6/ioam6.c-int __init ioam6_init(void)
net/ipv6/ioam6.c-{
net/ipv6/ioam6.c:       int err = register_pernet_subsys(&ioam6_net_ops);
net/ipv6/ioam6.c-       if (err)
net/ipv6/ioam6.c-               goto out;
net/ipv6/ioam6.c-
net/ipv6/ioam6.c-       err = genl_register_family(&ioam6_genl_family);
net/ipv6/ioam6.c-       if (err)
net/ipv6/ioam6.c-               goto out_unregister_pernet_subsys;

net/ipv6/seg6.c-        err = genl_register_family(&seg6_genl_family);
net/ipv6/seg6.c-        if (err)
net/ipv6/seg6.c-                goto out;
net/ipv6/seg6.c-
net/ipv6/seg6.c:        err = register_pernet_subsys(&ip6_segments_ops);
net/ipv6/seg6.c-        if (err)
net/ipv6/seg6.c-                goto out_unregister_genl;

net/netlink/genetlink.c-        err = genl_register_family(&genl_ctrl);
net/netlink/genetlink.c-        if (err < 0)
net/netlink/genetlink.c-                goto problem;
net/netlink/genetlink.c-
net/netlink/genetlink.c:        err = register_pernet_subsys(&genl_pernet_ops);
net/netlink/genetlink.c-        if (err)
net/netlink/genetlink.c-                goto problem;

> Syzkaller hit 'general protection fault in gtp_genl_dump_pdp' bug:
[...]
> diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
> index b1919278e931f4..2129ae42c70304 100644
> --- a/drivers/net/gtp.c
> +++ b/drivers/net/gtp.c
> @@ -1907,20 +1907,20 @@ static int __init gtp_init(void)
>  	if (err < 0)
>  		goto error_out;
>  
> -	err = genl_register_family(&gtp_genl_family);
> +	err = register_pernet_subsys(&gtp_net_ops);
>  	if (err < 0)
>  		goto unreg_rtnl_link;
>  
> -	err = register_pernet_subsys(&gtp_net_ops);
> +	err = genl_register_family(&gtp_genl_family);
>  	if (err < 0)
> -		goto unreg_genl_family;
> +		goto unreg_pernet_subsys;
>  
>  	pr_info("GTP module loaded (pdp ctx size %zd bytes)\n",
>  		sizeof(struct pdp_ctx));
>  	return 0;
>  
> -unreg_genl_family:
> -	genl_unregister_family(&gtp_genl_family);
> +unreg_pernet_subsys:
> +	unregister_pernet_subsys(&gtp_net_ops);
>  unreg_rtnl_link:
>  	rtnl_link_unregister(&gtp_link_ops);
>  error_out:
> -- 
> 2.33.8
> 

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

* Re: [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
  2024-02-14 16:49 ` Pablo Neira Ayuso
@ 2024-02-14 17:06   ` kovalev
  2024-02-14 17:13     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 10+ messages in thread
From: kovalev @ 2024-02-14 17:06 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: linux-kernel, netdev, edumazet, laforge, davem, kuba, pabeni,
	nickel, oficerovas, dutyrok, stable

14.02.2024 19:49, Pablo Neira Ayuso wrote:
> On Wed, Feb 14, 2024 at 07:27:33PM +0300, kovalev@altlinux.org wrote:
>> From: Vasiliy Kovalev <kovalev@altlinux.org>
>>
>> The gtp_net_ops pernet operations structure for the subsystem must be
>> registered before registering the generic netlink family.
> Thanks for finding a remedy for this.
>
> If your fix is correct, (I didn't test your patch yet) then maybe this
> needs to be fixed in a few more spots in the tree?
>
> net/devlink/core.c-static int __init devlink_init(void)
> net/devlink/core.c-{
> net/devlink/core.c-     int err;
> net/devlink/core.c-
> net/devlink/core.c-     err = genl_register_family(&devlink_nl_family);
> net/devlink/core.c-     if (err)
> net/devlink/core.c-             goto out;
> net/devlink/core.c:     err = register_pernet_subsys(&devlink_pernet_ops);
> net/devlink/core.c-     if (err)
>
> net/handshake/netlink.c-        ret = genl_register_family(&handshake_nl_family);
> net/handshake/netlink.c-        if (ret) {
> net/handshake/netlink.c-                pr_warn("handshake: netlink registration failed (%d)\n", ret);
> net/handshake/netlink.c-                handshake_req_hash_destroy();
> net/handshake/netlink.c-                return ret;
> net/handshake/netlink.c-        }
> net/handshake/netlink.c-
> net/handshake/netlink.c-        /*
> net/handshake/netlink.c-         * ORDER: register_pernet_subsys must be done last.
> net/handshake/netlink.c-         *
> net/handshake/netlink.c-         *      If initialization does not make it past pernet_subsys
> net/handshake/netlink.c-         *      registration, then handshake_net_id will remain 0. That
> net/handshake/netlink.c-         *      shunts the handshake consumer API to return ENOTSUPP
> net/handshake/netlink.c-         *      to prevent it from dereferencing something that hasn't
> net/handshake/netlink.c-         *      been allocated.
> net/handshake/netlink.c-         */
> net/handshake/netlink.c:        ret = register_pernet_subsys(&handshake_genl_net_ops);
>
> net/ipv4/tcp_metrics.c: ret = register_pernet_subsys(&tcp_net_metrics_ops);
> net/ipv4/tcp_metrics.c- if (ret < 0)
> net/ipv4/tcp_metrics.c-         panic("Could not register tcp_net_metrics_ops\n");
> net/ipv4/tcp_metrics.c-
> net/ipv4/tcp_metrics.c- ret = genl_register_family(&tcp_metrics_nl_family);
> net/ipv4/tcp_metrics.c- if (ret < 0)
> net/ipv4/tcp_metrics.c-         panic("Could not register tcp_metrics generic netlink\n");
> net/ipv4/tcp_metrics.c-}
>
> net/ipv6/ioam6.c-int __init ioam6_init(void)
> net/ipv6/ioam6.c-{
> net/ipv6/ioam6.c:       int err = register_pernet_subsys(&ioam6_net_ops);
> net/ipv6/ioam6.c-       if (err)
> net/ipv6/ioam6.c-               goto out;
> net/ipv6/ioam6.c-
> net/ipv6/ioam6.c-       err = genl_register_family(&ioam6_genl_family);
> net/ipv6/ioam6.c-       if (err)
> net/ipv6/ioam6.c-               goto out_unregister_pernet_subsys;
>
> net/ipv6/seg6.c-        err = genl_register_family(&seg6_genl_family);
> net/ipv6/seg6.c-        if (err)
> net/ipv6/seg6.c-                goto out;
> net/ipv6/seg6.c-
> net/ipv6/seg6.c:        err = register_pernet_subsys(&ip6_segments_ops);
> net/ipv6/seg6.c-        if (err)
> net/ipv6/seg6.c-                goto out_unregister_genl;
>
> net/netlink/genetlink.c-        err = genl_register_family(&genl_ctrl);
> net/netlink/genetlink.c-        if (err < 0)
> net/netlink/genetlink.c-                goto problem;
> net/netlink/genetlink.c-
> net/netlink/genetlink.c:        err = register_pernet_subsys(&genl_pernet_ops);
> net/netlink/genetlink.c-        if (err)
> net/netlink/genetlink.c-                goto problem;

Most likely, judging by the backtrace, the bug is the same [1]:

Call Trace:
  <TASK>
  genl_dumpit+0x119/0x220 net/netlink/genetlink.c:1025
  netlink_dump+0x588/0xca0 net/netlink/af_netlink.c:2264
  __netlink_dump_start+0x6d0/0x9c0 net/netlink/af_netlink.c:2370
  genl_family_rcv_msg_dumpit+0x1e1/0x2d0 net/netlink/genetlink.c:1074
  genl_family_rcv_msg net/netlink/genetlink.c:1190 [inline]
  genl_rcv_msg+0x470/0x800 net/netlink/genetlink.c:1208
  netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2543
  genl_rcv+0x28/0x40 net/netlink/genetlink.c:1217
  netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
  netlink_unicast+0x53b/0x810 net/netlink/af_netlink.c:1367
  netlink_sendmsg+0x8b7/0xd70 net/netlink/af_netlink.c:1908
  sock_sendmsg_nosec net/socket.c:730 [inline]
  __sock_sendmsg+0xd5/0x180 net/socket.c:745
  ____sys_sendmsg+0x6ac/0x940 net/socket.c:2584
  ___sys_sendmsg+0x135/0x1d0 net/socket.c:2638
  __sys_sendmsg+0x117/0x1e0 net/socket.c:2667
  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
  do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83
  entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f35d567cda9

[1] https://lore.kernel.org/all/0000000000007549a6060f99544d@google.com/T/


-- 
Regards,
Vasiliy Kovalev


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

* Re: [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
  2024-02-14 17:06   ` kovalev
@ 2024-02-14 17:13     ` Pablo Neira Ayuso
  2024-02-14 17:30       ` kovalev
  0 siblings, 1 reply; 10+ messages in thread
From: Pablo Neira Ayuso @ 2024-02-14 17:13 UTC (permalink / raw)
  To: kovalev
  Cc: linux-kernel, netdev, edumazet, laforge, davem, kuba, pabeni,
	nickel, oficerovas, dutyrok, stable

On Wed, Feb 14, 2024 at 08:06:12PM +0300, kovalev@altlinux.org wrote:
> 14.02.2024 19:49, Pablo Neira Ayuso wrote:
> > On Wed, Feb 14, 2024 at 07:27:33PM +0300, kovalev@altlinux.org wrote:
> > > From: Vasiliy Kovalev <kovalev@altlinux.org>
> > > 
> > > The gtp_net_ops pernet operations structure for the subsystem must be
> > > registered before registering the generic netlink family.
> > Thanks for finding a remedy for this.
> > 
> > If your fix is correct, (I didn't test your patch yet) then maybe this
> > needs to be fixed in a few more spots in the tree?
> > 
> > net/devlink/core.c-static int __init devlink_init(void)
> > net/devlink/core.c-{
> > net/devlink/core.c-     int err;
> > net/devlink/core.c-
> > net/devlink/core.c-     err = genl_register_family(&devlink_nl_family);
> > net/devlink/core.c-     if (err)
> > net/devlink/core.c-             goto out;
> > net/devlink/core.c:     err = register_pernet_subsys(&devlink_pernet_ops);
> > net/devlink/core.c-     if (err)
> > 
> > net/handshake/netlink.c-        ret = genl_register_family(&handshake_nl_family);
> > net/handshake/netlink.c-        if (ret) {
> > net/handshake/netlink.c-                pr_warn("handshake: netlink registration failed (%d)\n", ret);
> > net/handshake/netlink.c-                handshake_req_hash_destroy();
> > net/handshake/netlink.c-                return ret;
> > net/handshake/netlink.c-        }
> > net/handshake/netlink.c-
> > net/handshake/netlink.c-        /*
> > net/handshake/netlink.c-         * ORDER: register_pernet_subsys must be done last.
> > net/handshake/netlink.c-         *
> > net/handshake/netlink.c-         *      If initialization does not make it past pernet_subsys
> > net/handshake/netlink.c-         *      registration, then handshake_net_id will remain 0. That
> > net/handshake/netlink.c-         *      shunts the handshake consumer API to return ENOTSUPP
> > net/handshake/netlink.c-         *      to prevent it from dereferencing something that hasn't
> > net/handshake/netlink.c-         *      been allocated.
> > net/handshake/netlink.c-         */
> > net/handshake/netlink.c:        ret = register_pernet_subsys(&handshake_genl_net_ops);
> > 
> > net/ipv4/tcp_metrics.c: ret = register_pernet_subsys(&tcp_net_metrics_ops);
> > net/ipv4/tcp_metrics.c- if (ret < 0)
> > net/ipv4/tcp_metrics.c-         panic("Could not register tcp_net_metrics_ops\n");
> > net/ipv4/tcp_metrics.c-
> > net/ipv4/tcp_metrics.c- ret = genl_register_family(&tcp_metrics_nl_family);
> > net/ipv4/tcp_metrics.c- if (ret < 0)
> > net/ipv4/tcp_metrics.c-         panic("Could not register tcp_metrics generic netlink\n");
> > net/ipv4/tcp_metrics.c-}
> > 
> > net/ipv6/ioam6.c-int __init ioam6_init(void)
> > net/ipv6/ioam6.c-{
> > net/ipv6/ioam6.c:       int err = register_pernet_subsys(&ioam6_net_ops);
> > net/ipv6/ioam6.c-       if (err)
> > net/ipv6/ioam6.c-               goto out;
> > net/ipv6/ioam6.c-
> > net/ipv6/ioam6.c-       err = genl_register_family(&ioam6_genl_family);
> > net/ipv6/ioam6.c-       if (err)
> > net/ipv6/ioam6.c-               goto out_unregister_pernet_subsys;
> > 
> > net/ipv6/seg6.c-        err = genl_register_family(&seg6_genl_family);
> > net/ipv6/seg6.c-        if (err)
> > net/ipv6/seg6.c-                goto out;
> > net/ipv6/seg6.c-
> > net/ipv6/seg6.c:        err = register_pernet_subsys(&ip6_segments_ops);
> > net/ipv6/seg6.c-        if (err)
> > net/ipv6/seg6.c-                goto out_unregister_genl;
> > 
> > net/netlink/genetlink.c-        err = genl_register_family(&genl_ctrl);
> > net/netlink/genetlink.c-        if (err < 0)
> > net/netlink/genetlink.c-                goto problem;
> > net/netlink/genetlink.c-
> > net/netlink/genetlink.c:        err = register_pernet_subsys(&genl_pernet_ops);
> > net/netlink/genetlink.c-        if (err)
> > net/netlink/genetlink.c-                goto problem;
> 
> Most likely, judging by the backtrace, the bug is the same [1]:
> 
> Call Trace:
>  <TASK>
>  genl_dumpit+0x119/0x220 net/netlink/genetlink.c:1025
>  netlink_dump+0x588/0xca0 net/netlink/af_netlink.c:2264
>  __netlink_dump_start+0x6d0/0x9c0 net/netlink/af_netlink.c:2370
>  genl_family_rcv_msg_dumpit+0x1e1/0x2d0 net/netlink/genetlink.c:1074
>  genl_family_rcv_msg net/netlink/genetlink.c:1190 [inline]
>  genl_rcv_msg+0x470/0x800 net/netlink/genetlink.c:1208
>  netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2543
>  genl_rcv+0x28/0x40 net/netlink/genetlink.c:1217
>  netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
>  netlink_unicast+0x53b/0x810 net/netlink/af_netlink.c:1367
>  netlink_sendmsg+0x8b7/0xd70 net/netlink/af_netlink.c:1908
>  sock_sendmsg_nosec net/socket.c:730 [inline]
>  __sock_sendmsg+0xd5/0x180 net/socket.c:745
>  ____sys_sendmsg+0x6ac/0x940 net/socket.c:2584
>  ___sys_sendmsg+0x135/0x1d0 net/socket.c:2638
>  __sys_sendmsg+0x117/0x1e0 net/socket.c:2667
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x63/0x6b
> RIP: 0033:0x7f35d567cda9

Ok, then a series of fixes probably needs to happen so each maintain
can review and apply them.

Maybe some of these subsystems above can only be compiled built-in, so
that cannot trigger.

In any case, are you up to pick on that series?

Thanks.

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

* Re: [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
  2024-02-14 17:13     ` Pablo Neira Ayuso
@ 2024-02-14 17:30       ` kovalev
  2024-02-15 17:43         ` Pablo Neira Ayuso
  0 siblings, 1 reply; 10+ messages in thread
From: kovalev @ 2024-02-14 17:30 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: linux-kernel, netdev, edumazet, laforge, davem, kuba, pabeni,
	nickel, oficerovas, dutyrok, stable

14.02.2024 20:13, Pablo Neira Ayuso wrote:
> Ok, then a series of fixes probably needs to happen so each maintain
> can review and apply them.
>
> Maybe some of these subsystems above can only be compiled built-in, so
> that cannot trigger.
>
> In any case, are you up to pick on that series?
>
> Thanks.
Yes, I can prepare several patches with the same commit message. Is it 
better to send them individually (like this patch) or in a series with a 
brief preliminary description (PATCH 0/x)?

-- 
Regards,
Vasiliy Kovalev


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

* Re: [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
  2024-02-14 17:30       ` kovalev
@ 2024-02-15 17:43         ` Pablo Neira Ayuso
  2024-02-21  0:04           ` Jakub Kicinski
  0 siblings, 1 reply; 10+ messages in thread
From: Pablo Neira Ayuso @ 2024-02-15 17:43 UTC (permalink / raw)
  To: kovalev
  Cc: linux-kernel, netdev, edumazet, laforge, davem, kuba, pabeni,
	nickel, oficerovas, dutyrok, stable

On Wed, Feb 14, 2024 at 08:30:25PM +0300, kovalev@altlinux.org wrote:
> 14.02.2024 20:13, Pablo Neira Ayuso wrote:
> > Ok, then a series of fixes probably needs to happen so each maintain
> > can review and apply them.
> > 
> > Maybe some of these subsystems above can only be compiled built-in, so
> > that cannot trigger.
> > 
> > In any case, are you up to pick on that series?
> > 
> > Thanks.
>
> Yes, I can prepare several patches with the same commit message. Is it
> better to send them individually (like this patch) or in a series with a
> brief preliminary description (PATCH 0/x)?

I'd suggest one patch for each subsystem as per MAINTAINER file, that
should also make it easier for Linux kernel -stable maintainers to
pick up this fix series.

Thanks

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

* Re: [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
  2024-02-15 17:43         ` Pablo Neira Ayuso
@ 2024-02-21  0:04           ` Jakub Kicinski
  2024-02-21 10:47             ` Pablo Neira Ayuso
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2024-02-21  0:04 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: kovalev, linux-kernel, netdev, edumazet, laforge, davem, pabeni,
	nickel, oficerovas, dutyrok, stable

On Thu, 15 Feb 2024 18:43:46 +0100 Pablo Neira Ayuso wrote:
> > Yes, I can prepare several patches with the same commit message. Is it
> > better to send them individually (like this patch) or in a series with a
> > brief preliminary description (PATCH 0/x)?  
> 
> I'd suggest one patch for each subsystem as per MAINTAINER file, that
> should also make it easier for Linux kernel -stable maintainers to
> pick up this fix series.

Pablo is anything expected to change from gtp patch itself?
Someone (DaveM?) marked this as Changes Requested but I don't see 
a clear ask, other that to follow up with patches to other families.

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

* Re: [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
  2024-02-21  0:04           ` Jakub Kicinski
@ 2024-02-21 10:47             ` Pablo Neira Ayuso
  2024-02-21 11:03               ` Pablo Neira Ayuso
  0 siblings, 1 reply; 10+ messages in thread
From: Pablo Neira Ayuso @ 2024-02-21 10:47 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: kovalev, linux-kernel, netdev, edumazet, laforge, davem, pabeni,
	nickel, oficerovas, dutyrok, stable

On Tue, Feb 20, 2024 at 04:04:34PM -0800, Jakub Kicinski wrote:
> On Thu, 15 Feb 2024 18:43:46 +0100 Pablo Neira Ayuso wrote:
> > > Yes, I can prepare several patches with the same commit message. Is it
> > > better to send them individually (like this patch) or in a series with a
> > > brief preliminary description (PATCH 0/x)?  
> > 
> > I'd suggest one patch for each subsystem as per MAINTAINER file, that
> > should also make it easier for Linux kernel -stable maintainers to
> > pick up this fix series.
> 
> Pablo is anything expected to change from gtp patch itself?
> Someone (DaveM?) marked this as Changes Requested but I don't see 
> a clear ask, other that to follow up with patches to other families.

Thanks for your follow up.

It would be good if this patch gets a Fixes: tag. I'd suggest:

Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")

Meanwhile a v3 is sent, I am going to test it so I can provide a
Testbed-by: tag for you.

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

* Re: [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
  2024-02-21 10:47             ` Pablo Neira Ayuso
@ 2024-02-21 11:03               ` Pablo Neira Ayuso
  0 siblings, 0 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2024-02-21 11:03 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: kovalev, linux-kernel, netdev, edumazet, laforge, davem, pabeni,
	nickel, oficerovas, dutyrok, stable

On Wed, Feb 21, 2024 at 11:47:12AM +0100, Pablo Neira Ayuso wrote:
> On Tue, Feb 20, 2024 at 04:04:34PM -0800, Jakub Kicinski wrote:
> > On Thu, 15 Feb 2024 18:43:46 +0100 Pablo Neira Ayuso wrote:
> >
> > Pablo is anything expected to change from gtp patch itself?
> > Someone (DaveM?) marked this as Changes Requested but I don't see 
> > a clear ask, other that to follow up with patches to other families.
> 
> Thanks for your follow up.
> 
> It would be good if this patch gets a Fixes: tag. I'd suggest:
> 
> Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
> 
> Meanwhile a v3 is sent, I am going to test it so I can provide a
> Testbed-by: tag for you.

Oh. My bad.

Patch is perfectly fine, it contains the Tested-by: tag already.

Please, apply.

Thanks.

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

* Re: [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
  2024-02-14 16:27 [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp() kovalev
  2024-02-14 16:49 ` Pablo Neira Ayuso
@ 2024-02-21 22:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-21 22:30 UTC (permalink / raw)
  To: None
  Cc: linux-kernel, netdev, edumazet, pablo, laforge, davem, kuba,
	pabeni, nickel, oficerovas, dutyrok, stable

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 14 Feb 2024 19:27:33 +0300 you wrote:
> From: Vasiliy Kovalev <kovalev@altlinux.org>
> 
> The gtp_net_ops pernet operations structure for the subsystem must be
> registered before registering the generic netlink family.
> 
> Syzkaller hit 'general protection fault in gtp_genl_dump_pdp' bug:
> 
> [...]

Here is the summary with links:
  - [ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
    https://git.kernel.org/netdev/net/c/136cfaca2256

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-02-21 22:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-14 16:27 [PATCH ver.2] gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp() kovalev
2024-02-14 16:49 ` Pablo Neira Ayuso
2024-02-14 17:06   ` kovalev
2024-02-14 17:13     ` Pablo Neira Ayuso
2024-02-14 17:30       ` kovalev
2024-02-15 17:43         ` Pablo Neira Ayuso
2024-02-21  0:04           ` Jakub Kicinski
2024-02-21 10:47             ` Pablo Neira Ayuso
2024-02-21 11:03               ` Pablo Neira Ayuso
2024-02-21 22:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).