Thread (9 messages) flat view 9 messages, 4 authors, 2021-11-10

Re: [PATCH bpf 1/2] bpf: Forbid bpf_ktime_get_coarse_ns and bpf_timer_* in tracing progs

From: Alexei Starovoitov <hidden>
Date: 2021-11-09 21:52:17
Also in: bpf

On Mon, Nov 8, 2021 at 8:46 AM Dmitrii Banshchikov [off-list ref] wrote:
bpf_ktime_get_coarse_ns() helper uses ktime_get_coarse_ns() time
accessor that isn't safe for any context.
This results in locking issues:
Please trim the cc. vger thinks it's a spam.
The patch didn't reach the mailing list or patchwork.
 const struct bpf_func_proto bpf_ktime_get_coarse_ns_proto = {
        .func           = bpf_ktime_get_coarse_ns,
        .gpl_only       = false,
        .ret_type       = RET_INTEGER,
+       .allowed        = bpf_ktime_get_coarse_ns_allowed,
I think it's easier to move to networking prog types
instead of going through a callback.
quoted hunk ↗ jump to hunk
 static const struct bpf_func_proto bpf_timer_init_proto = {
        .func           = bpf_timer_init,
        .gpl_only       = true,
@@ -1147,6 +1173,7 @@ static const struct bpf_func_proto bpf_timer_init_proto = {
        .arg1_type      = ARG_PTR_TO_TIMER,
        .arg2_type      = ARG_CONST_MAP_PTR,
        .arg3_type      = ARG_ANYTHING,
+       .allowed        = bpf_timer_allowed,
I think disabling timers in check_map_prog_compatibility
(similar to how bpf_spin_lock is restricted) would be cleaner.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help