sched: Work: deref into Arc<Task> rather than OwnedTask

Since a Arc<Work> can be obtained from `TASK_LIST`, this would allow the
potential mutation of 'owned'-state from other CPUs thereby causing a
race condition. Thefore, ensure that the deref of an `Arc<Work>` only
permits access to `t_shared`.
This commit is contained in:
Matthew Leach
2026-03-16 20:38:22 +00:00
parent a8aef0483f
commit 3d20e28c4f
4 changed files with 78 additions and 64 deletions

View File

@@ -60,7 +60,7 @@ pub async fn sys_capget(hdrp: TUA<CapUserHeader>, datap: TUA<CapUserData>) -> Re
.iter()
.find(|task| task.0.tgid.value() == header.pid as u32)
.and_then(|task| task.1.upgrade())
.map(|x| x.t_shared.clone())
.map(|x| (*x).clone())
.ok_or(KernelError::NoProcess)?
};
match header.version {
@@ -96,7 +96,7 @@ pub async fn sys_capset(hdrp: TUA<CapUserHeader>, datap: TUA<CapUserData>) -> Re
.iter()
.find(|task| task.0.tgid.value() == header.pid as u32)
.and_then(|task| task.1.upgrade())
.map(|x| x.t_shared.clone())
.map(|x| (*x).clone())
.ok_or(KernelError::NoProcess)?
};