diff mbox series

[RFC,v4,25/37] arm64: bpf: Skip validation of ___bpf_prog_run

Message ID 20220429094355.122389-26-chenzhongjin@huawei.com (mailing list archive)
State New, archived
Headers show
Series objtool: add base support for arm64 | expand

Commit Message

Chen Zhongjin April 29, 2022, 9:43 a.m. UTC
There is a jump table encoded in ___bpf_prog_run and objtool-arm64
can't deal with it now. Skip validate it for arm64.

Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
---
 kernel/bpf/core.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Peter Zijlstra April 29, 2022, 11:13 a.m. UTC | #1
On Fri, Apr 29, 2022 at 05:43:43PM +0800, Chen Zhongjin wrote:
> There is a jump table encoded in ___bpf_prog_run and objtool-arm64
> can't deal with it now. Skip validate it for arm64.

But, but, but, an earlier patch did -fno-jump-tables!

> 
> Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
> ---
>  kernel/bpf/core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> index 13e9dbeeedf3..d702f1d83176 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
> @@ -2022,6 +2022,9 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn)
>  		BUG_ON(1);
>  		return 0;
>  }
> +#ifdef CONFIG_ARM64
> +STACK_FRAME_NON_STANDARD(___bpf_prog_run);
> +#endif
>  
>  #define PROG_NAME(stack_size) __bpf_prog_run##stack_size
>  #define DEFINE_BPF_PROG_RUN(stack_size) \
> -- 
> 2.17.1
>
Josh Poimboeuf April 29, 2022, 8:09 p.m. UTC | #2
On Fri, Apr 29, 2022 at 01:13:40PM +0200, Peter Zijlstra wrote:
> On Fri, Apr 29, 2022 at 05:43:43PM +0800, Chen Zhongjin wrote:
> > There is a jump table encoded in ___bpf_prog_run and objtool-arm64
> > can't deal with it now. Skip validate it for arm64.
> 
> But, but, but, an earlier patch did -fno-jump-tables!

IIRC, -fno-jump-tables is specific to switch statements but this
function has a C-implemented jump table.
diff mbox series

Patch

diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 13e9dbeeedf3..d702f1d83176 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -2022,6 +2022,9 @@  static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn)
 		BUG_ON(1);
 		return 0;
 }
+#ifdef CONFIG_ARM64
+STACK_FRAME_NON_STANDARD(___bpf_prog_run);
+#endif
 
 #define PROG_NAME(stack_size) __bpf_prog_run##stack_size
 #define DEFINE_BPF_PROG_RUN(stack_size) \