summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2020-04-20 11:47:50 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2020-07-04 08:47:28 +0000
commit45217b91eaaa3a563247c4f470f4cb785de6b1c6 (patch)
treed15ee515953aa202591e3e5591c9eff952e561c3
parent9e9a4c05a0b05d5c01b4760d629be4d62da6b226 (diff)
downloadgoldfish-45217b91eaaa3a563247c4f470f4cb785de6b1c6.tar.gz
UPSTREAM: net: bpf: Make bpf_ktime_get_ns() available to non GPL programs
The entire implementation is in kernel/bpf/helpers.c: BPF_CALL_0(bpf_ktime_get_ns) { /* NMI safe access to clock monotonic */ return ktime_get_mono_fast_ns(); } const struct bpf_func_proto bpf_ktime_get_ns_proto = { .func = bpf_ktime_get_ns, .gpl_only = false, .ret_type = RET_INTEGER, }; and this was presumably marked GPL due to kernel/time/timekeeping.c: EXPORT_SYMBOL_GPL(ktime_get_mono_fast_ns); and while that may make sense for kernel modules (although even that is doubtful), there is currently AFAICT no other source of time available to ebpf. Furthermore this is really just equivalent to clock_gettime(CLOCK_MONOTONIC) which is exposed to userspace (via vdso even to make it performant)... As such, I see no reason to keep the GPL restriction. (In the future I'd like to have access to time from Apache licensed ebpf code) Signed-off-by: Maciej Żenczykowski <maze@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> (cherry picked from commit 082b57e3eb09810d357083cca5ee2df02c16aec9) Change-Id: I76f763c64fcd56e7149f94625146486ba00db6c1
-rw-r--r--kernel/bpf/helpers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 5e28718928ca..3d23c94b7fb3 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -148,7 +148,7 @@ BPF_CALL_0(bpf_ktime_get_ns)
const struct bpf_func_proto bpf_ktime_get_ns_proto = {
.func = bpf_ktime_get_ns,
- .gpl_only = true,
+ .gpl_only = false,
.ret_type = RET_INTEGER,
};