lkml.org 
[lkml]   [2022]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v9 bpf-next 9/9] bpf, x86_64: use bpf_jit_binary_pack_alloc
On Fri, Feb 04, 2022 at 10:57:42AM -0800, Song Liu wrote:
> if (image) {
> if (!prog->is_func || extra_pass) {
> + /*
> + * bpf_jit_binary_pack_finalize fails in two scenarios:
> + * 1) header is not pointing to proper module memory;
> + * 2) the arch doesn't support bpf_arch_text_copy().
> + *
> + * Both cases are serious bugs that we should not continue.
> + */
> + BUG_ON(bpf_jit_binary_pack_finalize(prog, header, rw_header));
> bpf_tail_call_direct_fixup(prog);
> - bpf_jit_binary_lock_ro(header);

BUG_ON is discouraged.
It should only be used when the kernel absolutely cannot continue.
Here ro/rw_headers will be freed. We can WARN and goto out_addrs without drama.
Please send a follow up.

The rest looks great. Applied to bpf-next.

\
 
 \ /
  Last update: 2022-02-08 03:26    [W:0.239 / U:0.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site