The reuseport tests currently suffer from a race condition: RST
packets count towards DROP_ERR_SKB_DATA, since they don't contain
a valid struct cmd. Tests will spuriously fail depending on whether
check_results is called before or after the RST is processed.
Exit the BPF program early if FIN is set.
Signed-off-by: Lorenz Bauer <[email protected]>
---
.../selftests/bpf/progs/test_select_reuseport_kern.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c b/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
index d69a1f2bbbfd..26e77dcc7e91 100644
--- a/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
@@ -113,6 +113,12 @@ int _select_by_skb_data(struct sk_reuseport_md *reuse_md)
data_check.skb_ports[0] = th->source;
data_check.skb_ports[1] = th->dest;
+ if (th->fin)
+ /* The connection is being torn down at the end of a
+ * test. It can't contain a cmd, so return early.
+ */
+ return SK_PASS;
+
if ((th->doff << 2) + sizeof(*cmd) > data_check.len)
GOTO_DONE(DROP_ERR_SKB_DATA);
if (bpf_skb_load_bytes(reuse_md, th->doff << 2, &cmd_copy,
--
2.20.1
On Thu, Jan 23, 2020 at 04:59:31PM +0000, Lorenz Bauer wrote:
> The reuseport tests currently suffer from a race condition: RST
> packets count towards DROP_ERR_SKB_DATA, since they don't contain
> a valid struct cmd. Tests will spuriously fail depending on whether
> check_results is called before or after the RST is processed.
>
> Exit the BPF program early if FIN is set.
Make sense.
Is it a RST or FIN? The earlier commit message said RST.
On Thu, 23 Jan 2020 at 17:16, Martin Lau <[email protected]> wrote:
>
> On Thu, Jan 23, 2020 at 04:59:31PM +0000, Lorenz Bauer wrote:
> > The reuseport tests currently suffer from a race condition: RST
> > packets count towards DROP_ERR_SKB_DATA, since they don't contain
> > a valid struct cmd. Tests will spuriously fail depending on whether
> > check_results is called before or after the RST is processed.
> >
> > Exit the BPF program early if FIN is set.
> Make sense.
> Is it a RST or FIN? The earlier commit message said RST.
FIN, sorry. I'll update in a follow up.
--
Lorenz Bauer | Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK
http://www.cloudflare.com
On Thu, Jan 23, 2020 at 04:59:31PM +0000, Lorenz Bauer wrote:
> The reuseport tests currently suffer from a race condition: RST
> packets count towards DROP_ERR_SKB_DATA, since they don't contain
> a valid struct cmd. Tests will spuriously fail depending on whether
> check_results is called before or after the RST is processed.
>
> Exit the BPF program early if FIN is set.
btw, it needs a Fixes tag.
Patch 4 and Patch 1 also need a Fixes tag.
On Thu, 23 Jan 2020 at 21:54, Martin Lau <[email protected]> wrote:
>
> btw, it needs a Fixes tag.
>
> Patch 4 and Patch 1 also need a Fixes tag.
This makes me wonder, should these go via bpf or bpf-next? Do I have
to split the series then?
--
Lorenz Bauer | Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK
http://www.cloudflare.com
On 1/24/20 10:00 AM, Lorenz Bauer wrote:
> On Thu, 23 Jan 2020 at 21:54, Martin Lau <[email protected]> wrote:
>>
>> btw, it needs a Fixes tag.
>>
>> Patch 4 and Patch 1 also need a Fixes tag.
>
> This makes me wonder, should these go via bpf or bpf-next? Do I have
> to split the series then?
Lets do all of these for bpf-next since timing is very close before v5.5 release.
If needed, we can later have them picked up for 5.5 stable.
Thanks,
Daniel
Lorenz Bauer wrote:
> The reuseport tests currently suffer from a race condition: RST
> packets count towards DROP_ERR_SKB_DATA, since they don't contain
> a valid struct cmd. Tests will spuriously fail depending on whether
> check_results is called before or after the RST is processed.
>
> Exit the BPF program early if FIN is set.
>
> Signed-off-by: Lorenz Bauer <[email protected]>
> ---
> .../selftests/bpf/progs/test_select_reuseport_kern.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c b/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
> index d69a1f2bbbfd..26e77dcc7e91 100644
> --- a/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
> +++ b/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
> @@ -113,6 +113,12 @@ int _select_by_skb_data(struct sk_reuseport_md *reuse_md)
> data_check.skb_ports[0] = th->source;
> data_check.skb_ports[1] = th->dest;
>
> + if (th->fin)
> + /* The connection is being torn down at the end of a
> + * test. It can't contain a cmd, so return early.
> + */
> + return SK_PASS;
> +
> if ((th->doff << 2) + sizeof(*cmd) > data_check.len)
> GOTO_DONE(DROP_ERR_SKB_DATA);
> if (bpf_skb_load_bytes(reuse_md, th->doff << 2, &cmd_copy,
> --
> 2.20.1
>
Acked-by: John Fastabend <[email protected]>