[bug report] bpf: Implement BPF exceptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Kumar Kartikeya Dwivedi,

The patch f18b03fabaa9: "bpf: Implement BPF exceptions" from Sep 13,
2023 (linux-next), leads to the following Smatch static checker
warning:

	kernel/bpf/helpers.c:2492 bpf_throw()
	error: we previously assumed 'ctx.aux' could be null (see line 2483)

kernel/bpf/helpers.c
    2482         WARN_ON_ONCE(!ctx.aux);

Warns if NULL

    2483         if (ctx.aux)
    2484                 WARN_ON_ONCE(!ctx.aux->exception_boundary);

"ctx.aux" isn't going to be NULL, right?  Why not just crash here
instead of

    2485         WARN_ON_ONCE(!ctx.bp);
    2486         WARN_ON_ONCE(!ctx.cnt);
    2487         /* Prevent KASAN false positives for CONFIG_KASAN_STACK by unpoisoning
    2488          * deeper stack depths than ctx.sp as we do not return from bpf_throw,
    2489          * which skips compiler generated instrumentation to do the same.
    2490          */
    2491         kasan_unpoison_task_stack_below((void *)(long)ctx.sp);
--> 2492         ctx.aux->bpf_exception_cb(cookie, ctx.sp, ctx.bp);
                 ^^^^^^^
waiting until this line to crash?

    2493         WARN(1, "A call to BPF exception callback should never return\n");
    2494 }

regards,
dan carpenter




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux