Skip to content

selftests/bpf: filter by pid to avoid cross-test interference#11311

Open
kernel-patches-daemon-bpf[bot] wants to merge 2 commits intobpf-next_basefrom
series/1062423=>bpf-next
Open

selftests/bpf: filter by pid to avoid cross-test interference#11311
kernel-patches-daemon-bpf[bot] wants to merge 2 commits intobpf-next_basefrom
series/1062423=>bpf-next

Conversation

@kernel-patches-daemon-bpf
Copy link

Pull request for series with
subject: selftests/bpf: filter by pid to avoid cross-test interference
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062423

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 6dd780f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062423
version: 3

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 6dd780f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062423
version: 3

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 099bded
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062423
version: 3

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: bd2e02e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062423
version: 3

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: bd2e02e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062423
version: 3

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 0c55d48
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062423
version: 3

The test installs a kprobe on __sys_connect and checks that
bpf_probe_write_user() can modify the syscall argument. However, any
concurrent thread in any other test that calls connect() will also
trigger the kprobe and have its sockaddr silently overwritten, causing
flaky failures in unrelated tests.

Constrain the hook to the current test process by filtering on a PID
stored as a global variable in .bss. Initialize the .bss value from
user space before bpf_object__load() using bpf_map__set_initial_value(),
and validate the bss map value size to catch layout mismatches.

No new map is introduced and the test keeps the existing non-skeleton
flow.

Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: e95e85b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062423
version: 3

Patch 1/2 added PID filtering to the probe_user BPF program to avoid
cross-test interference from the global connect() hooks.

With the interference removed, drop the serial_ prefix and remove the
stale TODO comment so the test can run in parallel.

Tested:
  ./test_progs -t probe_user -v
  ./test_progs -j$(nproc) -t probe_user

Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant