diff options
Diffstat (limited to 'include/linux/tracehook.h')
-rw-r--r-- | include/linux/tracehook.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 51bd91d911c3..6a4d82bedb03 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/sched.h> | 49 | #include <linux/sched.h> |
50 | #include <linux/ptrace.h> | 50 | #include <linux/ptrace.h> |
51 | #include <linux/security.h> | 51 | #include <linux/security.h> |
52 | #include <linux/task_work.h> | ||
52 | struct linux_binprm; | 53 | struct linux_binprm; |
53 | 54 | ||
54 | /* | 55 | /* |
@@ -153,7 +154,6 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info, | |||
153 | ptrace_notify(SIGTRAP); | 154 | ptrace_notify(SIGTRAP); |
154 | } | 155 | } |
155 | 156 | ||
156 | #ifdef TIF_NOTIFY_RESUME | ||
157 | /** | 157 | /** |
158 | * set_notify_resume - cause tracehook_notify_resume() to be called | 158 | * set_notify_resume - cause tracehook_notify_resume() to be called |
159 | * @task: task that will call tracehook_notify_resume() | 159 | * @task: task that will call tracehook_notify_resume() |
@@ -165,8 +165,10 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info, | |||
165 | */ | 165 | */ |
166 | static inline void set_notify_resume(struct task_struct *task) | 166 | static inline void set_notify_resume(struct task_struct *task) |
167 | { | 167 | { |
168 | #ifdef TIF_NOTIFY_RESUME | ||
168 | if (!test_and_set_tsk_thread_flag(task, TIF_NOTIFY_RESUME)) | 169 | if (!test_and_set_tsk_thread_flag(task, TIF_NOTIFY_RESUME)) |
169 | kick_process(task); | 170 | kick_process(task); |
171 | #endif | ||
170 | } | 172 | } |
171 | 173 | ||
172 | /** | 174 | /** |
@@ -184,7 +186,14 @@ static inline void set_notify_resume(struct task_struct *task) | |||
184 | */ | 186 | */ |
185 | static inline void tracehook_notify_resume(struct pt_regs *regs) | 187 | static inline void tracehook_notify_resume(struct pt_regs *regs) |
186 | { | 188 | { |
189 | /* | ||
190 | * The caller just cleared TIF_NOTIFY_RESUME. This barrier | ||
191 | * pairs with task_work_add()->set_notify_resume() after | ||
192 | * hlist_add_head(task->task_works); | ||
193 | */ | ||
194 | smp_mb__after_clear_bit(); | ||
195 | if (unlikely(!hlist_empty(¤t->task_works))) | ||
196 | task_work_run(); | ||
187 | } | 197 | } |
188 | #endif /* TIF_NOTIFY_RESUME */ | ||
189 | 198 | ||
190 | #endif /* <linux/tracehook.h> */ | 199 | #endif /* <linux/tracehook.h> */ |