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 lmb@cloudflare.com --- .../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,
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 kafai@fb.com 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.
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 kafai@fb.com 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?
On 1/24/20 10:00 AM, Lorenz Bauer wrote:
On Thu, 23 Jan 2020 at 21:54, Martin Lau kafai@fb.com 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 lmb@cloudflare.com
.../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 john.fastabend@gmail.com
linux-kselftest-mirror@lists.linaro.org