Skip to content
Commit dab6d335 authored by Valentin Schneider's avatar Valentin Schneider
Browse files

x86/intel_rdt: Plug task_work vs task_struct {rmid,closid} update race



Upon moving a task to a new control / monitor group, said task's {closid,
rmid} fields are updated *after* triggering the move_myself() task_work
callback. This can cause said callback to miss the update, e.g. if the
triggering thread got preempted before fiddling with task_struct, or if the
targeted task was already on its way to return to userspace.

Update the task_struct's {closid, rmid} tuple *before* invoking
task_work_add(). As they can be accessed concurrently, wrap {closid, rmid}
accesses with READ_ONCE() and WRITE_ONCE(). Highlight the required ordering
with a pair of comments.

Signed-off-by: default avatarValentin Schneider <valentin.schneider@arm.com>
parent 93bbb448
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment