With the introduction of clone3 in commit 7f192e3cd316 ("fork: add clone3") the effective bit width of clone_flags on all architectures was increased from 32-bit to 64-bit, with a new type of u64 for the flags. However, for most consumers of clone_flags the interface was not changed from the previous type of unsigned long. While this works fine as long as none of the new 64-bit flag bits (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still undesirable in terms of the principle of least surprise. Thus, this commit fixes all relevant interfaces of callees to sys_clone3/copy_process (excluding the architecture-specific copy_thread) to consistently pass clone_flags as u64, so that no truncation to 32-bit integers occurs on 32-bit architectures.
Unified · Split
| @@ -286,7 +286,7 @@ out: · 285 unmodified lines | |||
| 286 | } | 286 | } |
| 287 | EXPORT_SYMBOL_GPL(set_task_ioprio); | 287 | EXPORT_SYMBOL_GPL(set_task_ioprio); |
| 288 | 288 | ||
| 289 | int __copy_io(unsigned long clone_flags, struct task_struct *tsk) | 289 | int __copy_io(u64 clone_flags, struct task_struct *tsk) |
| 290 | { | 290 | { |
| 291 | struct io_context *ioc = current->io_context; | 291 | struct io_context *ioc = current->io_context; |
| 292 | 292 | ||
| @@ -4200,7 +4200,7 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool a · 4199 unmodified lines | |||
| 4200 | } | 4200 | } |
| 4201 | 4201 | ||
| 4202 | __latent_entropy | 4202 | __latent_entropy |
| 4203 | struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns, | 4203 | struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns, |
| 4204 | struct user_namespace *user_ns, struct fs_struct *new_fs) | 4204 | struct user_namespace *user_ns, struct fs_struct *new_fs) |
| 4205 | { | 4205 | { |
| 4206 | struct mnt_namespace *new_ns; | 4206 | struct mnt_namespace *new_ns; |
| @@ -796,7 +796,7 @@ extern struct cgroup_namespace init_cgroup_ns; · 795 unmodified lines | |||
| 796 | 796 | ||
| 797 | void free_cgroup_ns(struct cgroup_namespace *ns); | 797 | void free_cgroup_ns(struct cgroup_namespace *ns); |
| 798 | 798 | ||
| 799 | struct cgroup_namespace *copy_cgroup_ns(unsigned long flags, | 799 | struct cgroup_namespace *copy_cgroup_ns(u64 flags, |
| 800 | struct user_namespace *user_ns, | 800 | struct user_namespace *user_ns, |
| 801 | struct cgroup_namespace *old_ns); | 801 | struct cgroup_namespace *old_ns); |
| 802 | 802 | ||
| @@ -818,7 +818,7 @@ static inline void put_cgroup_ns(struct cgroup_namespace *ns) · 15 unmodified lines | |||
| 818 | 818 | ||
| 819 | static inline void free_cgroup_ns(struct cgroup_namespace *ns) { } | 819 | static inline void free_cgroup_ns(struct cgroup_namespace *ns) { } |
| 820 | static inline struct cgroup_namespace * | 820 | static inline struct cgroup_namespace * |
| 821 | copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns, | 821 | copy_cgroup_ns(u64 flags, struct user_namespace *user_ns, |
| 822 | struct cgroup_namespace *old_ns) | 822 | struct cgroup_namespace *old_ns) |
| 823 | { | 823 | { |
| 824 | return old_ns; | 824 | return old_ns; |
| @@ -148,7 +148,7 @@ struct cred { · 147 unmodified lines | |||
| 148 | 148 | ||
| 149 | extern void __put_cred(struct cred *); | 149 | extern void __put_cred(struct cred *); |
| 150 | extern void exit_creds(struct task_struct *); | 150 | extern void exit_creds(struct task_struct *); |
| 151 | extern int copy_creds(struct task_struct *, unsigned long); | 151 | extern int copy_creds(struct task_struct *, u64); |
| 152 | extern const struct cred *get_task_cred(struct task_struct *); | 152 | extern const struct cred *get_task_cred(struct task_struct *); |
| 153 | extern struct cred *cred_alloc_blank(void); | 153 | extern struct cred *cred_alloc_blank(void); |
| 154 | extern struct cred *prepare_creds(void); | 154 | extern struct cred *prepare_creds(void); |
| @@ -118,8 +118,8 @@ struct task_struct; · 117 unmodified lines | |||
| 118 | #ifdef CONFIG_BLOCK | 118 | #ifdef CONFIG_BLOCK |
| 119 | void put_io_context(struct io_context *ioc); | 119 | void put_io_context(struct io_context *ioc); |
| 120 | void exit_io_context(struct task_struct *task); | 120 | void exit_io_context(struct task_struct *task); |
| 121 | int __copy_io(unsigned long clone_flags, struct task_struct *tsk); | 121 | int __copy_io(u64 clone_flags, struct task_struct *tsk); |
| 122 | static inline int copy_io(unsigned long clone_flags, struct task_struct *tsk) | 122 | static inline int copy_io(u64 clone_flags, struct task_struct *tsk) |
| 123 | { | 123 | { |
| 124 | if (!current->io_context) | 124 | if (!current->io_context) |
| 125 | return 0; | 125 | return 0; |
| @@ -129,7 +129,7 @@ static inline int copy_io(unsigned long clone_flags, struct task_struct *tsk) · 3 unmodified lines | |||
| 129 | struct io_context; | 129 | struct io_context; |
| 130 | static inline void put_io_context(struct io_context *ioc) { } | 130 | static inline void put_io_context(struct io_context *ioc) { } |
| 131 | static inline void exit_io_context(struct task_struct *task) { } | 131 | static inline void exit_io_context(struct task_struct *task) { } |
| 132 | static inline int copy_io(unsigned long clone_flags, struct task_struct *tsk) | 132 | static inline int copy_io(u64 clone_flags, struct task_struct *tsk) |
| 133 | { | 133 | { |
| 134 | return 0; | 134 | return 0; |
| 135 | } | 135 | } |
| @@ -129,7 +129,7 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; } · 128 unmodified lines | |||
| 129 | #endif | 129 | #endif |
| 130 | 130 | ||
| 131 | #if defined(CONFIG_IPC_NS) | 131 | #if defined(CONFIG_IPC_NS) |
| 132 | extern struct ipc_namespace *copy_ipcs(unsigned long flags, | 132 | extern struct ipc_namespace *copy_ipcs(u64 flags, |
| 133 | struct user_namespace *user_ns, struct ipc_namespace *ns); | 133 | struct user_namespace *user_ns, struct ipc_namespace *ns); |
| 134 | 134 | ||
| 135 | static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) | 135 | static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) |
| @@ -151,7 +151,7 @@ static inline struct ipc_namespace *get_ipc_ns_not_zero(struct ipc_namespace *ns · 15 unmodified lines | |||
| 151 | 151 | ||
| 152 | extern void put_ipc_ns(struct ipc_namespace *ns); | 152 | extern void put_ipc_ns(struct ipc_namespace *ns); |
| 153 | #else | 153 | #else |
| 154 | static inline struct ipc_namespace *copy_ipcs(unsigned long flags, | 154 | static inline struct ipc_namespace *copy_ipcs(u64 flags, |
| 155 | struct user_namespace *user_ns, struct ipc_namespace *ns) | 155 | struct user_namespace *user_ns, struct ipc_namespace *ns) |
| 156 | { | 156 | { |
| 157 | if (flags & CLONE_NEWIPC) | 157 | if (flags & CLONE_NEWIPC) |
| @@ -211,7 +211,7 @@ LSM_HOOK(int, 0, file_open, struct file *file) · 210 unmodified lines | |||
| 211 | LSM_HOOK(int, 0, file_post_open, struct file *file, int mask) | 211 | LSM_HOOK(int, 0, file_post_open, struct file *file, int mask) |
| 212 | LSM_HOOK(int, 0, file_truncate, struct file *file) | 212 | LSM_HOOK(int, 0, file_truncate, struct file *file) |
| 213 | LSM_HOOK(int, 0, task_alloc, struct task_struct *task, | 213 | LSM_HOOK(int, 0, task_alloc, struct task_struct *task, |
| 214 | unsigned long clone_flags) | 214 | u64 clone_flags) |
| 215 | LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task) | 215 | LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task) |
| 216 | LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp) | 216 | LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp) |
| 217 | LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred) | 217 | LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred) |
| @@ -11,7 +11,7 @@ struct fs_struct; · 10 unmodified lines | |||
| 11 | struct user_namespace; | 11 | struct user_namespace; |
| 12 | struct ns_common; | 12 | struct ns_common; |
| 13 | 13 | ||
| 14 | extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, | 14 | extern struct mnt_namespace *copy_mnt_ns(u64, struct mnt_namespace *, |
| 15 | struct user_namespace *, struct fs_struct *); | 15 | struct user_namespace *, struct fs_struct *); |
| 16 | extern void put_mnt_ns(struct mnt_namespace *ns); | 16 | extern void put_mnt_ns(struct mnt_namespace *ns); |
| 17 | DEFINE_FREE(put_mnt_ns, struct mnt_namespace *, if (!IS_ERR_OR_NULL(_T)) put_mnt_ns(_T)) | 17 | DEFINE_FREE(put_mnt_ns, struct mnt_namespace *, if (!IS_ERR_OR_NULL(_T)) put_mnt_ns(_T)) |
| @@ -103,7 +103,7 @@ static inline struct cred *nsset_cred(struct nsset *set) · 102 unmodified lines | |||
| 103 | * | 103 | * |
| 104 | */ | 104 | */ |
| 105 | 105 | ||
| 106 | int copy_namespaces(unsigned long flags, struct task_struct *tsk); | 106 | int copy_namespaces(u64 flags, struct task_struct *tsk); |
| 107 | void exit_task_namespaces(struct task_struct *tsk); | 107 | void exit_task_namespaces(struct task_struct *tsk); |
| 108 | void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new); | 108 | void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new); |
| 109 | int exec_task_namespaces(void); | 109 | int exec_task_namespaces(void); |
| @@ -78,7 +78,7 @@ static inline int pidns_memfd_noexec_scope(struct pid_namespace *ns) · 77 unmodified lines | |||
| 78 | } | 78 | } |
| 79 | #endif | 79 | #endif |
| 80 | 80 | ||
| 81 | extern struct pid_namespace *copy_pid_ns(unsigned long flags, | 81 | extern struct pid_namespace *copy_pid_ns(u64 flags, |
| 82 | struct user_namespace *user_ns, struct pid_namespace *ns); | 82 | struct user_namespace *user_ns, struct pid_namespace *ns); |
| 83 | extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); | 83 | extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); |
| 84 | extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); | 84 | extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); |
| @@ -97,7 +97,7 @@ static inline int pidns_memfd_noexec_scope(struct pid_namespace *ns) · 12 unmodified lines | |||
| 97 | return 0; | 97 | return 0; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | static inline struct pid_namespace *copy_pid_ns(unsigned long flags, | 100 | static inline struct pid_namespace *copy_pid_ns(u64 flags, |
| 101 | struct user_namespace *user_ns, struct pid_namespace *ns) | 101 | struct user_namespace *user_ns, struct pid_namespace *ns) |
| 102 | { | 102 | { |
| 103 | if (flags & CLONE_NEWPID) | 103 | if (flags & CLONE_NEWPID) |
| @@ -65,7 +65,7 @@ static inline void rseq_migrate(struct task_struct *t) · 64 unmodified lines | |||
| 65 | * If parent process has a registered restartable sequences area, the | 65 | * If parent process has a registered restartable sequences area, the |
| 66 | * child inherits. Unregister rseq for a clone with CLONE_VM set. | 66 | * child inherits. Unregister rseq for a clone with CLONE_VM set. |
| 67 | */ | 67 | */ |
| 68 | static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) | 68 | static inline void rseq_fork(struct task_struct *t, u64 clone_flags) |
| 69 | { | 69 | { |
| 70 | if (clone_flags & CLONE_VM) { | 70 | if (clone_flags & CLONE_VM) { |
| 71 | t->rseq = NULL; | 71 | t->rseq = NULL; |
| @@ -107,7 +107,7 @@ static inline void rseq_preempt(struct task_struct *t) · 35 unmodified lines | |||
| 107 | static inline void rseq_migrate(struct task_struct *t) | 107 | static inline void rseq_migrate(struct task_struct *t) |
| 108 | { | 108 | { |
| 109 | } | 109 | } |
| 110 | static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) | 110 | static inline void rseq_fork(struct task_struct *t, u64 clone_flags) |
| 111 | { | 111 | { |
| 112 | } | 112 | } |
| 113 | static inline void rseq_execve(struct task_struct *t) | 113 | static inline void rseq_execve(struct task_struct *t) |
| @@ -63,7 +63,7 @@ extern int lockdep_tasklist_lock_is_held(void); · 62 unmodified lines | |||
| 63 | extern asmlinkage void schedule_tail(struct task_struct *prev); | 63 | extern asmlinkage void schedule_tail(struct task_struct *prev); |
| 64 | extern void init_idle(struct task_struct *idle, int cpu); | 64 | extern void init_idle(struct task_struct *idle, int cpu); |
| 65 | 65 | ||
| 66 | extern int sched_fork(unsigned long clone_flags, struct task_struct *p); | 66 | extern int sched_fork(u64 clone_flags, struct task_struct *p); |
| 67 | extern int sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs); | 67 | extern int sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs); |
| 68 | extern void sched_cancel_fork(struct task_struct *p); | 68 | extern void sched_cancel_fork(struct task_struct *p); |
| 69 | extern void sched_post_fork(struct task_struct *p); | 69 | extern void sched_post_fork(struct task_struct *p); |
| @@ -489,7 +489,7 @@ int security_file_receive(struct file *file); · 488 unmodified lines | |||
| 489 | int security_file_open(struct file *file); | 489 | int security_file_open(struct file *file); |
| 490 | int security_file_post_open(struct file *file, int mask); | 490 | int security_file_post_open(struct file *file, int mask); |
| 491 | int security_file_truncate(struct file *file); | 491 | int security_file_truncate(struct file *file); |
| 492 | int security_task_alloc(struct task_struct *task, unsigned long clone_flags); | 492 | int security_task_alloc(struct task_struct *task, u64 clone_flags); |
| 493 | void security_task_free(struct task_struct *task); | 493 | void security_task_free(struct task_struct *task); |
| 494 | int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); | 494 | int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); |
| 495 | void security_cred_free(struct cred *cred); | 495 | void security_cred_free(struct cred *cred); |
| @@ -1215,7 +1215,7 @@ static inline int security_file_truncate(struct file *file) · 719 unmodified lines | |||
| 1215 | } | 1215 | } |
| 1216 | 1216 | ||
| 1217 | static inline int security_task_alloc(struct task_struct *task, | 1217 | static inline int security_task_alloc(struct task_struct *task, |
| 1218 | unsigned long clone_flags) | 1218 | u64 clone_flags) |
| 1219 | { | 1219 | { |
| 1220 | return 0; | 1220 | return 0; |
| 1221 | } | 1221 | } |
| @@ -9,12 +9,12 @@ struct task_struct; · 8 unmodified lines | |||
| 9 | 9 | ||
| 10 | #ifdef CONFIG_SYSVIPC | 10 | #ifdef CONFIG_SYSVIPC |
| 11 | 11 | ||
| 12 | extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk); | 12 | extern int copy_semundo(u64 clone_flags, struct task_struct *tsk); |
| 13 | extern void exit_sem(struct task_struct *tsk); | 13 | extern void exit_sem(struct task_struct *tsk); |
| 14 | 14 | ||
| 15 | #else | 15 | #else |
| 16 | 16 | ||
| 17 | static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk) | 17 | static inline int copy_semundo(u64 clone_flags, struct task_struct *tsk) |
| 18 | { | 18 | { |
| 19 | return 0; | 19 | return 0; |
| 20 | } | 20 | } |
| @@ -43,7 +43,7 @@ static inline struct time_namespace *get_time_ns(struct time_namespace *ns) · 42 unmodified lines | |||
| 43 | return ns; | 43 | return ns; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | struct time_namespace *copy_time_ns(unsigned long flags, | 46 | struct time_namespace *copy_time_ns(u64 flags, |
| 47 | struct user_namespace *user_ns, | 47 | struct user_namespace *user_ns, |
| 48 | struct time_namespace *old_ns); | 48 | struct time_namespace *old_ns); |
| 49 | void free_time_ns(struct time_namespace *ns); | 49 | void free_time_ns(struct time_namespace *ns); |
| @@ -129,7 +129,7 @@ static inline void put_time_ns(struct time_namespace *ns) · 79 unmodified lines | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | static inline | 131 | static inline |
| 132 | struct time_namespace *copy_time_ns(unsigned long flags, | 132 | struct time_namespace *copy_time_ns(u64 flags, |
| 133 | struct user_namespace *user_ns, | 133 | struct user_namespace *user_ns, |
| 134 | struct time_namespace *old_ns) | 134 | struct time_namespace *old_ns) |
| 135 | { | 135 | { |
| @@ -205,7 +205,7 @@ extern void uprobe_start_dup_mmap(void); · 204 unmodified lines | |||
| 205 | extern void uprobe_end_dup_mmap(void); | 205 | extern void uprobe_end_dup_mmap(void); |
| 206 | extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); | 206 | extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); |
| 207 | extern void uprobe_free_utask(struct task_struct *t); | 207 | extern void uprobe_free_utask(struct task_struct *t); |
| 208 | extern void uprobe_copy_process(struct task_struct *t, unsigned long flags); | 208 | extern void uprobe_copy_process(struct task_struct *t, u64 flags); |
| 209 | extern int uprobe_post_sstep_notifier(struct pt_regs *regs); | 209 | extern int uprobe_post_sstep_notifier(struct pt_regs *regs); |
| 210 | extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); | 210 | extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); |
| 211 | extern void uprobe_notify_resume(struct pt_regs *regs); | 211 | extern void uprobe_notify_resume(struct pt_regs *regs); |
| @@ -281,7 +281,7 @@ static inline bool uprobe_deny_signal(void) · 69 unmodified lines | |||
| 281 | static inline void uprobe_free_utask(struct task_struct *t) | 281 | static inline void uprobe_free_utask(struct task_struct *t) |
| 282 | { | 282 | { |
| 283 | } | 283 | } |
| 284 | static inline void uprobe_copy_process(struct task_struct *t, unsigned long flags) | 284 | static inline void uprobe_copy_process(struct task_struct *t, u64 flags) |
| 285 | { | 285 | { |
| 286 | } | 286 | } |
| 287 | static inline void uprobe_clear_state(struct mm_struct *mm) | 287 | static inline void uprobe_clear_state(struct mm_struct *mm) |
| @@ -33,7 +33,7 @@ extern void user_event_mm_dup(struct task_struct *t, · 32 unmodified lines | |||
| 33 | extern void user_event_mm_remove(struct task_struct *t); | 33 | extern void user_event_mm_remove(struct task_struct *t); |
| 34 | 34 | ||
| 35 | static inline void user_events_fork(struct task_struct *t, | 35 | static inline void user_events_fork(struct task_struct *t, |
| 36 | unsigned long clone_flags) | 36 | u64 clone_flags) |
| 37 | { | 37 | { |
| 38 | struct user_event_mm *old_mm; | 38 | struct user_event_mm *old_mm; |
| 39 | 39 | ||
| @@ -68,7 +68,7 @@ static inline void user_events_exit(struct task_struct *t) · 28 unmodified lines | |||
| 68 | } | 68 | } |
| 69 | #else | 69 | #else |
| 70 | static inline void user_events_fork(struct task_struct *t, | 70 | static inline void user_events_fork(struct task_struct *t, |
| 71 | unsigned long clone_flags) | 71 | u64 clone_flags) |
| 72 | { | 72 | { |
| 73 | } | 73 | } |
| 74 | 74 | ||
| @@ -35,7 +35,7 @@ static inline void get_uts_ns(struct uts_namespace *ns) · 34 unmodified lines | |||
| 35 | refcount_inc(&ns->ns.count); | 35 | refcount_inc(&ns->ns.count); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | extern struct uts_namespace *copy_utsname(unsigned long flags, | 38 | extern struct uts_namespace *copy_utsname(u64 flags, |
| 39 | struct user_namespace *user_ns, struct uts_namespace *old_ns); | 39 | struct user_namespace *user_ns, struct uts_namespace *old_ns); |
| 40 | extern void free_uts_ns(struct uts_namespace *ns); | 40 | extern void free_uts_ns(struct uts_namespace *ns); |
| 41 | 41 | ||
| @@ -55,7 +55,7 @@ static inline void put_uts_ns(struct uts_namespace *ns) · 13 unmodified lines | |||
| 55 | { | 55 | { |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | static inline struct uts_namespace *copy_utsname(unsigned long flags, | 58 | static inline struct uts_namespace *copy_utsname(u64 flags, |
| 59 | struct user_namespace *user_ns, struct uts_namespace *old_ns) | 59 | struct user_namespace *user_ns, struct uts_namespace *old_ns) |
| 60 | { | 60 | { |
| 61 | if (flags & CLONE_NEWUTS) | 61 | if (flags & CLONE_NEWUTS) |
| @@ -204,7 +204,7 @@ struct net { · 203 unmodified lines | |||
| 204 | extern struct net init_net; | 204 | extern struct net init_net; |
| 205 | 205 | ||
| 206 | #ifdef CONFIG_NET_NS | 206 | #ifdef CONFIG_NET_NS |
| 207 | struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns, | 207 | struct net *copy_net_ns(u64 flags, struct user_namespace *user_ns, |
| 208 | struct net *old_net); | 208 | struct net *old_net); |
| 209 | 209 | ||
| 210 | void net_ns_get_ownership(const struct net *net, kuid_t *uid, kgid_t *gid); | 210 | void net_ns_get_ownership(const struct net *net, kuid_t *uid, kgid_t *gid); |
| @@ -218,7 +218,7 @@ extern struct task_struct *cleanup_net_task; · 7 unmodified lines | |||
| 218 | #else /* CONFIG_NET_NS */ | 218 | #else /* CONFIG_NET_NS */ |
| 219 | #include <linux/sched.h> | 219 | #include <linux/sched.h> |
| 220 | #include <linux/nsproxy.h> | 220 | #include <linux/nsproxy.h> |
| 221 | static inline struct net *copy_net_ns(unsigned long flags, | 221 | static inline struct net *copy_net_ns(u64 flags, |
| 222 | struct user_namespace *user_ns, struct net *old_net) | 222 | struct user_namespace *user_ns, struct net *old_net) |
| 223 | { | 223 | { |
| 224 | if (flags & CLONE_NEWNET) | 224 | if (flags & CLONE_NEWNET) |
| @@ -8,14 +8,14 @@ · 7 unmodified lines | |||
| 8 | 8 | ||
| 9 | TRACE_EVENT(task_newtask, | 9 | TRACE_EVENT(task_newtask, |
| 10 | 10 | ||
| 11 | TP_PROTO(struct task_struct *task, unsigned long clone_flags), | 11 | TP_PROTO(struct task_struct *task, u64 clone_flags), |
| 12 | 12 | ||
| 13 | TP_ARGS(task, clone_flags), | 13 | TP_ARGS(task, clone_flags), |
| 14 | 14 | ||
| 15 | TP_STRUCT__entry( | 15 | TP_STRUCT__entry( |
| 16 | __field( pid_t, pid) | 16 | __field( pid_t, pid) |
| 17 | __array( char, comm, TASK_COMM_LEN) | 17 | __array( char, comm, TASK_COMM_LEN) |
| 18 | __field( unsigned long, clone_flags) | 18 | __field( u64, clone_flags) |
| 19 | __field( short, oom_score_adj) | 19 | __field( short, oom_score_adj) |
| 20 | ), | 20 | ), |
| 21 | 21 | ||
| @@ -26,7 +26,7 @@ TRACE_EVENT(task_newtask, · 4 unmodified lines | |||
| 26 | __entry->oom_score_adj = task->signal->oom_score_adj; | 26 | __entry->oom_score_adj = task->signal->oom_score_adj; |
| 27 | ), | 27 | ), |
| 28 | 28 | ||
| 29 | TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%hd", | 29 | TP_printk("pid=%d comm=%s clone_flags=%llx oom_score_adj=%hd", |
| 30 | __entry->pid, __entry->comm, | 30 | __entry->pid, __entry->comm, |
| 31 | __entry->clone_flags, __entry->oom_score_adj) | 31 | __entry->clone_flags, __entry->oom_score_adj) |
| 32 | ); | 32 | ); |
| @@ -106,7 +106,7 @@ fail: · 105 unmodified lines | |||
| 106 | return ERR_PTR(err); | 106 | return ERR_PTR(err); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | struct ipc_namespace *copy_ipcs(unsigned long flags, | 109 | struct ipc_namespace *copy_ipcs(u64 flags, |
| 110 | struct user_namespace *user_ns, struct ipc_namespace *ns) | 110 | struct user_namespace *user_ns, struct ipc_namespace *ns) |
| 111 | { | 111 | { |
| 112 | if (!(flags & CLONE_NEWIPC)) | 112 | if (!(flags & CLONE_NEWIPC)) |
| @@ -2303,7 +2303,7 @@ SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops, · 2302 unmodified lines | |||
| 2303 | * parent and child tasks. | 2303 | * parent and child tasks. |
| 2304 | */ | 2304 | */ |
| 2305 | 2305 | ||
| 2306 | int copy_semundo(unsigned long clone_flags, struct task_struct *tsk) | 2306 | int copy_semundo(u64 clone_flags, struct task_struct *tsk) |
| 2307 | { | 2307 | { |
| 2308 | struct sem_undo_list *undo_list; | 2308 | struct sem_undo_list *undo_list; |
| 2309 | int error; | 2309 | int error; |
| @@ -47,7 +47,7 @@ void free_cgroup_ns(struct cgroup_namespace *ns) · 46 unmodified lines | |||
| 47 | } | 47 | } |
| 48 | EXPORT_SYMBOL(free_cgroup_ns); | 48 | EXPORT_SYMBOL(free_cgroup_ns); |
| 49 | 49 | ||
| 50 | struct cgroup_namespace *copy_cgroup_ns(unsigned long flags, | 50 | struct cgroup_namespace *copy_cgroup_ns(u64 flags, |
| 51 | struct user_namespace *user_ns, | 51 | struct user_namespace *user_ns, |
| 52 | struct cgroup_namespace *old_ns) | 52 | struct cgroup_namespace *old_ns) |
| 53 | { | 53 | { |
| @@ -287,7 +287,7 @@ struct cred *prepare_exec_creds(void) · 286 unmodified lines | |||
| 287 | * The new process gets the current process's subjective credentials as its | 287 | * The new process gets the current process's subjective credentials as its |
| 288 | * objective and subjective credentials | 288 | * objective and subjective credentials |
| 289 | */ | 289 | */ |
| 290 | int copy_creds(struct task_struct *p, unsigned long clone_flags) | 290 | int copy_creds(struct task_struct *p, u64 clone_flags) |
| 291 | { | 291 | { |
| 292 | struct cred *new; | 292 | struct cred *new; |
| 293 | int ret; | 293 | int ret; |
| @@ -2160,7 +2160,7 @@ static void dup_xol_work(struct callback_head *work) · 2159 unmodified lines | |||
| 2160 | /* | 2160 | /* |
| 2161 | * Called in context of a new clone/fork from copy_process. | 2161 | * Called in context of a new clone/fork from copy_process. |
| 2162 | */ | 2162 | */ |
| 2163 | void uprobe_copy_process(struct task_struct *t, unsigned long flags) | 2163 | void uprobe_copy_process(struct task_struct *t, u64 flags) |
| 2164 | { | 2164 | { |
| 2165 | struct uprobe_task *utask = current->utask; | 2165 | struct uprobe_task *utask = current->utask; |
| 2166 | struct mm_struct *mm = current->mm; | 2166 | struct mm_struct *mm = current->mm; |
| @@ -1507,7 +1507,7 @@ fail_nomem: · 1506 unmodified lines | |||
| 1507 | return NULL; | 1507 | return NULL; |
| 1508 | } | 1508 | } |
| 1509 | 1509 | ||
| 1510 | static int copy_mm(unsigned long clone_flags, struct task_struct *tsk) | 1510 | static int copy_mm(u64 clone_flags, struct task_struct *tsk) |
| 1511 | { | 1511 | { |
| 1512 | struct mm_struct *mm, *oldmm; | 1512 | struct mm_struct *mm, *oldmm; |
| 1513 | 1513 | ||
| @@ -1545,7 +1545,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk) · 31 unmodified lines | |||
| 1545 | return 0; | 1545 | return 0; |
| 1546 | } | 1546 | } |
| 1547 | 1547 | ||
| 1548 | static int copy_fs(unsigned long clone_flags, struct task_struct *tsk) | 1548 | static int copy_fs(u64 clone_flags, struct task_struct *tsk) |
| 1549 | { | 1549 | { |
| 1550 | struct fs_struct *fs = current->fs; | 1550 | struct fs_struct *fs = current->fs; |
| 1551 | if (clone_flags & CLONE_FS) { | 1551 | if (clone_flags & CLONE_FS) { |
| @@ -1566,7 +1566,7 @@ static int copy_fs(unsigned long clone_flags, struct task_struct *tsk) · 14 unmodified lines | |||
| 1566 | return 0; | 1566 | return 0; |
| 1567 | } | 1567 | } |
| 1568 | 1568 | ||
| 1569 | static int copy_files(unsigned long clone_flags, struct task_struct *tsk, | 1569 | static int copy_files(u64 clone_flags, struct task_struct *tsk, |
| 1570 | int no_files) | 1570 | int no_files) |
| 1571 | { | 1571 | { |
| 1572 | struct files_struct *oldf, *newf; | 1572 | struct files_struct *oldf, *newf; |
| @@ -1645,7 +1645,7 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig) · 72 unmodified lines | |||
| 1645 | posix_cputimers_group_init(pct, cpu_limit); | 1645 | posix_cputimers_group_init(pct, cpu_limit); |
| 1646 | } | 1646 | } |
| 1647 | 1647 | ||
| 1648 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | 1648 | static int copy_signal(u64 clone_flags, struct task_struct *tsk) |
| 1649 | { | 1649 | { |
| 1650 | struct signal_struct *sig; | 1650 | struct signal_struct *sig; |
| 1651 | 1651 | ||
| @@ -64,7 +64,7 @@ static inline struct nsproxy *create_nsproxy(void) · 63 unmodified lines | |||
| 64 | * Return the newly created nsproxy. Do not attach this to the task, | 64 | * Return the newly created nsproxy. Do not attach this to the task, |
| 65 | * leave it to the caller to do proper locking and attach it to task. | 65 | * leave it to the caller to do proper locking and attach it to task. |
| 66 | */ | 66 | */ |
| 67 | static struct nsproxy *create_new_namespaces(unsigned long flags, | 67 | static struct nsproxy *create_new_namespaces(u64 flags, |
| 68 | struct task_struct *tsk, struct user_namespace *user_ns, | 68 | struct task_struct *tsk, struct user_namespace *user_ns, |
| 69 | struct fs_struct *new_fs) | 69 | struct fs_struct *new_fs) |
| 70 | { | 70 | { |
| @@ -144,7 +144,7 @@ out_ns: · 73 unmodified lines | |||
| 144 | * called from clone. This now handles copy for nsproxy and all | 144 | * called from clone. This now handles copy for nsproxy and all |
| 145 | * namespaces therein. | 145 | * namespaces therein. |
| 146 | */ | 146 | */ |
| 147 | int copy_namespaces(unsigned long flags, struct task_struct *tsk) | 147 | int copy_namespaces(u64 flags, struct task_struct *tsk) |
| 148 | { | 148 | { |
| 149 | struct nsproxy *old_ns = tsk->nsproxy; | 149 | struct nsproxy *old_ns = tsk->nsproxy; |
| 150 | struct user_namespace *user_ns = task_cred_xxx(tsk, user_ns); | 150 | struct user_namespace *user_ns = task_cred_xxx(tsk, user_ns); |
| @@ -171,7 +171,7 @@ static void destroy_pid_namespace_work(struct work_struct *work) · 170 unmodified lines | |||
| 171 | } while (ns != &init_pid_ns && refcount_dec_and_test(&ns->ns.count)); | 171 | } while (ns != &init_pid_ns && refcount_dec_and_test(&ns->ns.count)); |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | struct pid_namespace *copy_pid_ns(unsigned long flags, | 174 | struct pid_namespace *copy_pid_ns(u64 flags, |
| 175 | struct user_namespace *user_ns, struct pid_namespace *old_ns) | 175 | struct user_namespace *user_ns, struct pid_namespace *old_ns) |
| 176 | { | 176 | { |
| 177 | if (!(flags & CLONE_NEWPID)) | 177 | if (!(flags & CLONE_NEWPID)) |
| @@ -4472,7 +4472,7 @@ int wake_up_state(struct task_struct *p, unsigned int state) · 4471 unmodified lines | |||
| 4472 | * __sched_fork() is basic setup which is also used by sched_init() to | 4472 | * __sched_fork() is basic setup which is also used by sched_init() to |
| 4473 | * initialize the boot CPU's idle task. | 4473 | * initialize the boot CPU's idle task. |
| 4474 | */ | 4474 | */ |
| 4475 | static void __sched_fork(unsigned long clone_flags, struct task_struct *p) | 4475 | static void __sched_fork(u64 clone_flags, struct task_struct *p) |
| 4476 | { | 4476 | { |
| 4477 | p->on_rq = 0; | 4477 | p->on_rq = 0; |
| 4478 | 4478 | ||
| @@ -4707,7 +4707,7 @@ late_initcall(sched_core_sysctl_init); · 228 unmodified lines | |||
| 4707 | /* | 4707 | /* |
| 4708 | * fork()/clone()-time setup: | 4708 | * fork()/clone()-time setup: |
| 4709 | */ | 4709 | */ |
| 4710 | int sched_fork(unsigned long clone_flags, struct task_struct *p) | 4710 | int sched_fork(u64 clone_flags, struct task_struct *p) |
| 4711 | { | 4711 | { |
| 4712 | __sched_fork(clone_flags, p); | 4712 | __sched_fork(clone_flags, p); |
| 4713 | /* | 4713 | /* |
| @@ -3542,7 +3542,7 @@ out: · 3541 unmodified lines | |||
| 3542 | } | 3542 | } |
| 3543 | } | 3543 | } |
| 3544 | 3544 | ||
| 3545 | void init_numa_balancing(unsigned long clone_flags, struct task_struct *p) | 3545 | void init_numa_balancing(u64 clone_flags, struct task_struct *p) |
| 3546 | { | 3546 | { |
| 3547 | int mm_users = 0; | 3547 | int mm_users = 0; |
| 3548 | struct mm_struct *mm = p->mm; | 3548 | struct mm_struct *mm = p->mm; |
| @@ -1935,12 +1935,12 @@ extern void sched_setnuma(struct task_struct *p, int node); · 1934 unmodified lines | |||
| 1935 | extern int migrate_task_to(struct task_struct *p, int cpu); | 1935 | extern int migrate_task_to(struct task_struct *p, int cpu); |
| 1936 | extern int migrate_swap(struct task_struct *p, struct task_struct *t, | 1936 | extern int migrate_swap(struct task_struct *p, struct task_struct *t, |
| 1937 | int cpu, int scpu); | 1937 | int cpu, int scpu); |
| 1938 | extern void init_numa_balancing(unsigned long clone_flags, struct task_struct *p); | 1938 | extern void init_numa_balancing(u64 clone_flags, struct task_struct *p); |
| 1939 | 1939 | ||
| 1940 | #else /* !CONFIG_NUMA_BALANCING: */ | 1940 | #else /* !CONFIG_NUMA_BALANCING: */ |
| 1941 | 1941 | ||
| 1942 | static inline void | 1942 | static inline void |
| 1943 | init_numa_balancing(unsigned long clone_flags, struct task_struct *p) | 1943 | init_numa_balancing(u64 clone_flags, struct task_struct *p) |
| 1944 | { | 1944 | { |
| 1945 | } | 1945 | } |
| 1946 | 1946 | ||
| @@ -130,7 +130,7 @@ fail: · 129 unmodified lines | |||
| 130 | * | 130 | * |
| 131 | * Return: timens_for_children namespace or ERR_PTR. | 131 | * Return: timens_for_children namespace or ERR_PTR. |
| 132 | */ | 132 | */ |
| 133 | struct time_namespace *copy_time_ns(unsigned long flags, | 133 | struct time_namespace *copy_time_ns(u64 flags, |
| 134 | struct user_namespace *user_ns, struct time_namespace *old_ns) | 134 | struct user_namespace *user_ns, struct time_namespace *old_ns) |
| 135 | { | 135 | { |
| 136 | if (!(flags & CLONE_NEWTIME)) | 136 | if (!(flags & CLONE_NEWTIME)) |
| @@ -86,7 +86,7 @@ fail: · 85 unmodified lines | |||
| 86 | * utsname of this process won't be seen by parent, and vice | 86 | * utsname of this process won't be seen by parent, and vice |
| 87 | * versa. | 87 | * versa. |
| 88 | */ | 88 | */ |
| 89 | struct uts_namespace *copy_utsname(unsigned long flags, | 89 | struct uts_namespace *copy_utsname(u64 flags, |
| 90 | struct user_namespace *user_ns, struct uts_namespace *old_ns) | 90 | struct user_namespace *user_ns, struct uts_namespace *old_ns) |
| 91 | { | 91 | { |
| 92 | struct uts_namespace *new_ns; | 92 | struct uts_namespace *new_ns; |
| @@ -539,7 +539,7 @@ void net_drop_ns(void *p) · 538 unmodified lines | |||
| 539 | net_passive_dec(net); | 539 | net_passive_dec(net); |
| 540 | } | 540 | } |
| 541 | 541 | ||
| 542 | struct net *copy_net_ns(unsigned long flags, | 542 | struct net *copy_net_ns(u64 flags, |
| 543 | struct user_namespace *user_ns, struct net *old_net) | 543 | struct user_namespace *user_ns, struct net *old_net) |
| 544 | { | 544 | { |
| 545 | struct ucounts *ucounts; | 545 | struct ucounts *ucounts; |
| @@ -112,7 +112,7 @@ static void apparmor_task_free(struct task_struct *task) · 111 unmodified lines | |||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | static int apparmor_task_alloc(struct task_struct *task, | 114 | static int apparmor_task_alloc(struct task_struct *task, |
| 115 | unsigned long clone_flags) | 115 | u64 clone_flags) |
| 116 | { | 116 | { |
| 117 | struct aa_task_ctx *new = task_ctx(task); | 117 | struct aa_task_ctx *new = task_ctx(task); |
| 118 | 118 | ||
| @@ -3185,7 +3185,7 @@ int security_file_truncate(struct file *file) · 3184 unmodified lines | |||
| 3185 | * | 3185 | * |
| 3186 | * Return: Returns a zero on success, negative values on failure. | 3186 | * Return: Returns a zero on success, negative values on failure. |
| 3187 | */ | 3187 | */ |
| 3188 | int security_task_alloc(struct task_struct *task, unsigned long clone_flags) | 3188 | int security_task_alloc(struct task_struct *task, u64 clone_flags) |
| 3189 | { | 3189 | { |
| 3190 | int rc = lsm_task_alloc(task); | 3190 | int rc = lsm_task_alloc(task); |
| 3191 | 3191 | ||
| @@ -4144,7 +4144,7 @@ static int selinux_file_open(struct file *file) · 4143 unmodified lines | |||
| 4144 | /* task security operations */ | 4144 | /* task security operations */ |
| 4145 | 4145 | ||
| 4146 | static int selinux_task_alloc(struct task_struct *task, | 4146 | static int selinux_task_alloc(struct task_struct *task, |
| 4147 | unsigned long clone_flags) | 4147 | u64 clone_flags) |
| 4148 | { | 4148 | { |
| 4149 | u32 sid = current_sid(); | 4149 | u32 sid = current_sid(); |
| 4150 | 4150 | ||
| @@ -514,7 +514,7 @@ struct lsm_blob_sizes tomoyo_blob_sizes __ro_after_init = { · 513 unmodified lines | |||
| 514 | * Returns 0. | 514 | * Returns 0. |
| 515 | */ | 515 | */ |
| 516 | static int tomoyo_task_alloc(struct task_struct *task, | 516 | static int tomoyo_task_alloc(struct task_struct *task, |
| 517 | unsigned long clone_flags) | 517 | u64 clone_flags) |
| 518 | { | 518 | { |
| 519 | struct tomoyo_task *old = tomoyo_task(current); | 519 | struct tomoyo_task *old = tomoyo_task(current); |
| 520 | struct tomoyo_task *new = tomoyo_task(task); | 520 | struct tomoyo_task *new = tomoyo_task(task); |