From: Hangbin Liu <liuhangbin@gmail.com>
To: Nikolay Aleksandrov <razor@blackwall.org>
Cc: netdev@vger.kernel.org, Taehee Yoo <ap420073@gmail.com>,
davem@davemloft.net, jv@jvosburgh.net, andy@greyhouse.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
jarod@redhat.com
Subject: Re: [PATCH net 3/4] bonding: fix xfrm real_dev null pointer dereference
Date: Mon, 19 Aug 2024 16:34:29 +0800 [thread overview]
Message-ID: <ZsMDlTY5RS4GwbCr@Laptop-X1> (raw)
In-Reply-To: <c6c965c3-dc69-4be9-8817-2146992f9359@blackwall.org>
On Mon, Aug 19, 2024 at 10:34:16AM +0300, Nikolay Aleksandrov wrote:
> On 19/08/2024 05:54, Hangbin Liu wrote:
> > On Fri, Aug 16, 2024 at 02:48:12PM +0300, Nikolay Aleksandrov wrote:
> >> We shouldn't set real_dev to NULL because packets can be in transit and
> >> xfrm might call xdo_dev_offload_ok() in parallel. All callbacks assume
> >> real_dev is set.
> >>
> >> Example trace:
> >> kernel: BUG: unable to handle page fault for address: 0000000000001030
> >> kernel: bond0: (slave eni0np1): making interface the new active one
> >> kernel: #PF: supervisor write access in kernel mode
> >> kernel: #PF: error_code(0x0002) - not-present page
> >> kernel: PGD 0 P4D 0
> >> kernel: Oops: 0002 [#1] PREEMPT SMP
> >> kernel: CPU: 4 PID: 2237 Comm: ping Not tainted 6.7.7+ #12
> >> kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-2.fc40 04/01/2014
> >> kernel: RIP: 0010:nsim_ipsec_offload_ok+0xc/0x20 [netdevsim]
> >> kernel: bond0: (slave eni0np1): bond_ipsec_add_sa_all: failed to add SA
> >
> > I saw the errors are during bond_ipsec_add_sa_all, which also
> > set ipsec->xs->xso.real_dev = NULL. Should we fix it there?
> >
> > Thanks
> > Hangbin
>
> Correct, I saw it too but I didn't remove it on purpose. I know it can lead to a
> similar error, but the fix is more complicated. I don't believe it's correct to
> set real_dev if the SA add failed, so we need to think about a different way
> to sync it. To be fair in real life it would be more difficult to hit it because
> the device must be in a state where the SA add fails, although it supports
> xfrm offload. The problem is that real_dev must be set before attempting the SA
> add in the first place.
Got it, so this time we only fix the delete path.
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
next prev parent reply other threads:[~2024-08-19 8:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 11:48 [PATCH net 0/4] bonding: fix xfrm offload bugs Nikolay Aleksandrov
2024-08-16 11:48 ` [PATCH net 1/4] bonding: fix bond_ipsec_offload_ok return type Nikolay Aleksandrov
2024-08-19 2:43 ` Hangbin Liu
2024-08-16 11:48 ` [PATCH net 2/4] bonding: fix null pointer deref in bond_ipsec_offload_ok Nikolay Aleksandrov
2024-08-19 2:45 ` Hangbin Liu
2024-08-19 2:53 ` Hangbin Liu
2024-08-19 7:25 ` Nikolay Aleksandrov
2024-08-19 8:12 ` Hangbin Liu
2024-08-19 7:26 ` Eric Dumazet
2024-08-16 11:48 ` [PATCH net 3/4] bonding: fix xfrm real_dev null pointer dereference Nikolay Aleksandrov
2024-08-19 2:54 ` Hangbin Liu
2024-08-19 7:34 ` Nikolay Aleksandrov
2024-08-19 8:25 ` Nikolay Aleksandrov
2024-08-19 8:34 ` Hangbin Liu [this message]
2024-08-16 11:48 ` [PATCH net 4/4] bonding: fix xfrm state handling when clearing active slave Nikolay Aleksandrov
2024-08-19 3:05 ` Hangbin Liu
2024-08-19 7:38 ` Nikolay Aleksandrov
2024-08-20 3:48 ` Hangbin Liu
2024-08-16 11:52 ` [PATCH net 0/4] bonding: fix xfrm offload bugs Nikolay Aleksandrov
2024-08-20 13:40 ` patchwork-bot+netdevbpf
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=ZsMDlTY5RS4GwbCr@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=andy@greyhouse.net \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jarod@redhat.com \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
/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 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).