Showing the changes to kernel (1 of 56 files). Show all
Unified · Split
| @@ -11563,7 +11563,7 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env) · 11562 unmodified lines | ||
| 11563 | 11563 | bool isdiv = BPF_OP(insn->code) == BPF_DIV; |
| 11564 | 11564 | struct bpf_insn *patchlet; |
| 11565 | 11565 | struct bpf_insn chk_and_div[] = { |
| 11566 | − /* Rx div 0 -> 0 */ | |
| 11566 | + /* [R,W]x div 0 -> 0 */ | |
| 11567 | 11567 | BPF_RAW_INSN((is64 ? BPF_JMP : BPF_JMP32) | |
| 11568 | 11568 | BPF_JNE | BPF_K, insn->src_reg, |
| 11569 | 11569 | 0, 2, 0), |
| @@ -11572,16 +11572,18 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env) · 2 unmodified lines | ||
| 11572 | 11572 | *insn, |
| 11573 | 11573 | }; |
| 11574 | 11574 | struct bpf_insn chk_and_mod[] = { |
| 11575 | − /* Rx mod 0 -> Rx */ | |
| 11575 | + /* [R,W]x mod 0 -> [R,W]x */ | |
| 11576 | 11576 | BPF_RAW_INSN((is64 ? BPF_JMP : BPF_JMP32) | |
| 11577 | 11577 | BPF_JEQ | BPF_K, insn->src_reg, |
| 11578 | − 0, 1, 0), | |
| 11578 | + 0, 1 + (is64 ? 0 : 1), 0), | |
| 11579 | 11579 | *insn, |
| 11580 | + BPF_JMP_IMM(BPF_JA, 0, 0, 1), | |
| 11581 | + BPF_MOV32_REG(insn->dst_reg, insn->dst_reg), | |
| 11580 | 11582 | }; |
| 11581 | 11583 | |
| 11582 | 11584 | patchlet = isdiv ? chk_and_div : chk_and_mod; |
| 11583 | 11585 | cnt = isdiv ? ARRAY_SIZE(chk_and_div) : |
| 11584 | − ARRAY_SIZE(chk_and_mod); | |
| 11586 | + ARRAY_SIZE(chk_and_mod) - (is64 ? 2 : 0); | |
| 11585 | 11587 | |
| 11586 | 11588 | new_prog = bpf_patch_insn_data(env, i + delta, patchlet, cnt); |
| 11587 | 11589 | if (!new_prog) |