lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQKnJCdW5OCs338W4ts_mn6JVw7fD5U6w5o6dtc4DSJQrA@mail.gmail.com>
Date: Tue, 25 Feb 2025 21:24:27 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Juntong Deng <juntong.deng@...look.com>
Cc: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, 
	John Fastabend <john.fastabend@...il.com>, Andrii Nakryiko <andrii@...nel.org>, 
	Martin KaFai Lau <martin.lau@...ux.dev>, Eddy Z <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	Yonghong Song <yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>, 
	Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>, 
	Kumar Kartikeya Dwivedi <memxor@...il.com>, Tejun Heo <tj@...nel.org>, David Vernet <void@...ifault.com>, 
	Andrea Righi <arighi@...dia.com>, Changwoo Min <changwoo@...lia.com>, bpf <bpf@...r.kernel.org>, 
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH bpf-next v2 3/5] sched_ext: Add scx_kfunc_ids_ops_context
 for unified filtering of context-sensitive SCX kfuncs

On Fri, Feb 14, 2025 at 12:13 PM Juntong Deng <juntong.deng@...look.com> wrote:
> +static int scx_kfunc_ids_ops_context_filter(const struct bpf_prog *prog, u32 kfunc_id)
> +{
> +       u32 moff, flags;
> +
> +       if (!btf_id_set8_contains(&scx_kfunc_ids_ops_context, kfunc_id))
> +               return 0;
> +
> +       if (prog->type == BPF_PROG_TYPE_SYSCALL &&
> +           btf_id_set8_contains(&scx_kfunc_ids_unlocked, kfunc_id))
> +               return 0;
> +
> +       if (prog->type == BPF_PROG_TYPE_STRUCT_OPS &&
> +           prog->aux->st_ops != &bpf_sched_ext_ops)
> +               return 0;
> +
> +       /* prog->type == BPF_PROG_TYPE_STRUCT_OPS && prog->aux->st_ops == &bpf_sched_ext_ops*/
> +
> +       moff = prog->aux->attach_st_ops_member_off;
> +       flags = scx_ops_context_flags[SCX_MOFF_IDX(moff)];
> +
> +       if ((flags & SCX_OPS_KF_UNLOCKED) &&
> +           btf_id_set8_contains(&scx_kfunc_ids_unlocked, kfunc_id))
> +               return 0;
> +
> +       if ((flags & SCX_OPS_KF_CPU_RELEASE) &&
> +           btf_id_set8_contains(&scx_kfunc_ids_cpu_release, kfunc_id))
> +               return 0;
> +
> +       if ((flags & SCX_OPS_KF_DISPATCH) &&
> +           btf_id_set8_contains(&scx_kfunc_ids_dispatch, kfunc_id))
> +               return 0;
> +
> +       if ((flags & SCX_OPS_KF_ENQUEUE) &&
> +           btf_id_set8_contains(&scx_kfunc_ids_enqueue_dispatch, kfunc_id))
> +               return 0;
> +
> +       if ((flags & SCX_OPS_KF_SELECT_CPU) &&
> +           btf_id_set8_contains(&scx_kfunc_ids_select_cpu, kfunc_id))
> +               return 0;
> +
> +       return -EACCES;
> +}

This looks great.
Very good cleanup and run-time speed up.
Please resend without RFC tag, so sched-ext folks can review.

>From bpf pov, pls add my Ack to patch 1 when you respin.
The set can probably target sched-ext tree too.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ