Message ID | 20230912224654.6556-7-puranjay12@gmail.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | bpf: verifier: stop emitting zext for LDX | expand |
Context | Check | Description |
---|---|---|
conchuod/cover_letter | success | Series has a cover letter |
conchuod/tree_selection | success | Guessed tree name to be for-next at HEAD 0bb80ecc33a8 |
conchuod/fixes_present | success | Fixes tag not required for -next series |
conchuod/maintainers_pattern | success | MAINTAINERS pattern errors before the patch: 5 and now 5 |
conchuod/verify_signedoff | success | Signed-off-by tag matches author and committer |
conchuod/kdoc | success | Errors and warnings before: 0 this patch: 0 |
conchuod/build_rv64_clang_allmodconfig | success | Errors and warnings before: 9 this patch: 9 |
conchuod/module_param | success | Was 0 now: 0 |
conchuod/build_rv64_gcc_allmodconfig | success | Errors and warnings before: 9 this patch: 9 |
conchuod/build_rv32_defconfig | success | Build OK |
conchuod/dtb_warn_rv64 | success | Errors and warnings before: 25 this patch: 25 |
conchuod/header_inline | success | No static functions without inline keyword in header files |
conchuod/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 10 lines checked |
conchuod/build_rv64_nommu_k210_defconfig | success | Build OK |
conchuod/verify_fixes | success | No Fixes tag |
conchuod/build_rv64_nommu_virt_defconfig | success | Build OK |
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index dbba2b806017..02a1ac1a1327 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -3028,9 +3028,7 @@ static bool is_reg64(struct bpf_verifier_env *env, struct bpf_insn *insn, return false; if (class == BPF_LDX) { - if (t != SRC_OP) - return BPF_SIZE(code) == BPF_DW; - /* LDX source must be ptr. */ + /* LDX source must be a ptr. and LDX destination is always zero-extended. */ return true; }
All 64-bit JITs utilize a single instruction to load + zero-extend a byte, word, or a half-word. The optimisation of emitting zext for LDX is not useful for most of the JITs. All the JITs that relied on the verifier for zero extension of LDX desitination registers have been modified to always zero extend the destination. Now the verifier can safely mark LDX destination as 64-bit and stop emitting zero-extension instructions for it. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> --- kernel/bpf/verifier.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)