summaryrefslogtreecommitdiff
path: root/include/linux/sched
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2023-09-17 13:24:21 +0200
committerPeter Zijlstra <peterz@infradead.org>2023-11-29 15:43:54 +0100
commit5431fdd2c181dd2eac218e45b44deb2925fa48f0 (patch)
treef2c70579913577d25213659f520dbdd24c6a915f /include/linux/sched
parent18caaedaf4c3712ab6821f292598a8f86e6d7972 (diff)
ptrace: Convert ptrace_attach() to use lock guards
Created as testing for the conditional guard infrastructure. Specifically this makes use of the following form: scoped_cond_guard (mutex_intr, return -ERESTARTNOINTR, &task->signal->cred_guard_mutex) { ... } ... return 0; Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Link: https://lkml.kernel.org/r/20231102110706.568467727%40infradead.org
Diffstat (limited to 'include/linux/sched')
-rw-r--r--include/linux/sched/task.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h
index a23af225c898..4f3dca353556 100644
--- a/include/linux/sched/task.h
+++ b/include/linux/sched/task.h
@@ -226,4 +226,6 @@ static inline void task_unlock(struct task_struct *p)
spin_unlock(&p->alloc_lock);
}
+DEFINE_GUARD(task_lock, struct task_struct *, task_lock(_T), task_unlock(_T))
+
#endif /* _LINUX_SCHED_TASK_H */