• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

iovisor / ubpf / 21413988105
78%

Build:
DEFAULT BRANCH: main
Ran 27 Jan 2026 09:09PM UTC
Jobs 6
Files 165
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

27 Jan 2026 05:39PM UTC coverage: 77.302% (-0.7%) from 77.998%
21413988105

push

github

web-flow
Implement RFC 9669 signed division (sdiv) and modulo (smod) support (#714)

* Implement RFC 9669 signed division (sdiv) and modulo (smod) support

Per RFC 9669, signed div/mod is indicated by setting offset=1 on existing DIV/MOD opcodes.
This change implements:

- Interpreter: Check inst.offset == 1 for signed operations, using proper signed casts
- x86-64 JIT: Use CDQ/CQO to sign-extend dividend and IDIV instead of DIV for signed ops
- ARM64 JIT: Use SDIV instruction instead of UDIV for signed operations
- Assembler: Add sdiv, sdiv32, smod, smod32 mnemonics (emit same opcodes with offset=1)
- Disassembler: Recognize offset=1 on DIV/MOD and output sdiv/smod
- Tests: Added test files for signed operations including negative values and division by zero

Division by zero returns 0, modulo by zero returns the dividend (as per existing behavior).

Based on the work started in PR #332 by @hawkinsw.

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>

* Address review comments for sdiv/smod support

- Add offset bounds validation (0-1) in ubpf_instruction_valid.c for all
  DIV/MOD instructions to reject invalid BPF bytecode early
- Handle INT_MIN / -1 overflow case in interpreter per RFC 9669:
  sdiv returns INT_MIN, smod returns 0
- Handle INT_MIN / -1 overflow case in x86-64 JIT by checking for the
  overflow condition before IDIV and skipping it if detected
- Add test cases for INT_MIN / -1 edge cases (32-bit and 64-bit)

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>

* Add missing UINT32_MAX mask to EBPF_OP_MOD_REG for consistency

Add the masking operation reg[inst.dst] &= UINT32_MAX after the
EBPF_OP_MOD_REG case for consistency with other 32-bit ALU operations
(EBPF_OP_MOD_IMM, EBPF_OP_DIV_IMM, EBPF_OP_DIV_REG).

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>

* Add 64-bit signed division/modulo by zero test cases

Add sdiv64-by-zero.data and smod64-by-zero.data for complete test
coverage of signed division/modulo edge cases, matc... (continued)

41 of 128 new or added lines in 3 files covered. (32.03%)

6927 of 8961 relevant lines covered (77.3%)

390485.36 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
35
87.06
-2.66% vm/ubpf_jit_x86_64.c
52
78.77
-2.92% vm/ubpf_vm.c
Jobs
ID Job ID Ran Files Coverage
1 run-RelWithDebInfo-ubuntu-latest-arm64 - 21413988105.1 27 Jan 2026 09:16PM UTC 67
59.01
GitHub Action Run
2 run-Debug-ubuntu-latest-arm64 - 21413988105.2 27 Jan 2026 09:19PM UTC 67
59.0
GitHub Action Run
3 run-Debug-macos-latest-x86_64 - 21413988105.3 27 Jan 2026 09:16PM UTC 82
76.98
GitHub Action Run
4 run-Debug-ubuntu-latest-x86_64 - 21413988105.4 27 Jan 2026 09:18PM UTC 66
74.47
GitHub Action Run
5 run-RelWithDebInfo-macos-latest-x86_64 - 21413988105.5 27 Jan 2026 09:09PM UTC 82
76.84
GitHub Action Run
6 run-RelWithDebInfo-ubuntu-latest-x86_64 - 21413988105.6 27 Jan 2026 09:28PM UTC 66
74.45
GitHub Action Run
Source Files on build 21413988105
  • Tree
  • List 165
  • Changed 4
  • Source Changed 4
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #21413988105
  • 523d7bc0 on github
  • Prev Build on main (#21406842187)
  • Next Build on main (#21415157440)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc