Netdev List
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: Allow bpf_current_task_under_cgroup in interrupt
@ 2018-04-28  7:32 Teng Qin
  2018-04-28 15:03 ` Alexei Starovoitov
  2018-04-29  6:39 ` [PATCH bpf-next v2] " Teng Qin
  0 siblings, 2 replies; 4+ messages in thread
From: Teng Qin @ 2018-04-28  7:32 UTC (permalink / raw)
  To: netdev; +Cc: ast, daniel, yhs, kernel-team, Teng Qin

Currently, the bpf_current_task_under_cgroup helper has a check where if
the BPF program is running in_interrupt(), it will return -EINVAL. This
prevents the helper to be used in many useful scenarios, particularly
BPF programs attached to Perf Events.

This commit removes the check. Tested a few NMI (Perf Event) and some
softirq context, the helper returns the correct result.
---
 kernel/trace/bpf_trace.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 56ba0f2..f94890c 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -474,8 +474,6 @@ BPF_CALL_2(bpf_current_task_under_cgroup, struct bpf_map *, map, u32, idx)
 	struct bpf_array *array = container_of(map, struct bpf_array, map);
 	struct cgroup *cgrp;
 
-	if (unlikely(in_interrupt()))
-		return -EINVAL;
 	if (unlikely(idx >= array->map.max_entries))
 		return -E2BIG;
 
-- 
2.9.5

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

end of thread, other threads:[~2018-04-29 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-28  7:32 [PATCH bpf-next] bpf: Allow bpf_current_task_under_cgroup in interrupt Teng Qin
2018-04-28 15:03 ` Alexei Starovoitov
2018-04-29  6:39 ` [PATCH bpf-next v2] " Teng Qin
2018-04-29 16:20   ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox