diff options
| author | Ilya Leoshkevich <[email protected]> | 2021-10-26 01:08:26 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2021-10-26 03:39:41 +0000 |
| commit | 45f2bebc8079788f62f22d9e8b2819afb1789d7b (patch) | |
| tree | cb673afcb1620226a4947ed05c75ef34d6734356 /tools/lib/bpf/bpf_core_read.h | |
| parent | Merge branch 'libbpf: add bpf_program__insns() accessor' (diff) | |
| download | kernel-45f2bebc8079788f62f22d9e8b2819afb1789d7b.tar.gz kernel-45f2bebc8079788f62f22d9e8b2819afb1789d7b.zip | |
libbpf: Fix endianness detection in BPF_CORE_READ_BITFIELD_PROBED()
__BYTE_ORDER is supposed to be defined by a libc, and __BYTE_ORDER__ -
by a compiler. bpf_core_read.h checks __BYTE_ORDER == __LITTLE_ENDIAN,
which is true if neither are defined, leading to incorrect behavior on
big-endian hosts if libc headers are not included, which is often the
case.
Fixes: ee26dade0e3b ("libbpf: Add support for relocatable bitfields")
Signed-off-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/bpf_core_read.h')
| -rw-r--r-- | tools/lib/bpf/bpf_core_read.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/bpf_core_read.h b/tools/lib/bpf/bpf_core_read.h index 09ebe3db5f2f..e4aa9996a550 100644 --- a/tools/lib/bpf/bpf_core_read.h +++ b/tools/lib/bpf/bpf_core_read.h @@ -40,7 +40,7 @@ enum bpf_enum_value_kind { #define __CORE_RELO(src, field, info) \ __builtin_preserve_field_info((src)->field, BPF_FIELD_##info) -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define __CORE_BITFIELD_PROBE_READ(dst, src, fld) \ bpf_probe_read_kernel( \ (void *)dst, \ |
