Commit 3ec2a0ed authored by Ilya Leoshkevich's avatar Ilya Leoshkevich Committed by Daniel Borkmann

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: 1f5fa9ab ("selftests/bpf: Test BPF_CGROUP_SYSCTL")
Fixes: 9a1027e5 ("selftests/bpf: Test file_pos field in bpf_sysctl ctx")
Fixes: 6041c67f ("selftests/bpf: Test bpf_sysctl_get_name helper")
Fixes: 11ff34f7 ("selftests/bpf: Test sysctl_get_current_value helper")
Fixes: 786047dd ("selftests/bpf: Test bpf_sysctl_{get,set}_new_value helpers")
Fixes: 8549ddc8 ("selftests/bpf: Test bpf_strtol and bpf_strtoul helpers")
Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 416c5728
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment