Re: [PATCH v2 2/2] x86/cfi,bpf: Fix BPF JIT call

Peter Zijlstra
2023-12-04T11:11:52Z

On Mon, Dec 04, 2023 at 10:13:34AM +0100, Peter Zijlstra wrote:

> > Just running test_progs it splats right away:
> >
> > [ 74.047757] kmemleak: Found object by alias at 0xffffffffa0001d80
> > [ 74.048272] CPU: 14 PID: 104 Comm: kworker/14:0 Tainted: G W
> > O 6.7.0-rc3-00702-g41c30fec304d-dirty #5241
> > [ 74.049118] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
> > BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
> > [ 74.050042] Workqueue: events bpf_prog_free_deferred
> > [ 74.050448] Call Trace:
> > [ 74.050663] <TASK>
> > [ 74.050841] dump_stack_lvl+0x55/0x80
> > [ 74.051141] __find_and_remove_object+0xdb/0x110
> > [ 74.051521] kmemleak_free+0x41/0x70
> > [ 74.051828] vfree+0x36/0x130
>
> Durr, I'll see if I can get that stuff running locally, and otherwise
> play with the robot as you suggested. Thanks!

I think it is bpf_jit_binary_pack_hdr(), which is using prog->bpf_func
as a start address for the image, instead of jit_data->image.

This used to be true, but now it's offset.

Let me see what to do about that...