From: Jakub Sitnicki <jakub@cloudflare•com>
To: Cong Wang <xiyou.wangcong@gmail•com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail•com>,
John Fastabend <john.fastabend@gmail•com>,
Linux Kernel Network Developers <netdev@vger•kernel.org>,
bpf <bpf@vger•kernel.org>, Cong Wang <cong.wang@bytedance•com>,
Jiang Wang <jiang.wang@bytedance•com>,
Daniel Borkmann <daniel@iogearbox•net>,
Lorenz Bauer <lmb@cloudflare•com>
Subject: Re: [Patch bpf] selftests/bpf: Retry for EAGAIN in udp_redir_to_connected()
Date: Thu, 03 Jun 2021 10:10:20 +0200 [thread overview]
Message-ID: <87a6o774ib.fsf@cloudflare.com> (raw)
In-Reply-To: <CAM_iQpVAhOOP_PRsvL37J1WwOxHKmLEnRXVBYag1nNccHN7PYw@mail.gmail.com>
On Thu, May 20, 2021 at 10:44 PM CEST, Cong Wang wrote:
> On Thu, May 20, 2021 at 1:14 PM Andrii Nakryiko
> <andrii.nakryiko@gmail•com> wrote:
>>
>> Bugs do happen though, so if you can detect some error condition
>> instead of having an infinite loop, then do it.
>
> You both are underestimating the problem. There are two different things
> to consider here:
>
> 1) Kernel bugs: This is known unknown, we certainly do not know
> how many bugs we have, otherwise they would have been fixed
> already. So we can not predict the consequence of the bug either,
> assuming a bug could only cause packet drop is underestimated.
>
> 2) Configurations: For instance, firewall rules. If the selftests are run
> in a weird firewall setup which drops all UDP packets, there is nothing
> we can do in the test itself. If we have to detect this, then we would
> have to detect netem cases too where packets can be held indefinitely
> or reordered arbitrarily. The possibilities here are too many to detect,
> hence I argue the selftests should setup its own non-hostile environment,
> which has nothing to do with any specific program.
>
> This is why I ask you to draw a boundary: what we can assume and
> what we can't. My boundary is obviously clear: we just assume the
> environment is non-hostile and we can't predict any kernel bugs,
> nor their consequences.
>
> Thanks.
(Sorry for the delay in reviews. I've been out.)
In my mind uAPI tests should not be tailored to the underlying
implementation (non-blocking read after write over loopback succeeds for
TCP), or the environment they run in (packets don't get dropped due to
OOM, signals don't interrupt syscalls).
If it's a non-blocking socket, then EAGAIN can happen. That's the
contract between the kernel and the user-space.
There is already a helper in this test case for polling and reading with
a timeout (see recv_timeout()). IMO we should be using it in all tests
that use non-blocking I/O.
If it's not being used already, that is most likely my fault.
prev parent reply other threads:[~2021-06-03 8:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 20:41 [Patch bpf] selftests/bpf: Retry for EAGAIN in udp_redir_to_connected() Cong Wang
2021-05-19 21:55 ` John Fastabend
2021-05-19 23:36 ` Cong Wang
2021-05-20 17:47 ` John Fastabend
2021-05-20 20:00 ` Cong Wang
2021-05-22 0:12 ` Andrii Nakryiko
2021-05-20 20:14 ` Andrii Nakryiko
2021-05-20 20:44 ` Cong Wang
2021-05-21 5:12 ` Andrii Nakryiko
2021-05-21 21:49 ` Cong Wang
2021-06-03 8:10 ` Jakub Sitnicki [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=87a6o774ib.fsf@cloudflare.com \
--to=jakub@cloudflare$(echo .)com \
--cc=andrii.nakryiko@gmail$(echo .)com \
--cc=bpf@vger$(echo .)kernel.org \
--cc=cong.wang@bytedance$(echo .)com \
--cc=daniel@iogearbox$(echo .)net \
--cc=jiang.wang@bytedance$(echo .)com \
--cc=john.fastabend@gmail$(echo .)com \
--cc=lmb@cloudflare$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=xiyou.wangcong@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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