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

iovisor / ubpf / 21407716177 / 3
78%
main: 78%

Build:
DEFAULT BRANCH: main
Ran 27 Jan 2026 05:53PM UTC
Files 66
Run time 2s
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: 74.475% (-1.3%) from 75.768%
21407716177.3

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)

3936 of 5285 relevant lines covered (74.47%)

33884.59 hits per line

Source Files on job run-Debug-ubuntu-latest-x86_64 - 21407716177.3
  • Tree
  • List 66
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 21407716177
  • 523d7bc0 on github
  • Prev Job for on main (#21406842187.3)
  • Next Job for on main (#21413988105.6)
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