mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-10-14 05:55:17 +00:00
selftests/bpf: fix endianness issues in test_sysctl
A lot of test_sysctl sub-tests fail due to handling strings as a bunch of immediate values in a little-endian-specific manner. Fix by wrapping all immediates in bpf_ntohl and the new bpf_be64_to_cpu. fixup_sysctl_value() dynamically writes an immediate, and thus should be endianness-aware. Implement this by simply memcpy()ing the raw user-provided value, since testcase endianness and bpf program endianness match. Fixes:1f5fa9ab6e("selftests/bpf: Test BPF_CGROUP_SYSCTL") Fixes:9a1027e525("selftests/bpf: Test file_pos field in bpf_sysctl ctx") Fixes:6041c67f28("selftests/bpf: Test bpf_sysctl_get_name helper") Fixes:11ff34f74e("selftests/bpf: Test sysctl_get_current_value helper") Fixes:786047dd08("selftests/bpf: Test bpf_sysctl_{get,set}_new_value helpers") Fixes:8549ddc832("selftests/bpf: Test bpf_strtol and bpf_strtoul helpers") Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
416c572821
commit
3ec2a0ed3f
1 changed files with 82 additions and 43 deletions
Loading…
Add table
Add a link
Reference in a new issue