diff options
| author | 2018-11-10 22:29:59 -0800 | |
|---|---|---|
| committer | 2018-11-10 22:30:00 -0800 | |
| commit | 407be8d03e20d70d15cd8c21591202a591e3c2b2 (patch) | |
| tree | 909ae9f0eb94d01c31e640c7a4a95f7ff400d959 /include | |
| parent | Merge branch 'bpftool-flow-dissector' (diff) | |
| parent | selftests/bpf: Test narrow loads with off > 0 for bpf_sock_addr (diff) | |
Merge branch 'narrow-loads'
Andrey Ignatov says:
====================
This patch set adds support for narrow loads with offset > 0 to BPF
verifier.
Patch 1 provides more details and is the main patch in the set.
Patches 2 and 3 add new test cases to test_verifier and test_sock_addr
selftests.
v1->v2:
- fix -Wdeclaration-after-statement warning.
====================
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/filter.h | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index de629b706d1d..cc17f5f32fbb 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -668,24 +668,10 @@ static inline u32 bpf_ctx_off_adjust_machine(u32 size) return size; } -static inline bool bpf_ctx_narrow_align_ok(u32 off, u32 size_access, - u32 size_default) -{ - size_default = bpf_ctx_off_adjust_machine(size_default); - size_access = bpf_ctx_off_adjust_machine(size_access); - -#ifdef __LITTLE_ENDIAN - return (off & (size_default - 1)) == 0; -#else - return (off & (size_default - 1)) + size_access == size_default; -#endif -} - static inline bool bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default) { - return bpf_ctx_narrow_align_ok(off, size, size_default) && - size <= size_default && (size & (size - 1)) == 0; + return size <= size_default && (size & (size - 1)) == 0; } #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) |
