Re: [PATCH v6 0/2] security: Expand task_setscheduler LSM hook

From: Aaron Tomlin

Date: Sat Nov 21 2026 - 14:47:16 EST


On Wed, Nov 18, 2026 at 11:07:03PM -0500, Aaron Tomlin wrote:
> This series expands the task_setscheduler LSM hook to accept nullable
> pointers to the requested sched_attr and cpumask alongside the target
> task_struct. For sched_setaffinity(), passing the raw user-supplied
> affinity mask allows LSMs such as the BPF LSM to audit or filter the
> mask as requested by userspace before __sched_setaffinity() intersects
> it with the task's allowed cpuset CPUs, which seccomp filters cannot
> inspect behind user pointers and scheduler tracepoints only observe
> post-intersection. Similarly, __sched_setscheduler() passes a local
> sched_attr populated with the resolved scheduling policy and effective
> SCHED_FLAG_RESET_ON_FORK state so parameter-only updates expose the
> effective values rather than internal sentinels or caller defaults, and
> cpuset task migrations and CLONE_INTO_CGROUP pass the destination
> cpuset's effective_cpus mask (note that direct writes to cpuset.cpus
> update task affinity via cpuset_update_tasks_cpumask() without invoking
> this hook).

Adding KP Singh, Matt Bobrowski, and Chris Down to Cc.

KP, Matt: I would particularly appreciate your thoughts from the BPF LSM
side on expanding task_setscheduler (which shifts the trailing ret context
slot from slot 1 to slot 3 for existing two-argument lsm/task_setscheduler
programs).

Kind regards,
--
Aaron Tomlin