Repository navigation
samples/bpf: Update README.rst for manually compiling LLVM and clang - #650
Closed
kernel-patches-bot wants to merge 2 commits into
Closed
kernel-patches-bot wants to merge 2 commits into
kernel-patches-bot wants to merge 2 commits into
Conversation
In the current samples/bpf/README.rst, the url of llvm and clang git may be out of date, they are unable to access: $ git clone http://llvm.org/git/llvm.git Cloning into 'llvm'... fatal: unable to access 'http://llvm.org/git/llvm.git/': Maximum (20) redirects followed $ git clone --depth 1 http://llvm.org/git/clang.git Cloning into 'clang'... fatal: unable to access 'http://llvm.org/git/clang.git/': Maximum (20) redirects followed The Clang Getting Started page [1] might have more accurate information, I verified the procedure and it is proved to be feasible, so we should update it to reflect the reality. [1] https://clang.llvm.org/get_started.html Signed-off-by: Tiezhu Yang <[email protected]>
Author
|
Master branch: e23a8d0 |
Author
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=416589 expired. Closing PR. |
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 13, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 14, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 14, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 14, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 19, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 19, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 19, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 20, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 21, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 24, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 24, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 25, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 26, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 26, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 26, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
kernel-patches-daemon-bpf Bot
pushed a commit
that referenced
this pull request
Nov 27, 2026
RFC9669 defines SDIV and SMOD, encoded as DIV and MOD with an offset of
1, as signed division and modulo, which the interpreter implements. The
i386 JIT ignores the offset and emits an unsigned div for both, so for
ALU32 -1 s/ 2 returns 0x7fffffff instead of 0. A verifier-accepted
program can therefore use values outside the range proved by the
verifier.
Emit cdq and idiv when the offset is 1. The verifier has rejected or
patched out a zero divisor and INT_MIN s/ -1 before the JIT runs, so
idiv cannot trap. ALU64 DIV and MOD are still left to the interpreter.
On an unpatched i386 kernel, an SDIV and an SMOD test program each
passed a helper a length beyond the verifier's bound. Both stayed
within it after this change.
Found by manually comparing the signed DIV/MOD handling of the BPF
JITs.
On i386 under qemu, with test_progs built as a 32-bit binary from the
same tree:
# ./test_progs -t verifier_movsx,verifier_sdiv,jit_insns \
-d jit_insns_blinded,'verifier_movsx/*@unpriv' -w 600
[...]
#191/3 jit_insns/alu_imm:OK
#191/4 jit_insns/alu_reg:OK
#191/5 jit_insns/alu_imm_regs:OK
#191/6 jit_insns/div_const:OK
#191/7 jit_insns/alu_reg_pairs:OK
#191/8 jit_insns/alu_edges:OK
[...]
#650 verifier_sdiv:OK (SKIP: 16/144)
Summary: 1/167 PASSED, 16 SKIPPED, 2/11 FAILED
# ./test_progs -t jit_insns_blinded -w 600
[...]
#192 jit_insns_blinded:OK
Summary: 1/14 PASSED, 0 SKIPPED, 0/0 FAILED
Without this change, the six jit_insns subtests above, four of
jit_insns_blinded and 50 of verifier_sdiv fail. The 11 failures left
are the five MOVSX ones fixed by the next patch and six jit_insns
subtests that fail without the series as well.
Fixes: ec0e2da ("bpf: Support new signed div/mod instructions.")
Signed-off-by: Nicholas Dudar <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: samples/bpf: Update README.rst for manually compiling LLVM and clang
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=416589