Skip to content

Commit 9bd0a07

Browse files
Anton Vorontsovtorvalds
authored andcommitted
um: should hold tasklist_lock while traversing processes
Traversing the tasks requires holding tasklist_lock, otherwise it is unsafe. p.s. However, I'm not sure that calling os_kill_ptraced_process() in the atomic context is correct. It seem to work, but please take a closer look. Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Cc: Richard Weinberger <richard@nod.at> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent af1be5a commit 9bd0a07

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎arch/um/kernel/reboot.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include "linux/sched.h"
7+
#include "linux/spinlock.h"
78
#include "linux/slab.h"
89
#include "kern_util.h"
910
#include "os.h"
@@ -22,13 +23,15 @@ static void kill_off_processes(void)
2223
struct task_struct *p;
2324
int pid;
2425

26+
read_lock(&tasklist_lock);
2527
for_each_process(p) {
2628
if (p->mm == NULL)
2729
continue;
2830

2931
pid = p->mm->context.id.u.pid;
3032
os_kill_ptraced_process(pid, 1);
3133
}
34+
read_unlock(&tasklist_lock);
3235
}
3336
}
3437

0 commit comments

Comments
 (0)