diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index ffccdad050b5..a781dec1cd0b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -128,6 +128,7 @@ struct bio_list; | |||
128 | struct fs_struct; | 128 | struct fs_struct; |
129 | struct perf_event_context; | 129 | struct perf_event_context; |
130 | struct blk_plug; | 130 | struct blk_plug; |
131 | struct filename; | ||
131 | 132 | ||
132 | /* | 133 | /* |
133 | * List of flags we want to share for kernel threads, | 134 | * List of flags we want to share for kernel threads, |
@@ -229,7 +230,7 @@ extern char ___assert_task_state[1 - 2*!!( | |||
229 | /* get_task_state() */ | 230 | /* get_task_state() */ |
230 | #define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \ | 231 | #define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \ |
231 | TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \ | 232 | TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \ |
232 | __TASK_TRACED) | 233 | __TASK_TRACED | EXIT_ZOMBIE | EXIT_DEAD) |
233 | 234 | ||
234 | #define task_is_traced(task) ((task->state & __TASK_TRACED) != 0) | 235 | #define task_is_traced(task) ((task->state & __TASK_TRACED) != 0) |
235 | #define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0) | 236 | #define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0) |
@@ -391,22 +392,33 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, | |||
391 | static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} | 392 | static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} |
392 | #endif | 393 | #endif |
393 | 394 | ||
394 | |||
395 | extern void set_dumpable(struct mm_struct *mm, int value); | ||
396 | extern int get_dumpable(struct mm_struct *mm); | ||
397 | |||
398 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ | 395 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ |
399 | #define SUID_DUMP_USER 1 /* Dump as user of process */ | 396 | #define SUID_DUMP_USER 1 /* Dump as user of process */ |
400 | #define SUID_DUMP_ROOT 2 /* Dump as root */ | 397 | #define SUID_DUMP_ROOT 2 /* Dump as root */ |
401 | 398 | ||
402 | /* mm flags */ | 399 | /* mm flags */ |
403 | /* dumpable bits */ | ||
404 | #define MMF_DUMPABLE 0 /* core dump is permitted */ | ||
405 | #define MMF_DUMP_SECURELY 1 /* core file is readable only by root */ | ||
406 | 400 | ||
401 | /* for SUID_DUMP_* above */ | ||
407 | #define MMF_DUMPABLE_BITS 2 | 402 | #define MMF_DUMPABLE_BITS 2 |
408 | #define MMF_DUMPABLE_MASK ((1 << MMF_DUMPABLE_BITS) - 1) | 403 | #define MMF_DUMPABLE_MASK ((1 << MMF_DUMPABLE_BITS) - 1) |
409 | 404 | ||
405 | extern void set_dumpable(struct mm_struct *mm, int value); | ||
406 | /* | ||
407 | * This returns the actual value of the suid_dumpable flag. For things | ||
408 | * that are using this for checking for privilege transitions, it must | ||
409 | * test against SUID_DUMP_USER rather than treating it as a boolean | ||
410 | * value. | ||
411 | */ | ||
412 | static inline int __get_dumpable(unsigned long mm_flags) | ||
413 | { | ||
414 | return mm_flags & MMF_DUMPABLE_MASK; | ||
415 | } | ||
416 | |||
417 | static inline int get_dumpable(struct mm_struct *mm) | ||
418 | { | ||
419 | return __get_dumpable(mm->flags); | ||
420 | } | ||
421 | |||
410 | /* coredump filter bits */ | 422 | /* coredump filter bits */ |
411 | #define MMF_DUMP_ANON_PRIVATE 2 | 423 | #define MMF_DUMP_ANON_PRIVATE 2 |
412 | #define MMF_DUMP_ANON_SHARED 3 | 424 | #define MMF_DUMP_ANON_SHARED 3 |
@@ -549,6 +561,7 @@ struct signal_struct { | |||
549 | atomic_t sigcnt; | 561 | atomic_t sigcnt; |
550 | atomic_t live; | 562 | atomic_t live; |
551 | int nr_threads; | 563 | int nr_threads; |
564 | struct list_head thread_head; | ||
552 | 565 | ||
553 | wait_queue_head_t wait_chldexit; /* for wait4() */ | 566 | wait_queue_head_t wait_chldexit; /* for wait4() */ |
554 | 567 | ||
@@ -1227,7 +1240,6 @@ struct task_struct { | |||
1227 | /* Used for emulating ABI behavior of previous Linux versions */ | 1240 | /* Used for emulating ABI behavior of previous Linux versions */ |
1228 | unsigned int personality; | 1241 | unsigned int personality; |
1229 | 1242 | ||
1230 | unsigned did_exec:1; | ||
1231 | unsigned in_execve:1; /* Tell the LSMs that the process is doing an | 1243 | unsigned in_execve:1; /* Tell the LSMs that the process is doing an |
1232 | * execve */ | 1244 | * execve */ |
1233 | unsigned in_iowait:1; | 1245 | unsigned in_iowait:1; |
@@ -1271,6 +1283,7 @@ struct task_struct { | |||
1271 | /* PID/PID hash table linkage. */ | 1283 | /* PID/PID hash table linkage. */ |
1272 | struct pid_link pids[PIDTYPE_MAX]; | 1284 | struct pid_link pids[PIDTYPE_MAX]; |
1273 | struct list_head thread_group; | 1285 | struct list_head thread_group; |
1286 | struct list_head thread_node; | ||
1274 | 1287 | ||
1275 | struct completion *vfork_done; /* for vfork() */ | 1288 | struct completion *vfork_done; /* for vfork() */ |
1276 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ | 1289 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ |
@@ -2282,8 +2295,6 @@ extern struct mm_struct *get_task_mm(struct task_struct *task); | |||
2282 | extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode); | 2295 | extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode); |
2283 | /* Remove the current tasks stale references to the old mm_struct */ | 2296 | /* Remove the current tasks stale references to the old mm_struct */ |
2284 | extern void mm_release(struct task_struct *, struct mm_struct *); | 2297 | extern void mm_release(struct task_struct *, struct mm_struct *); |
2285 | /* Allocate a new mm structure and copy contents from tsk->mm */ | ||
2286 | extern struct mm_struct *dup_mm(struct task_struct *tsk); | ||
2287 | 2298 | ||
2288 | extern int copy_thread(unsigned long, unsigned long, unsigned long, | 2299 | extern int copy_thread(unsigned long, unsigned long, unsigned long, |
2289 | struct task_struct *); | 2300 | struct task_struct *); |
@@ -2301,7 +2312,7 @@ extern void do_group_exit(int); | |||
2301 | extern int allow_signal(int); | 2312 | extern int allow_signal(int); |
2302 | extern int disallow_signal(int); | 2313 | extern int disallow_signal(int); |
2303 | 2314 | ||
2304 | extern int do_execve(const char *, | 2315 | extern int do_execve(struct filename *, |
2305 | const char __user * const __user *, | 2316 | const char __user * const __user *, |
2306 | const char __user * const __user *); | 2317 | const char __user * const __user *); |
2307 | extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); | 2318 | extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); |
@@ -2341,6 +2352,16 @@ extern bool current_is_single_threaded(void); | |||
2341 | #define while_each_thread(g, t) \ | 2352 | #define while_each_thread(g, t) \ |
2342 | while ((t = next_thread(t)) != g) | 2353 | while ((t = next_thread(t)) != g) |
2343 | 2354 | ||
2355 | #define __for_each_thread(signal, t) \ | ||
2356 | list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node) | ||
2357 | |||
2358 | #define for_each_thread(p, t) \ | ||
2359 | __for_each_thread((p)->signal, t) | ||
2360 | |||
2361 | /* Careful: this is a double loop, 'break' won't work as expected. */ | ||
2362 | #define for_each_process_thread(p, t) \ | ||
2363 | for_each_process(p) for_each_thread(p, t) | ||
2364 | |||
2344 | static inline int get_nr_threads(struct task_struct *tsk) | 2365 | static inline int get_nr_threads(struct task_struct *tsk) |
2345 | { | 2366 | { |
2346 | return tsk->signal->nr_threads; | 2367 | return tsk->signal->nr_threads; |