From: Florent Revest <revest@chromium.org>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
kpsingh@chromium.org, rdunlap@infradead.org,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Only call sock_from_file with CONFIG_NET
Date: Mon, 07 Dec 2020 21:04:36 +0100 [thread overview]
Message-ID: <aeeb146ca7b4194e23e99fc3cd0fa0dcdc951651.camel@chromium.org> (raw)
In-Reply-To: <20201207195539.609787-1-revest@chromium.org>
On Mon, 2020-12-07 at 20:55 +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..877123bae71f 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 NULL;
Ugh, and of course I messed up my fix... :) Now this causes a:
./include/linux/stddef.h:8:14: warning: returning ‘void *’ from a
function with return type ‘u64’ {aka ‘long long unsigned int’} makes
integer from pointer without a cast [-Wint-conversion]
8 | #define NULL ((void *)0)
| ^
kernel/trace/bpf_trace.c:1278:9: note: in expansion of macro ‘NULL’
1278 | return NULL;
So I'm sending a v2!
prev parent reply other threads:[~2020-12-07 20:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-07 19:55 [PATCH bpf-next] bpf: Only call sock_from_file with CONFIG_NET Florent Revest
2020-12-07 20:04 ` Florent Revest [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aeeb146ca7b4194e23e99fc3cd0fa0dcdc951651.camel@chromium.org \
--to=revest@chromium.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).