mirror of
https://github.com/hexagonal-sun/moss-kernel.git
synced 2026-04-23 16:48:57 -04:00
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:
@@ -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)?
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user