syzbot
panic: runtime error: floating point error [recovered] (2)
Status:
upstream: reported syz repro on 2024/12/22 14:57
Labels:
prio:low
[Documentation on labels]
Reported-by: syzbot+4fb57f15e8c895a21973@syzkaller.appspotmail.com
First crash: 717d, last: 633d
✨ AI-generated root cause summary:
A BPF program of type BPF_PROG_TYPE_RAW_TRACEPOINT was loaded with instructions invoking the bpf_send_signal() helper with signal 8 (SIGFPE) and attached system-wide to the mm_page_alloc raw tracepoint via BPF_RAW_TRACEPOINT_OPEN. In kernel/trace/bpf_trace.c, bpf_send_signal_common() delivers the signal with SEND_SIG_PRIV (si_code = SI_KERNEL = 0x80) directly to current whenever the tracepoint fires, lacking any filtering by PID or TGID. When the userspace syzkaller runner process allocated memory while serializing a program, mm_page_alloc fired and sent SIGFPE to the runner; Go's runtime caught the signal and raised a userspace "panic: runtime error: floating point error", which syzkaller's crash monitor misidentified as a kernel panic.
▶
▼
✨ Full AI root cause analysis
Technical Root Cause Analysis
1. Involved Subsystems, Files, Functions, and Structures
2. Detailed Technical Breakdown and Trigger Mechanism
A. BPF Program Loading & Tracepoint Attachment
The reproducer loads a BPF raw tracepoint program (BPF_PROG_TYPE_RAW_TRACEPOINT) with four instructions:
BPF_LD_IMM64(r1, 8): Load immediate value 8 (SIGFPE) into register r1.
BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_send_signal): Call BPF helper function 109 (bpf_send_signal).
BPF_EXIT_INSN(): Terminate program execution.
It then attaches this BPF program via the BPF_RAW_TRACEPOINT_OPEN command (bpf_raw_tracepoint_open() in kernel/bpf/syscall.c) to the global mm_page_alloc tracepoint.
B. Signal Delivery via bpf_send_signal
In kernel/trace/bpf_trace.c:
C. Interaction with Userspace and the Syzkaller Runner Crash
- The tracepoint
mm_page_alloc is called whenever any task in any context on any CPU allocates a page.
- The BPF program contains no filtering logic (e.g., checking
bpf_get_current_pid_tgid()). Consequently, whenever any userspace process triggers a page allocation, the tracepoint fires, executing bpf_send_signal(8) and immediately delivering asynchronous SIGFPE (code=0x80) to the currently executing process.
- While the userspace Go process (
syzkaller's rpcserver.(*Runner)) was serializing a test program (Prog.Serialize -> fmt.Fprintf -> bytes.(*Buffer).grow -> bytes.growSlice), it allocated memory and faulted/allocated a page.
- This allocation triggered
mm_page_alloc, causing bpf_send_signal() to queue/send SIGFPE (code=0x80) directly to the runner thread.
- The Go runtime intercepted the
SIGFPE signal and converted it into a Go panic (runtime error: floating point error), which bytes.growSlice.func1's deferred handler recovered and re-raised as panic: bytes.Buffer: too large. Syzkaller's monitoring logic saw the userspace panic output on standard output/console and mistakenly logged it as a kernel panic report.
▶
▼
Last patch testing requests (10)
Sample crash report:
panic: runtime error: floating point error [recovered]
panic: bytes.Buffer: too large
[signal SIGFPE: floating-point exception code=0x80 addr=0x0 pc=0x474d52]
goroutine 7 [running]:
bytes.growSlice.func1()
/usr/local/go/src/bytes/buffer.go:232 +0x45
panic({0x128f240?, 0x297a930?})
/usr/local/go/src/runtime/panic.go:770 +0x132
bytes.growSlice({0xc007442800, 0x200, 0x1?}, 0x800?)
/usr/local/go/src/bytes/buffer.go:249 +0xb9
bytes.(*Buffer).grow(0xc001b1c5a0, 0x1)
/usr/local/go/src/bytes/buffer.go:151 +0x13d
bytes.(*Buffer).Write(0xc001b1c5a0, {0xc001e70800, 0x1, 0x0?})
/usr/local/go/src/bytes/buffer.go:179 +0x59
fmt.Fprintf({0x1c7d9c0, 0xc001b1c5a0}, {0x1c1a3b0, 0x1}, {0x0, 0x0, 0x0})
/usr/local/go/src/fmt/print.go:225 +0x97
github.com/google/syzkaller/prog.(*serializer).printf(...)
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:64
github.com/google/syzkaller/prog.(*PointerArg).serialize(0xc001d8a990, 0xc001b1c600)
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:142 +0x271
github.com/google/syzkaller/prog.(*serializer).arg(0x1c7d9c0?, {0x1c9c180?, 0xc001d8a990?})
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:125 +0x29
github.com/google/syzkaller/prog.(*GroupArg).serialize(0xc001d70f20, 0xc001b1c600)
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:203 +0x26d
github.com/google/syzkaller/prog.(*serializer).arg(0x1c7d9c0?, {0x1c9c240?, 0xc001d70f20?})
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:125 +0x29
github.com/google/syzkaller/prog.(*PointerArg).serialize(0xc001d8ac30, 0xc001b1c600)
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:146 +0x38e
github.com/google/syzkaller/prog.(*serializer).arg(0x1c7d9c0?, {0x1c9c180?, 0xc001d8ac30?})
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:125 +0x29
github.com/google/syzkaller/prog.(*serializer).call(0xc001b1c600, 0xc0007b6190)
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:86 +0x216
github.com/google/syzkaller/prog.(*Prog).serialize(0xc000ca7280, 0x0)
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:46 +0xd8
github.com/google/syzkaller/prog.(*Prog).Serialize(...)
/syzkaller/gopath/src/github.com/google/syzkaller/prog/encoding.go:30
github.com/google/syzkaller/pkg/rpcserver.(*Runner).handleExecutingMessage(0xc0002746c0, 0xc007431308)
/syzkaller/gopath/src/github.com/google/syzkaller/pkg/rpcserver/runner.go:371 +0x217
github.com/google/syzkaller/pkg/rpcserver.(*Runner).ConnectionLoop(0xc0002746c0)
/syzkaller/gopath/src/github.com/google/syzkaller/pkg/rpcserver/runner.go:201 +0x4b9
github.com/google/syzkaller/pkg/rpcserver.(*server).connectionLoop(0xc0016da300, 0xc0002746c0)
/syzkaller/gopath/src/github.com/google/syzkaller/pkg/rpcserver/rpcserver.go:356 +0x105
github.com/google/syzkaller/pkg/rpcserver.(*server).handleRunnerConn(0xc0016da300, 0xc0002746c0, 0xc00193e140)
/syzkaller/gopath/src/github.com/google/syzkaller/pkg/rpcserver/rpcserver.go:294 +0x411
github.com/google/syzkaller/pkg/rpcserver.(*server).handleConn(0xc0016da300, 0xc00193e140)
/syzkaller/gopath/src/github.com/google/syzkaller/pkg/rpcserver/rpcserver.go:261 +0x2b6
github.com/google/syzkaller/pkg/flatrpc.ListenAndServe.func1.1()
/syzkaller/gopath/src/github.com/google/syzkaller/pkg/flatrpc/conn.go:55 +0x122
created by github.com/google/syzkaller/pkg/flatrpc.ListenAndServe.func1 in goroutine 53
/syzkaller/gopath/src/github.com/google/syzkaller/pkg/flatrpc/conn.go:52 +0xb1
* Struck through repros no longer work on HEAD.