All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <pabeni@redhat.com>
Cc: <davem@davemloft.net>, <dsahern@kernel.org>,
	<edumazet@google.com>, <horms@kernel.org>, <kuba@kernel.org>,
	<kuni1840@gmail.com>, <kuniyu@amazon.com>,
	<netdev@vger.kernel.org>
Subject: Re: [PATCH v1 net-next 0/7] nexthop: Convert RTM_{NEW,DEL}NEXTHOP to per-netns RTNL.
Date: Wed, 19 Mar 2025 08:57:46 -0700	[thread overview]
Message-ID: <20250319155904.6616-1-kuniyu@amazon.com> (raw)
In-Reply-To: <70ca4d5c-90c3-4a96-b47b-fbf5034c7450@redhat.com>

From: Paolo Abeni <pabeni@redhat.com>
Date: Wed, 19 Mar 2025 08:57:52 +0100
> Hi,
> 
> On 3/19/25 12:31 AM, Kuniyuki Iwashima wrote:
> > Patch 1 - 5 move some validation for RTM_NEWNEXTHOP so that it can be
> > done without RTNL.
> > 
> > Patch 6 & 7 converts RTM_NEWNEXTHOP and RTM_DELNEXTHOP to per-netns RTNL.
> > 
> > Note that RTM_GETNEXTHOP and RTM_GETNEXTHOPBUCKET are not touched in
> > this series.
> > 
> > rtm_get_nexthop() can be easily converted to RCU, but rtm_dump_nexthop()
> > needs more work due to the left-to-right rbtree walk, which looks prone
> > to node deletion and tree rotation without a retry mechanism.
> > 
> > 
> > Kuniyuki Iwashima (7):
> >   nexthop: Move nlmsg_parse() in rtm_to_nh_config() to
> >     rtm_new_nexthop().
> >   nexthop: Split nh_check_attr_group().
> >   nexthop: Move NHA_OIF validation to rtm_to_nh_config_rtnl().
> >   nexthop: Check NLM_F_REPLACE and NHA_ID in rtm_new_nexthop().
> >   nexthop: Remove redundant group len check in nexthop_create_group().
> >   nexthop: Convert RTM_NEWNEXTHOP to per-netns RTNL.
> >   nexthop: Convert RTM_DELNEXTHOP to per-netns RTNL.
> > 
> >  net/ipv4/nexthop.c | 183 +++++++++++++++++++++++++++------------------
> >  1 file changed, 112 insertions(+), 71 deletions(-)
> 
> This series is apparently causing NULL ptr deref in the nexthop.sh
> netdevsim selftests. Unfortunately, due to a transient nipa infra
> outage, a lot of stuff landed into the same batch, so I'm not 110% this
> series is the real curprit but looks like a reasonable suspect.
> 
> Kuniyuki, could you please have a look?
> 
> ---
> [    1.653896] BUG: kernel NULL pointer dereference, address:
> 0000000000000068
> [    1.653963] #PF: supervisor read access in kernel mode
> [    1.654003] #PF: error_code(0x0000) - not-present page
> [    1.654037] PGD 7828067 P4D 7828067 PUD 782a067 PMD 0
> [    1.654077] Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI
> [    1.654119] CPU: 0 UID: 0 PID: 303 Comm: ip Not tainted
> 6.14.0-rc6-virtme #1
> [    1.654176] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> [    1.654219] RIP: 0010:rtm_new_nexthop+0x645/0x2260

Sorry, I failed to resolve conflict during the last minute rebase,
and the normal test bailed out here...

---8<---
@@ -3245,7 +3248,7 @@ static int rtm_new_nexthop(struct sk_buff *skb, struct nlmsghdr *nlh,
 		goto out;
 
 	err = rtm_to_nh_config_rtnl(net, tb, extack);
-	if (!err)
+	if (err)
 		goto out;
 
 	nh = nexthop_add(net, &cfg, extack);
---8<---

The failed test case created a nexthop group with an invalid ID,
and nexthop_get() for nh by nexthop_find_by_id() assumes nh is not
NULL because it's checked in advance.

Will squash the diff above in v2.

Thanks!

      reply	other threads:[~2025-03-19 15:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 23:31 [PATCH v1 net-next 0/7] nexthop: Convert RTM_{NEW,DEL}NEXTHOP to per-netns RTNL Kuniyuki Iwashima
2025-03-18 23:31 ` [PATCH v1 net-next 1/7] nexthop: Move nlmsg_parse() in rtm_to_nh_config() to rtm_new_nexthop() Kuniyuki Iwashima
2025-03-18 23:31 ` [PATCH v1 net-next 2/7] nexthop: Split nh_check_attr_group() Kuniyuki Iwashima
2025-03-18 23:31 ` [PATCH v1 net-next 3/7] nexthop: Move NHA_OIF validation to rtm_to_nh_config_rtnl() Kuniyuki Iwashima
2025-03-18 23:31 ` [PATCH v1 net-next 4/7] nexthop: Check NLM_F_REPLACE and NHA_ID in rtm_new_nexthop() Kuniyuki Iwashima
2025-03-18 23:31 ` [PATCH v1 net-next 5/7] nexthop: Remove redundant group len check in nexthop_create_group() Kuniyuki Iwashima
2025-03-18 23:31 ` [PATCH v1 net-next 6/7] nexthop: Convert RTM_NEWNEXTHOP to per-netns RTNL Kuniyuki Iwashima
2025-03-18 23:31 ` [PATCH v1 net-next 7/7] nexthop: Convert RTM_DELNEXTHOP " Kuniyuki Iwashima
2025-03-19  7:57 ` [PATCH v1 net-next 0/7] nexthop: Convert RTM_{NEW,DEL}NEXTHOP " Paolo Abeni
2025-03-19 15:57   ` Kuniyuki Iwashima [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=20250319155904.6616-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --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.