Commit 2c46062
bpf: fix byte order test in test_verifier
We really must check with #if __BYTE_ORDER == XYZ instead of
just presence of #ifdef __LITTLE_ENDIAN. I noticed that when
actually running this on big endian machine, the latter test
resolves to true for user space, same for #ifdef __BIG_ENDIAN.
E.g., looking at endian.h from libc, both are also defined
there, so we really must test this against __BYTE_ORDER instead
for proper insns selection. For the kernel, such checks are
fine though e.g. see 13da9e2 ("Revert "endian: #define
__BYTE_ORDER"") and 415586c ("UAPI: fix endianness conditionals
in M32R's asm/stat.h") for some more context, but not for
user space. Lets also make sure to properly include endian.h.
After that, suite passes for me:
./test_verifier: ELF 64-bit MSB executable, [...]
Linux foo 4.13.0-rc3+ #4 SMP Fri Aug 4 06:59:30 EDT 2017 s390x s390x s390x GNU/Linux
Before fix: Summary: 505 PASSED, 11 FAILED
After fix: Summary: 516 PASSED, 0 FAILED
Fixes: 18f3d6b ("selftests/bpf: Add test cases to test narrower ctx field loads")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong <yhs@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent aaf83ae commit 2c46062
1 file changed
+10
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
1098 | 1099 | | |
1099 | 1100 | | |
1100 | 1101 | | |
1101 | | - | |
| 1102 | + | |
1102 | 1103 | | |
1103 | 1104 | | |
1104 | 1105 | | |
| |||
1135 | 1136 | | |
1136 | 1137 | | |
1137 | 1138 | | |
1138 | | - | |
| 1139 | + | |
1139 | 1140 | | |
1140 | 1141 | | |
1141 | 1142 | | |
| |||
1244 | 1245 | | |
1245 | 1246 | | |
1246 | 1247 | | |
1247 | | - | |
| 1248 | + | |
1248 | 1249 | | |
1249 | 1250 | | |
1250 | 1251 | | |
| |||
1259 | 1260 | | |
1260 | 1261 | | |
1261 | 1262 | | |
1262 | | - | |
| 1263 | + | |
1263 | 1264 | | |
1264 | 1265 | | |
1265 | 1266 | | |
| |||
5422 | 5423 | | |
5423 | 5424 | | |
5424 | 5425 | | |
5425 | | - | |
| 5426 | + | |
5426 | 5427 | | |
5427 | 5428 | | |
5428 | 5429 | | |
| |||
5438 | 5439 | | |
5439 | 5440 | | |
5440 | 5441 | | |
5441 | | - | |
| 5442 | + | |
5442 | 5443 | | |
5443 | 5444 | | |
5444 | 5445 | | |
| |||
5454 | 5455 | | |
5455 | 5456 | | |
5456 | 5457 | | |
5457 | | - | |
| 5458 | + | |
5458 | 5459 | | |
5459 | 5460 | | |
5460 | 5461 | | |
| |||
5481 | 5482 | | |
5482 | 5483 | | |
5483 | 5484 | | |
5484 | | - | |
| 5485 | + | |
5485 | 5486 | | |
5486 | 5487 | | |
5487 | 5488 | | |
| |||
5497 | 5498 | | |
5498 | 5499 | | |
5499 | 5500 | | |
5500 | | - | |
| 5501 | + | |
5501 | 5502 | | |
5502 | 5503 | | |
5503 | 5504 | | |
| |||
0 commit comments