Skip to contentSkip to conversation

include/linux/bpf.h - fix missing prototype warnings...

PATCH Applied [email protected] 3 participants 3 messages Jan 29, 2019 – Jan 31, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include/linux/bpf.h - fix missing prototype warnings...

Compiling with W=1 generates warnings:

CC kernel/bpf/core.o
kernel/bpf/core.c:721:12: warning: no previous prototype for ?bpf_jit_alloc_exec_limit? [-Wmissing-prototypes]
721 | u64 __weak bpf_jit_alloc_exec_limit(void)

      |            ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:757:14: warning: no previous prototype for ?bpf_jit_alloc_exec? [-Wmissing-prototypes]
  757 | void *__weak bpf_jit_alloc_exec(unsigned long size)
      |              ^~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:762:13: warning: no previous prototype for ?bpf_jit_free_exec? [-Wmissing-prototypes]
  762 | void __weak bpf_jit_free_exec(void *addr)
      |             ^~~~~~~~~~~~~~~~~

All three are weak functions that archs can override, although none do so currently. Provide prototypes for when a new arch provides its own.

include/linux/bpf.h +4 -0
index 3851529062ec..99e55313123f 100644
@@ -472,6 +472,10 @@ _out:							\
 #define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func)	\
 	__BPF_PROG_RUN_ARRAY(array, ctx, func, true)
 
+u64 __weak bpf_jit_alloc_exec_limit(void);
+void *__weak bpf_jit_alloc_exec(unsigned long size);
+void __weak bpf_jit_free_exec(void *addr);
+
 #ifdef CONFIG_BPF_SYSCALL
 DECLARE_PER_CPU(int, bpf_prog_active);
 
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · On Mon, Jan 28, 2019 at 10:05 PM <[email protected]> wrote:

Compiling with W=1 generates warnings:

CC kernel/bpf/core.o
kernel/bpf/core.c:721:12: warning: no previous prototype for ?bpf_jit_alloc_exec_limit? [-Wmissing-prototypes]
721 | u64 __weak bpf_jit_alloc_exec_limit(void)

      |            ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:757:14: warning: no previous prototype for ?bpf_jit_alloc_exec? [-Wmissing-prototypes]
  757 | void *__weak bpf_jit_alloc_exec(unsigned long size)
      |              ^~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:762:13: warning: no previous prototype for ?bpf_jit_free_exec? [-Wmissing-prototypes]
  762 | void __weak bpf_jit_free_exec(void *addr)
      |             ^~~~~~~~~~~~~~~~~
Quoted 4 lines

All three are weak functions that archs can override, although none do so currently. Provide prototypes for when a new arch provides its own.

Quoted 17 lines
include/linux/bpf.h +4 -0
index 3851529062ec..99e55313123f 100644
@@ -472,6 +472,10 @@ _out:                                                      \
 #define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func)     \
        __BPF_PROG_RUN_ARRAY(array, ctx, func, true)
 
+u64 __weak bpf_jit_alloc_exec_limit(void);
+void *__weak bpf_jit_alloc_exec(unsigned long size);
+void __weak bpf_jit_free_exec(void *addr);
+
 #ifdef CONFIG_BPF_SYSCALL
 DECLARE_PER_CPU(int, bpf_prog_active);
 
maintainer Applied
#2 lore raw
In reply to [email protected]
Quoted 13 lines · On 01/29/2019 07:04 AM, [email protected] wrote:

Compiling with W=1 generates warnings:

CC kernel/bpf/core.o
kernel/bpf/core.c:721:12: warning: no previous prototype for ?bpf_jit_alloc_exec_limit? [-Wmissing-prototypes]
721 | u64 __weak bpf_jit_alloc_exec_limit(void)

      |            ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:757:14: warning: no previous prototype for ?bpf_jit_alloc_exec? [-Wmissing-prototypes]
  757 | void *__weak bpf_jit_alloc_exec(unsigned long size)
      |              ^~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:762:13: warning: no previous prototype for ?bpf_jit_free_exec? [-Wmissing-prototypes]
  762 | void __weak bpf_jit_free_exec(void *addr)
      |             ^~~~~~~~~~~~~~~~~
Quoted 4 lines

All three are weak functions that archs can override, although none do so currently. Provide prototypes for when a new arch provides its own.

Applied all 3 to bpf-next, thanks Valdis!

include/linux/bpf.h _out: \ · line 478

Quoted 12 lines
include/linux/bpf.h +4 -0
index 3851529062ec..99e55313123f 100644
@@ -472,6 +472,10 @@ _out:							\
 #define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func)	\
 	__BPF_PROG_RUN_ARRAY(array, ctx, func, true)
 
+u64 __weak bpf_jit_alloc_exec_limit(void);
+void *__weak bpf_jit_alloc_exec(unsigned long size);
+void __weak bpf_jit_free_exec(void *addr);
+

(I moved these to include/linux/filter.h while applying where we have all the
other prototypes from JIT core already.)

Quoted 4 lines
include/linux/bpf.h +0 -0
 #ifdef CONFIG_BPF_SYSCALL
 DECLARE_PER_CPU(int, bpf_prog_active);