Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1354824

Re: [PATCH] bpf: make bpf_stackmap_copy conditionally called

From Alexei Starovoitov <alexei.starovoitov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] bpf: make bpf_stackmap_copy conditionally called
Date 2016-03-10 04:40 +0100
Message-ID <raZC9-10L-1@gated-at.bofh.it> (permalink)
References <raZst-Vy-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Mar 10, 2016 at 02:43:42AM +0100, Arnd Bergmann wrote:
> Changing the bpf syscall to use the new bpf_stackmap_copy() helper for
> BPF_MAP_TYPE_STACK_TRACE causes a link error when CONFIG_PERF_EVENTS
> is disabled:
> 
> kernel/built-in.o: In function `map_lookup_elem':
> :(.text+0x7fca4): undefined reference to `bpf_stackmap_copy'
> 
> This patch simply avoids handling that case, which may or may not
> be the correct answer here.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 557c0c6e7df8 ("bpf: convert stackmap to pre-allocation")
...
> -	} else if (map->map_type == BPF_MAP_TYPE_STACK_TRACE) {
> +	} else if (map->map_type == BPF_MAP_TYPE_STACK_TRACE &&
> +		   IS_ENABLED(CONFIG_PERF_EVENTS)) {
>  		err = bpf_stackmap_copy(map, key, value);
>  	} else {

yes. this is also ok-ish fix.
I've sent different version already:
http://patchwork.ozlabs.org/patch/595617/

I considered the option like yours but it's relying on gcc doing
dead code elimination of 'if (false) {}' branch and though kernel
is never compiled with -O0. I didn't want to take the risk.
I'm fine with either approach though.

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] bpf: make bpf_stackmap_copy conditionally called Arnd Bergmann <arnd@arndb.de> - 2016-03-10 04:30 +0100
  Re: [PATCH] bpf: make bpf_stackmap_copy conditionally called Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-03-10 04:40 +0100
    Re: [PATCH] bpf: make bpf_stackmap_copy conditionally called Arnd Bergmann <arnd@arndb.de> - 2016-03-10 10:20 +0100

csiph-web