lkml.org 
[lkml]   [2020]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH bpf-next v2] bpf: Only call sock_from_file with CONFIG_NET
On Mon, Dec 07, 2020 at 09:06:05PM +0100, Florent Revest wrote:
> This avoids
> ld: kernel/trace/bpf_trace.o: in function `bpf_sock_from_file':
> bpf_trace.c:(.text+0xe23): undefined reference to `sock_from_file'
> When compiling a kernel with BPF and without NET.
>
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Florent Revest <revest@chromium.org>
> ---
> kernel/trace/bpf_trace.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 0cf0a6331482..29ec2b3b1cc4 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -1272,7 +1272,11 @@ const struct bpf_func_proto bpf_snprintf_btf_proto = {
>
> BPF_CALL_1(bpf_sock_from_file, struct file *, file)
> {
> +#ifdef CONFIG_NET
> return (unsigned long) sock_from_file(file);
> +#else
> + return 0;
> +#endif
> }
Should bpf_sock_from_file_proto belong to
tracing_prog_func_proto() instead of bpf_tracing_func_proto()?
bpf_skc_to_*_proto is also in tracing_prog_func_proto()
where there is an existing "#ifdef CONFIG_NET".

>
> BTF_ID_LIST(bpf_sock_from_file_btf_ids)
> --
> 2.29.2.576.ga3fc446d84-goog
>

\
 
 \ /
  Last update: 2020-12-07 22:37    [W:0.050 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site