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

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

 



On Sun, Dec 03, 2023 at 02:56:34PM -0800, Alexei Starovoitov wrote:
> On Thu, Nov 30, 2023 at 5:43 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> >
> >  void bpf_prog_kallsyms_del(struct bpf_prog *fp)
> > @@ -691,6 +708,9 @@ void bpf_prog_kallsyms_del(struct bpf_pr
> >                 return;
> >
> >         bpf_ksym_del(&fp->aux->ksym);
> > +#ifdef CONFIG_FINEIBT
> > +       bpf_ksym_del(&fp->aux->ksym_prefix);
> > +#endif
> >  }
> 
> Thank you for addressing all comments, but it panics during boot with:
> 
> [    3.109474] RIP: 0010:bpf_prog_kallsyms_del+0x10f/0x140
> [    3.109867] Code: 26 e0 00 ff 05 32 dd dd 01 48 8d bb 80 03 00 00
> 48 c7 c6 b8 b3 00 83 e8 ef 25 e0 00 48 8b 83 58 03 00 00 48 8b 8b 60
> 03 00 00 <48> 89 48 08 48 89 01 4c 89 b3 60 03 00 00 48 c7 c7 10 0b 7b
> 83 5b
> [    3.111282] RSP: 0000:ffffc90000013e08 EFLAGS: 00010246
> [    3.116968] Call Trace:
> [    3.117163]  <TASK>
> [    3.117328]  ? __die_body+0x68/0xb0
> [    3.117599]  ? page_fault_oops+0x317/0x390
> [    3.117909]  ? debug_objects_fill_pool+0x19/0x440
> [    3.118283]  ? debug_objects_fill_pool+0x19/0x440
> [    3.118715]  ? do_user_addr_fault+0x4cd/0x560
> [    3.119045]  ? exc_page_fault+0x62/0x1c0
> [    3.119350]  ? asm_exc_page_fault+0x26/0x30
> [    3.119675]  ? bpf_prog_kallsyms_del+0x10f/0x140
> [    3.120023]  ? bpf_prog_kallsyms_del+0x101/0x140
> [    3.120381]  __bpf_prog_put_noref+0x12/0xf0
> [    3.120704]  bpf_prog_put_deferred+0xe9/0x110
> [    3.121035]  bpf_prog_put+0xbb/0xd0
> [    3.121307]  bpf_prog_release+0x15/0x20
> 
> Adding the following:
> 
> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> index 5c84a935ba63..5013fd53adfd 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
> @@ -709,6 +709,8 @@ void bpf_prog_kallsyms_del(struct bpf_prog *fp)
> 
>         bpf_ksym_del(&fp->aux->ksym);
>  #ifdef CONFIG_FINEIBT
> +       if (cfi_mode != CFI_FINEIBT)
> +               return;
>         bpf_ksym_del(&fp->aux->ksym_prefix);
>  #endif
>  }
> 
> fixes the boot issue, but test_progs is not happy.

Damn, I'm an idiot :-), I knew I should've boot tested all
configurations again :/

> 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!




[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