linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bpf: make tracing helpers gpl only
@ 2015-10-23 21:58 Alexei Starovoitov
  2015-10-25  9:14 ` Ingo Molnar
  2015-10-27  4:54 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2015-10-23 21:58 UTC (permalink / raw)
  To: David S. Miller
  Cc: Ingo Molnar, Peter Zijlstra, Wang Nan, He Kuang, Kaixu Xia,
	Daniel Borkmann, netdev, linux-kernel

exported perf symbols are GPL only, mark eBPF helper functions
used in tracing as GPL only as well.

Suggested-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
this is on top of this patch that touches the same file:
http://patchwork.ozlabs.org/patch/534664/

 kernel/trace/bpf_trace.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 003df3887287..4228fd3682c3 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -214,7 +214,7 @@ static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5)
 
 static const struct bpf_func_proto bpf_perf_event_read_proto = {
 	.func		= bpf_perf_event_read,
-	.gpl_only	= false,
+	.gpl_only	= true,
 	.ret_type	= RET_INTEGER,
 	.arg1_type	= ARG_CONST_MAP_PTR,
 	.arg2_type	= ARG_ANYTHING,
@@ -255,7 +255,7 @@ static u64 bpf_perf_event_output(u64 r1, u64 r2, u64 index, u64 r4, u64 size)
 
 static const struct bpf_func_proto bpf_perf_event_output_proto = {
 	.func		= bpf_perf_event_output,
-	.gpl_only	= false,
+	.gpl_only	= true,
 	.ret_type	= RET_INTEGER,
 	.arg1_type	= ARG_PTR_TO_CTX,
 	.arg2_type	= ARG_CONST_MAP_PTR,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bpf: make tracing helpers gpl only
  2015-10-23 21:58 [PATCH net-next] bpf: make tracing helpers gpl only Alexei Starovoitov
@ 2015-10-25  9:14 ` Ingo Molnar
  2015-10-25 18:17   ` Alexei Starovoitov
  2015-10-27  4:54 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2015-10-25  9:14 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: David S. Miller, Peter Zijlstra, Wang Nan, He Kuang, Kaixu Xia,
	Daniel Borkmann, netdev, linux-kernel


* Alexei Starovoitov <ast@plumgrid.com> wrote:

> exported perf symbols are GPL only, mark eBPF helper functions
> used in tracing as GPL only as well.
> 
> Suggested-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---
> this is on top of this patch that touches the same file:
> http://patchwork.ozlabs.org/patch/534664/
> 
>  kernel/trace/bpf_trace.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 003df3887287..4228fd3682c3 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -214,7 +214,7 @@ static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5)
>  
>  static const struct bpf_func_proto bpf_perf_event_read_proto = {
>  	.func		= bpf_perf_event_read,
> -	.gpl_only	= false,
> +	.gpl_only	= true,
>  	.ret_type	= RET_INTEGER,
>  	.arg1_type	= ARG_CONST_MAP_PTR,
>  	.arg2_type	= ARG_ANYTHING,
> @@ -255,7 +255,7 @@ static u64 bpf_perf_event_output(u64 r1, u64 r2, u64 index, u64 r4, u64 size)
>  
>  static const struct bpf_func_proto bpf_perf_event_output_proto = {
>  	.func		= bpf_perf_event_output,
> -	.gpl_only	= false,
> +	.gpl_only	= true,
>  	.ret_type	= RET_INTEGER,
>  	.arg1_type	= ARG_PTR_TO_CTX,
>  	.arg2_type	= ARG_CONST_MAP_PTR,

So there's a lot more 'gpl_only = false' cases that I can see:

triton:~/tip> git grep gpl_only | grep false
kernel/bpf/core.c: .gpl_only    = false,
kernel/bpf/helpers.c: .gpl_only = false,
kernel/bpf/helpers.c: .gpl_only = false,
kernel/bpf/helpers.c: .gpl_only = false,
kernel/bpf/helpers.c: .gpl_only = false,
kernel/bpf/helpers.c: .gpl_only = false,
kernel/bpf/helpers.c: .gpl_only = false,
kernel/bpf/helpers.c: .gpl_only = false,
kernel/bpf/helpers.c: .gpl_only = false,
kernel/trace/bpf_trace.c:       .gpl_only   = false,
net/core/filter.c: .gpl_only    = false,
net/core/filter.c: .gpl_only    = false,
net/core/filter.c: .gpl_only    = false,
net/core/filter.c: .gpl_only       = false,
net/core/filter.c: .gpl_only       = false,
net/core/filter.c: .gpl_only       = false,
net/core/filter.c: .gpl_only       = false,
net/core/filter.c: .gpl_only    = false,
net/core/filter.c: .gpl_only    = false,

and only a handful of 'true' cases:

triton:~/tip> git grep gpl_only | grep true
kernel/bpf/helpers.c: .gpl_only = true,
kernel/trace/bpf_trace.c:       .gpl_only   = true,
kernel/trace/bpf_trace.c:       .gpl_only   = true,

so I don't know the netfilter ones, but in particular the tracing ones I'm sure 
should be gpl-only. Do we really, really want proprietary modules mucking with 
such internals??

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bpf: make tracing helpers gpl only
  2015-10-25  9:14 ` Ingo Molnar
@ 2015-10-25 18:17   ` Alexei Starovoitov
  0 siblings, 0 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2015-10-25 18:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: David S. Miller, Peter Zijlstra, Wang Nan, He Kuang, Kaixu Xia,
	Daniel Borkmann, netdev, linux-kernel

On 10/25/15 2:14 AM, Ingo Molnar wrote:
> so I don't know the netfilter ones, but in particular the tracing ones I'm sure
> should be gpl-only. Do we really, really want proprietary modules mucking with
> such internals??

of course, not. Therefore bpf_probe_read() was gpl_only from very
beginning. Same goes to bpf_trace_printk() and bpf_ktime_get_ns().
and after this patch the only remaining non-gpl tracing helpers will be
bpf_get_current_pid_tgid()/uid_gid()/comm()
and imo it's fine.

On the networking side the helpers are non-gpl, since all of them are
generic. They don't mess with kernel, but examine/modify the packet.
Just like cBPF can read the packet data, get_processor_id, get_random,
eBPF can do the same plus write into the packet, compute checksum,
redirect, push/pop vlan.

When we introduce eBPF for seccomp, I would argue that helpers on that
side should be non-gpl as well, otherwise people will try to add
features to cBPF instead of moving to eBPF.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bpf: make tracing helpers gpl only
  2015-10-23 21:58 [PATCH net-next] bpf: make tracing helpers gpl only Alexei Starovoitov
  2015-10-25  9:14 ` Ingo Molnar
@ 2015-10-27  4:54 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-10-27  4:54 UTC (permalink / raw)
  To: ast
  Cc: mingo, a.p.zijlstra, wangnan0, hekuang, xiakaixu, daniel, netdev,
	linux-kernel

From: Alexei Starovoitov <ast@plumgrid.com>
Date: Fri, 23 Oct 2015 14:58:19 -0700

> exported perf symbols are GPL only, mark eBPF helper functions
> used in tracing as GPL only as well.
> 
> Suggested-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-27  4:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23 21:58 [PATCH net-next] bpf: make tracing helpers gpl only Alexei Starovoitov
2015-10-25  9:14 ` Ingo Molnar
2015-10-25 18:17   ` Alexei Starovoitov
2015-10-27  4:54 ` David Miller

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).