* [PATCH net-next] ebpf: bpf_map_*: fix linker error on avr32 and openrisc arch
@ 2015-03-05 22:27 Daniel Borkmann
2015-03-06 2:35 ` Alexei Starovoitov
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Daniel Borkmann @ 2015-03-05 22:27 UTC (permalink / raw)
To: davem; +Cc: fengguang.wu, ast, netdev, Daniel Borkmann
Fengguang reported, that on openrisc and avr32 architectures, we
get the following linker errors on *_defconfig builds that have
no bpf syscall support:
net/built-in.o:(.rodata+0x1cd0): undefined reference to `bpf_map_lookup_elem_proto'
net/built-in.o:(.rodata+0x1cd4): undefined reference to `bpf_map_update_elem_proto'
net/built-in.o:(.rodata+0x1cd8): undefined reference to `bpf_map_delete_elem_proto'
Fix it up by providing built-in weak definitions of the symbols,
so they can be overridden when the syscall is enabled. I think
the issue might be that gcc is not able to optimize all that away.
This patch fixes the linker errors for me, tested with Fengguang's
make.cross [1] script.
[1] https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Fixes: d4052c4aea0c ("ebpf: remove CONFIG_BPF_SYSCALL ifdefs in socket filter code")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
kernel/bpf/core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index a64e7a2..50603ae 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -656,6 +656,11 @@ void bpf_prog_free(struct bpf_prog *fp)
}
EXPORT_SYMBOL_GPL(bpf_prog_free);
+/* Weak definitions of helper functions in case we don't have bpf syscall. */
+const struct bpf_func_proto bpf_map_lookup_elem_proto __weak;
+const struct bpf_func_proto bpf_map_update_elem_proto __weak;
+const struct bpf_func_proto bpf_map_delete_elem_proto __weak;
+
/* To execute LD_ABS/LD_IND instructions __bpf_prog_run() may call
* skb_copy_bits(), so provide a weak definition of it for NET-less config.
*/
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ebpf: bpf_map_*: fix linker error on avr32 and openrisc arch
2015-03-05 22:27 [PATCH net-next] ebpf: bpf_map_*: fix linker error on avr32 and openrisc arch Daniel Borkmann
@ 2015-03-06 2:35 ` Alexei Starovoitov
2015-03-06 6:05 ` David Miller
2015-03-06 7:20 ` Or Gerlitz
2 siblings, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2015-03-06 2:35 UTC (permalink / raw)
To: Daniel Borkmann, davem; +Cc: fengguang.wu, netdev
On 3/5/15 2:27 PM, Daniel Borkmann wrote:
> Fengguang reported, that on openrisc and avr32 architectures, we
> get the following linker errors on *_defconfig builds that have
> no bpf syscall support:
>
> net/built-in.o:(.rodata+0x1cd0): undefined reference to `bpf_map_lookup_elem_proto'
> net/built-in.o:(.rodata+0x1cd4): undefined reference to `bpf_map_update_elem_proto'
> net/built-in.o:(.rodata+0x1cd8): undefined reference to `bpf_map_delete_elem_proto'
>
> Fix it up by providing built-in weak definitions of the symbols,
> so they can be overridden when the syscall is enabled. I think
> the issue might be that gcc is not able to optimize all that away.
> This patch fixes the linker errors for me, tested with Fengguang's
> make.cross [1] script.
>
> [1] https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Fixes: d4052c4aea0c ("ebpf: remove CONFIG_BPF_SYSCALL ifdefs in socket filter code")
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
thanks :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ebpf: bpf_map_*: fix linker error on avr32 and openrisc arch
2015-03-05 22:27 [PATCH net-next] ebpf: bpf_map_*: fix linker error on avr32 and openrisc arch Daniel Borkmann
2015-03-06 2:35 ` Alexei Starovoitov
@ 2015-03-06 6:05 ` David Miller
2015-03-06 7:20 ` Or Gerlitz
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-03-06 6:05 UTC (permalink / raw)
To: daniel; +Cc: fengguang.wu, ast, netdev
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Thu, 5 Mar 2015 23:27:51 +0100
> Fengguang reported, that on openrisc and avr32 architectures, we
> get the following linker errors on *_defconfig builds that have
> no bpf syscall support:
>
> net/built-in.o:(.rodata+0x1cd0): undefined reference to `bpf_map_lookup_elem_proto'
> net/built-in.o:(.rodata+0x1cd4): undefined reference to `bpf_map_update_elem_proto'
> net/built-in.o:(.rodata+0x1cd8): undefined reference to `bpf_map_delete_elem_proto'
>
> Fix it up by providing built-in weak definitions of the symbols,
> so they can be overridden when the syscall is enabled. I think
> the issue might be that gcc is not able to optimize all that away.
> This patch fixes the linker errors for me, tested with Fengguang's
> make.cross [1] script.
>
> [1] https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Fixes: d4052c4aea0c ("ebpf: remove CONFIG_BPF_SYSCALL ifdefs in socket filter code")
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ebpf: bpf_map_*: fix linker error on avr32 and openrisc arch
2015-03-05 22:27 [PATCH net-next] ebpf: bpf_map_*: fix linker error on avr32 and openrisc arch Daniel Borkmann
2015-03-06 2:35 ` Alexei Starovoitov
2015-03-06 6:05 ` David Miller
@ 2015-03-06 7:20 ` Or Gerlitz
2015-03-06 7:35 ` Daniel Borkmann
2 siblings, 1 reply; 5+ messages in thread
From: Or Gerlitz @ 2015-03-06 7:20 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: Linux Netdev List
On Fri, Mar 6, 2015 at 12:27 AM, Daniel Borkmann <daniel@iogearbox.net> wrote:
> Fengguang reported, that on openrisc and avr32 architectures, we
> get the following linker errors on *_defconfig builds that have
> no bpf syscall support:
> net/built-in.o:(.rodata+0x1cd0): undefined reference to `bpf_map_lookup_elem_proto'
> net/built-in.o:(.rodata+0x1cd4): undefined reference to `bpf_map_update_elem_proto'
> net/built-in.o:(.rodata+0x1cd8): undefined reference to `bpf_map_delete_elem_proto'
>
> Fix it up by providing built-in weak definitions of the symbols,
> so they can be overridden when the syscall is enabled. I think
> the issue might be that gcc is not able to optimize all that away.
> This patch fixes the linker errors for me, tested with Fengguang's
> make.cross [1] script.
>
> [1] https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Fixes: d4052c4aea0c ("ebpf: remove CONFIG_BPF_SYSCALL ifdefs in socket filter code")
isn't that a 4.0-rc commit? if this is the case, this is for net, not net-next
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ebpf: bpf_map_*: fix linker error on avr32 and openrisc arch
2015-03-06 7:20 ` Or Gerlitz
@ 2015-03-06 7:35 ` Daniel Borkmann
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2015-03-06 7:35 UTC (permalink / raw)
To: Or Gerlitz; +Cc: Linux Netdev List
On 03/06/2015 08:20 AM, Or Gerlitz wrote:
> On Fri, Mar 6, 2015 at 12:27 AM, Daniel Borkmann <daniel@iogearbox.net> wrote:
...
>> Fixes: d4052c4aea0c ("ebpf: remove CONFIG_BPF_SYSCALL ifdefs in socket filter code")
>
> isn't that a 4.0-rc commit? if this is the case, this is for net, not net-next
Nope, that commit is only in net-next.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-06 7:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-05 22:27 [PATCH net-next] ebpf: bpf_map_*: fix linker error on avr32 and openrisc arch Daniel Borkmann
2015-03-06 2:35 ` Alexei Starovoitov
2015-03-06 6:05 ` David Miller
2015-03-06 7:20 ` Or Gerlitz
2015-03-06 7:35 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).