From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Martin KaFai Lau <martin.lau@linux.dev>
Cc: syzbot <syzbot+608a2acde8c5a101d07d@syzkaller.appspotmail.com>,
netdev@vger.kernel.org, bpf@vger.kernel.org, andrii@kernel.org,
ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net,
dsahern@kernel.org, eddyz87@gmail.com, edumazet@google.com,
haoluo@google.com, john.fastabend@gmail.com, jolsa@kernel.org,
kpsingh@kernel.org, kuba@kernel.org, pabeni@redhat.com,
sdf@fomichev.me, sdf@google.com, song@kernel.org,
syzkaller-bugs@googlegroups.com, yonghong.song@linux.dev,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH bpf-next] seg6: Ensure that seg6_bpf_srh_states can only be accessed from input_action_end_bpf()
Date: Tue, 9 Jul 2024 07:18:17 +0200 [thread overview]
Message-ID: <20240709051817.VmyBTQ86@linutronix.de> (raw)
In-Reply-To: <82c77e30-6e9d-44c3-bdcd-7da17654fa81@linux.dev>
On 2024-07-08 17:03:58 [-0700], Martin KaFai Lau wrote:
> > diff --git a/net/core/filter.c b/net/core/filter.c
> > index 403d23faf22e1..ea5bc4a4a6a23 100644
> > --- a/net/core/filter.c
> > +++ b/net/core/filter.c
> > @@ -6459,6 +6459,8 @@ BPF_CALL_4(bpf_lwt_seg6_store_bytes, struct sk_buff *, skb, u32, offset,
> > void *srh_tlvs, *srh_end, *ptr;
> > int srhoff = 0;
> > + if (!bpf_net_ctx_seg6_state_avail())
> > + return -EINVAL;
>
> The syzbot stack shows that the seg6local bpf_prog can be run by test_run
> like: bpf_prog_test_run_skb() => bpf_test_run(). "return -EINVAL;" will
> reject and break the existing bpf prog doing test with test_run.
But wouldn't this be the case anyway because seg6_bpf_srh_states::srh
isn't assigned?
> bpf_test_run() has already done the local_bh_disable() and
> bpf_net_ctx_set(). How about doing the
> local_[un]lock_nested_bh(&seg6_bpf_srh_states.bh_lock) in bpf_test_run()
> when the prog->type == BPF_PROG_TYPE_LWT_SEG6LOCAL?
Okay. Sure. And I assume it is limited that only those two call paths
can invoke this type of BPF program.
Sebastian
next prev parent reply other threads:[~2024-07-09 5:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 16:51 [syzbot] [bpf?] [net?] WARNING in bpf_lwt_seg6_adjust_srh syzbot
2024-06-25 17:06 ` Sebastian Andrzej Siewior
2024-07-05 10:41 ` [PATCH bpf-next] seg6: Ensure that seg6_bpf_srh_states can only be accessed from input_action_end_bpf() Sebastian Andrzej Siewior
2024-07-09 0:03 ` Martin KaFai Lau
2024-07-09 5:18 ` Sebastian Andrzej Siewior [this message]
2024-07-09 18:24 ` Martin KaFai Lau
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=20240709051817.VmyBTQ86@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=syzbot+608a2acde8c5a101d07d@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tglx@linutronix.de \
--cc=yonghong.song@linux.dev \
/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