diff options
| author | Martin KaFai Lau <[email protected]> | 2022-08-16 23:17:23 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2022-08-18 17:06:12 -0700 |
| commit | e42c7beee71d0d84a6193357e3525d0cf2a3e168 (patch) | |
| tree | 07465d67db08849512a87e907cfbc160881dcbdc /tools/perf/scripts/python/check-perf-trace.py | |
| parent | 24426654ed3ae83d1127511891fb782c54f49203 (diff) | |
bpf: net: Consider has_current_bpf_ctx() when testing capable() in sk_setsockopt()
When bpf program calling bpf_setsockopt(SOL_SOCKET),
it could be run in softirq and doesn't make sense to do the capable
check. There was a similar situation in bpf_setsockopt(TCP_CONGESTION).
In commit 8d650cdedaab ("tcp: fix tcp_set_congestion_control() use from bpf hook"),
tcp_set_congestion_control(..., cap_net_admin) was added to skip
the cap check for bpf prog.
This patch adds sockopt_ns_capable() and sockopt_capable() for
the sk_setsockopt() to use. They will consider the
has_current_bpf_ctx() before doing the ns_capable() and capable() test.
They are in EXPORT_SYMBOL for the ipv6 module to use in a latter patch.
Suggested-by: Stanislav Fomichev <[email protected]>
Reviewed-by: Stanislav Fomichev <[email protected]>
Signed-off-by: Martin KaFai Lau <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/check-perf-trace.py')
0 files changed, 0 insertions, 0 deletions