From: Woojin Ji <random6.xyz@gmail.com>
To: yonghong.song@linux.dev
Cc: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
daniel@iogearbox.net, eddyz87@gmail.com, jolsa@kernel.org,
kuba@kernel.org, linux-kernel@vger.kernel.org,
martin.lau@linux.dev, memxor@gmail.com, qmo@kernel.org,
random6.xyz@gmail.com, sdf@fomichev.me, song@kernel.org
Subject: Re: [PATCH bpf] bpftool: Use libbpf error code for flow dissector query
Date: Wed, 3 Jun 2026 09:15:12 +0900 [thread overview]
Message-ID: <20260603001512.19824-1-random6.xyz@gmail.com> (raw)
In-Reply-To: <22ab9375-e7e6-4929-a80c-0ee9cc74a907@linux.dev>
Thanks for taking a look.
Yes, the fd is opened read-only, so I do not mean to claim that close() on
/proc/self/ns/net commonly fails in normal use, or that delayed writeback
errors are expected here.
The fragile part is that the BPF_PROG_QUERY error is consumed only after an
intervening close(), even though bpf_prog_query() has already returned the
negative errno in err. If close() changes errno, the old-kernel -EINVAL
compatibility case can be missed.
I reproduced this with an LD_PRELOAD fault injector that forced
BPF_PROG_QUERY for BPF_FLOW_DISSECTOR to fail with EINVAL, and then forced
close() on the netns fd to fail with EIO. The unpatched bpftool reported:
Error: can't query prog: Input/output error
With this patch, the same injected failure is handled as the intended
non-fatal EINVAL compatibility case.
I'll send a v2 with the commit message updated to make this clearer. The code
change itself is unchanged.
next prev parent reply other threads:[~2026-06-03 0:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 17:03 Woojin Ji
2026-06-02 19:43 ` Yonghong Song
2026-06-02 19:49 ` Yonghong Song
2026-06-03 0:15 ` Woojin Ji [this message]
2026-06-03 0:33 ` [PATCH bpf v2] " Woojin Ji
2026-06-03 1:45 ` Leon Hwang
2026-06-03 3:01 ` Yonghong Song
2026-06-03 9:28 ` Quentin Monnet
2026-06-03 22: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=20260603001512.19824-1-random6.xyz@gmail.com \
--to=random6.xyz@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=jolsa@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=qmo@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--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
Powered by JetHome