All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Johnston <matt@codeconstruct.com.au>
To: Alexandre Ghiti <alex@ghiti.fr>,
	Jeremy Kerr <jk@codeconstruct.com.au>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next 7/7] net: mctp: Add bind lookup test
Date: Tue, 12 Aug 2025 13:11:31 +0800	[thread overview]
Message-ID: <e7cbbdbc939b7e1fe1e27981c01aca49c022cdb7.camel@codeconstruct.com.au> (raw)
In-Reply-To: <734b02a3-1941-49df-a0da-ec14310d41e4@ghiti.fr>

Hi Alexandre,

Thanks for the report.

On Mon, 2025-08-11 at 13:35 +0200, Alexandre Ghiti wrote:

> I'm hitting different issues with this test.
> 
> With a simple riscv defconfig, I get the following warning a bit after 
> the test succeeds:
> 
> [    5.991567] WARNING: CPU: 1 PID: 0 at net/netlink/af_netlink.c:402 
> netlink_sock_destruct+0x3a/0x6a
> [    5.992039] Modules linked in:

I can reproduce it with the um kunit runner if I enable kasan. The skb_pkt
shouldn't be freed, I've submitted a fix for that.

Cheers,
Matt

> [    5.992384] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Tainted: 
> G                 N  6.17.0-rc1-00005-g1692753ec9e8-dirty #40 NONE
> [    5.992502] Tainted: [N]=TEST
> [    5.992521] Hardware name: riscv-virtio,qemu (DT)
> [    5.992604] epc : netlink_sock_destruct+0x3a/0x6a
> [    5.992643]  ra : netlink_sock_destruct+0x18/0x6a
> [    5.992669] epc : ffffffff809bdf26 ra : ffffffff809bdf04 sp : 
> ff2000000000bd90
> [    5.992685]  gp : ffffffff81a1b458 tp : ff600000802ce000 t0 : 
> 0000000000000040
> [    5.992700]  t1 : 0000000000000000 t2 : 0000000080150012 s0 : 
> ff2000000000bdb0
> [    5.992715]  s1 : ff600000825a0800 a0 : ff600000825a08a8 a1 : 
> 0000000000000068
> [    5.992729]  a2 : 0000000000000008 a3 : 000000000000000a a4 : 
> 0000000000000000
> [    5.992743]  a5 : ffffffffffffce00 a6 : ffffffffffffffff a7 : 
> ffffffff81a20810
> [    5.992757]  s2 : ff600000825a0800 s3 : ffffffff81a7c040 s4 : 
> ff2000000000be60
> [    5.992770]  s5 : 0000000000000000 s6 : 000000000000000a s7 : 
> 0000000000000000
> [    5.992784]  s8 : ff600003fff1e580 s9 : 0000000000000001 s10: 
> ffffffff81890a80
> [    5.992798]  s11: ff600000825a0c28 t3 : 0000000000000002 t4 : 
> 0000000000000402
> [    5.992811]  t5 : ff60000080069168 t6 : ff60000080069170
> [    5.992824] status: 0000000200000120 badaddr: ffffffff809bdf26 cause: 
> 0000000000000003
> [    5.992925] [<ffffffff809bdf26>] netlink_sock_destruct+0x3a/0x6a
> [    5.993015] [<ffffffff809369b8>] __sk_destruct+0x22/0x1aa
> [    5.993034] [<ffffffff809385b0>] sk_destruct+0x46/0x50
> [    5.993049] [<ffffffff8093860a>] __sk_free+0x50/0xc6
> [    5.993062] [<ffffffff809386aa>] sk_free+0x2a/0x46
> [    5.993077] [<ffffffff809bdb08>] deferred_put_nlk_sk+0x42/0x62
> [    5.993089] [<ffffffff800a5b80>] rcu_core+0x1ba/0x5c8
> [    5.993106] [<ffffffff800a5f9a>] rcu_core_si+0xc/0x14
> [    5.993119] [<ffffffff8002d8de>] handle_softirqs+0x110/0x2e8
> [    5.993133] [<ffffffff8002dbd2>] __irq_exit_rcu+0xd0/0xfa
> [    5.993144] [<ffffffff8002ddbe>] irq_exit_rcu+0xc/0x14
> [    5.993156] [<ffffffff80b438e0>] handle_riscv_irq+0x64/0x74
> [    5.993177] [<ffffffff80b4f88a>] call_on_irq_stack+0x32/0x40
> 
> The following diff fixes it (completely unsure this is the right fix 
> though):
> 
> diff --git a/net/mctp/test/route-test.c b/net/mctp/test/route-test.c
> index fb6b46a952cb4..03f2f76c97f75 100644
> --- a/net/mctp/test/route-test.c
> +++ b/net/mctp/test/route-test.c
> @@ -1585,7 +1585,6 @@ static void mctp_test_bind_lookup(struct kunit *test)
>          }
> 
>   cleanup:
> -       kfree_skb(skb_sock);
>          kfree_skb(skb_pkt);
> 
>          /* Drop all binds */
> 
> 
> But then with a more consequent config attached, even with the previous 
> fix, I'm hitting:
> 
> [  137.494285] kernel BUG at mm/slub.c:563!
> [  137.494365] Kernel BUG [#2]
> [  137.494388] Modules linked in:
> [  137.494449] CPU: 4 UID: 0 PID: 4699 Comm: kunit_try_catch Tainted: 
> G      D W        N  6.17.0-rc1+ #16 PREEMPT(voluntary)
> [  137.494500] Tainted: [D]=DIE, [W]=WARN, [N]=TEST
> [  137.494514] Hardware name: riscv-virtio,qemu (DT)
> [  137.494534] epc : kmem_cache_free+0x334/0x39e
> [  137.494588]  ra : kmem_cache_free+0x76/0x39e
> [  137.494617] epc : ffffffff802e8ec4 ra : ffffffff802e8c06 sp : 
> ff2000000b6cbb60
> [  137.494637]  gp : ffffffff82ac7b70 tp : ff60000087cc1f00 t0 : 
> ff60000087ba6820
> [  137.494657]  t1 : 0000000000000000 t2 : 0000000000000000 s0 : 
> ff2000000b6cbbb0
> [  137.494676]  s1 : ffffffff80c34db8 a0 : ff1c0000021ee900 a1 : 
> ff60000087ba6680
> [  137.494695]  a2 : ff60000087ba6680 a3 : ffffffff82e4a858 a4 : 
> ff600003fff21d80
> [  137.494715]  a5 : ff60000087ba67e0 a6 : 000000000002dc04 a7 : 
> 0000000000000000
> [  137.494733]  s2 : ff60000087ba6680 s3 : ff600000802cc900 s4 : 
> ff1c0000021ee900
> [  137.494754]  s5 : 0000000000000002 s6 : ff600000833d9b00 s7 : 
> ff60000087b55a80
> [  137.494772]  s8 : 0000000000000000 s9 : ff2000000b6cbd18 s10: 
> ffffffff81e29a90
> [  137.494791]  s11: 000000000000060e t3 : 0000000000000000 t4 : 
> 0000000000000000
> [  137.494810]  t5 : 0000000000000000 t6 : ff60000087ba6685
> [  137.494826] status: 0000000200000120 badaddr: ffffffff802e8ec4 cause: 
> 0000000000000003
> [  137.494849] [<ffffffff802e8ec4>] kmem_cache_free+0x334/0x39e
> [  137.494883] [<ffffffff80c34db8>] skb_free_head+0xca/0x112
> [  137.494922] [<ffffffff80c37bba>] skb_release_data+0xe2/0x112
> [  137.494952] [<ffffffff80c3a202>] sk_skb_reason_drop+0x40/0x124
> [  137.494984] [<ffffffff80e57afe>] mctp_test_bind_lookup+0x15e/0x3f4
> [  137.495019] [<ffffffff80623454>] kunit_try_run_case+0x4c/0x13e
> [  137.495051] [<ffffffff80625a10>] 
> kunit_generic_run_threadfn_adapter+0x1a/0x34
> [  137.495080] [<ffffffff80064a9c>] kthread+0xea/0x1c2
> [  137.495111] [<ffffffff8001b42e>] ret_from_fork_kernel+0x10/0x162
> [  137.495139] [<ffffffff80e9d192>] ret_from_fork_kernel_asm+0x16/0x18
> [  137.495199] Code: 80a3 00e7 5097 ffd5 80e7 9880 9002 b715 ec56 e85a 
> (9002) 9b61
> [  137.495760] ---[ end trace 0000000000000000 ]---
> 
> Let me know if I can do anything to help.
> 
> Thanks,
> 
> Alex


      reply	other threads:[~2025-08-12  5:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03  9:11 [PATCH net-next 0/7] net: mctp: Improved bind handling Matt Johnston
2025-07-03  9:11 ` [PATCH net-next 1/7] net: mctp: Prevent duplicate binds Matt Johnston
2025-07-03  9:11 ` [PATCH net-next 2/7] net: mctp: Treat MCTP_NET_ANY specially in bind() Matt Johnston
2025-07-03  9:11 ` [PATCH net-next 3/7] net: mctp: Add test for conflicting bind()s Matt Johnston
2025-07-04 11:55   ` kernel test robot
2025-07-03  9:11 ` [PATCH net-next 4/7] net: mctp: Use hashtable for binds Matt Johnston
2025-07-03  9:11 ` [PATCH net-next 5/7] net: mctp: Allow limiting binds to a peer address Matt Johnston
2025-07-14 19:16   ` Dan Carpenter
2025-07-15  1:13     ` Matt Johnston
2025-07-03  9:11 ` [PATCH net-next 6/7] net: mctp: Test conflicts of connect() with bind() Matt Johnston
2025-07-04 11:01   ` kernel test robot
2025-07-03  9:11 ` [PATCH net-next 7/7] net: mctp: Add bind lookup test Matt Johnston
2025-08-11 11:35   ` Alexandre Ghiti
2025-08-12  5:11     ` Matt Johnston [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7cbbdbc939b7e1fe1e27981c01aca49c022cdb7.camel@codeconstruct.com.au \
    --to=matt@codeconstruct.com.au \
    --cc=alex@ghiti.fr \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jk@codeconstruct.com.au \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.