diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/audit_tree.c | 10 | ||||
| -rw-r--r-- | kernel/audit_watch.c | 4 | ||||
| -rw-r--r-- | kernel/fork.c | 2 | ||||
| -rw-r--r-- | kernel/kcmp.c | 1 | ||||
| -rw-r--r-- | kernel/kmod.c | 6 | ||||
| -rw-r--r-- | kernel/modsign_pubkey.c | 15 | ||||
| -rw-r--r-- | kernel/posix-cpu-timers.c | 3 | ||||
| -rw-r--r-- | kernel/sched/fair.c | 5 | ||||
| -rw-r--r-- | kernel/signal.c | 74 |
9 files changed, 98 insertions, 22 deletions
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index ed206fd88cca..e81175ef25f8 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
| @@ -249,7 +249,7 @@ static void untag_chunk(struct node *p) | |||
| 249 | list_del_rcu(&chunk->hash); | 249 | list_del_rcu(&chunk->hash); |
| 250 | spin_unlock(&hash_lock); | 250 | spin_unlock(&hash_lock); |
| 251 | spin_unlock(&entry->lock); | 251 | spin_unlock(&entry->lock); |
| 252 | fsnotify_destroy_mark(entry); | 252 | fsnotify_destroy_mark(entry, audit_tree_group); |
| 253 | goto out; | 253 | goto out; |
| 254 | } | 254 | } |
| 255 | 255 | ||
| @@ -291,7 +291,7 @@ static void untag_chunk(struct node *p) | |||
| 291 | owner->root = new; | 291 | owner->root = new; |
| 292 | spin_unlock(&hash_lock); | 292 | spin_unlock(&hash_lock); |
| 293 | spin_unlock(&entry->lock); | 293 | spin_unlock(&entry->lock); |
| 294 | fsnotify_destroy_mark(entry); | 294 | fsnotify_destroy_mark(entry, audit_tree_group); |
| 295 | fsnotify_put_mark(&new->mark); /* drop initial reference */ | 295 | fsnotify_put_mark(&new->mark); /* drop initial reference */ |
| 296 | goto out; | 296 | goto out; |
| 297 | 297 | ||
| @@ -331,7 +331,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree) | |||
| 331 | spin_unlock(&hash_lock); | 331 | spin_unlock(&hash_lock); |
| 332 | chunk->dead = 1; | 332 | chunk->dead = 1; |
| 333 | spin_unlock(&entry->lock); | 333 | spin_unlock(&entry->lock); |
| 334 | fsnotify_destroy_mark(entry); | 334 | fsnotify_destroy_mark(entry, audit_tree_group); |
| 335 | fsnotify_put_mark(entry); | 335 | fsnotify_put_mark(entry); |
| 336 | return 0; | 336 | return 0; |
| 337 | } | 337 | } |
| @@ -412,7 +412,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
| 412 | spin_unlock(&chunk_entry->lock); | 412 | spin_unlock(&chunk_entry->lock); |
| 413 | spin_unlock(&old_entry->lock); | 413 | spin_unlock(&old_entry->lock); |
| 414 | 414 | ||
| 415 | fsnotify_destroy_mark(chunk_entry); | 415 | fsnotify_destroy_mark(chunk_entry, audit_tree_group); |
| 416 | 416 | ||
| 417 | fsnotify_put_mark(chunk_entry); | 417 | fsnotify_put_mark(chunk_entry); |
| 418 | fsnotify_put_mark(old_entry); | 418 | fsnotify_put_mark(old_entry); |
| @@ -443,7 +443,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
| 443 | spin_unlock(&hash_lock); | 443 | spin_unlock(&hash_lock); |
| 444 | spin_unlock(&chunk_entry->lock); | 444 | spin_unlock(&chunk_entry->lock); |
| 445 | spin_unlock(&old_entry->lock); | 445 | spin_unlock(&old_entry->lock); |
| 446 | fsnotify_destroy_mark(old_entry); | 446 | fsnotify_destroy_mark(old_entry, audit_tree_group); |
| 447 | fsnotify_put_mark(chunk_entry); /* drop initial reference */ | 447 | fsnotify_put_mark(chunk_entry); /* drop initial reference */ |
| 448 | fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */ | 448 | fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */ |
| 449 | return 0; | 449 | return 0; |
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index 9a9ae6e3d290..4a599f699adc 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
| @@ -350,7 +350,7 @@ static void audit_remove_parent_watches(struct audit_parent *parent) | |||
| 350 | } | 350 | } |
| 351 | mutex_unlock(&audit_filter_mutex); | 351 | mutex_unlock(&audit_filter_mutex); |
| 352 | 352 | ||
| 353 | fsnotify_destroy_mark(&parent->mark); | 353 | fsnotify_destroy_mark(&parent->mark, audit_watch_group); |
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | /* Get path information necessary for adding watches. */ | 356 | /* Get path information necessary for adding watches. */ |
| @@ -457,7 +457,7 @@ void audit_remove_watch_rule(struct audit_krule *krule) | |||
| 457 | 457 | ||
| 458 | if (list_empty(&parent->watches)) { | 458 | if (list_empty(&parent->watches)) { |
| 459 | audit_get_parent(parent); | 459 | audit_get_parent(parent); |
| 460 | fsnotify_destroy_mark(&parent->mark); | 460 | fsnotify_destroy_mark(&parent->mark, audit_watch_group); |
| 461 | audit_put_parent(parent); | 461 | audit_put_parent(parent); |
| 462 | } | 462 | } |
| 463 | } | 463 | } |
diff --git a/kernel/fork.c b/kernel/fork.c index 85f6d536608d..a31b823b3c2d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -1613,7 +1613,6 @@ long do_fork(unsigned long clone_flags, | |||
| 1613 | return nr; | 1613 | return nr; |
| 1614 | } | 1614 | } |
| 1615 | 1615 | ||
| 1616 | #ifdef CONFIG_GENERIC_KERNEL_THREAD | ||
| 1617 | /* | 1616 | /* |
| 1618 | * Create a kernel thread. | 1617 | * Create a kernel thread. |
| 1619 | */ | 1618 | */ |
| @@ -1622,7 +1621,6 @@ pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | |||
| 1622 | return do_fork(flags|CLONE_VM|CLONE_UNTRACED, (unsigned long)fn, | 1621 | return do_fork(flags|CLONE_VM|CLONE_UNTRACED, (unsigned long)fn, |
| 1623 | (unsigned long)arg, NULL, NULL); | 1622 | (unsigned long)arg, NULL, NULL); |
| 1624 | } | 1623 | } |
| 1625 | #endif | ||
| 1626 | 1624 | ||
| 1627 | #ifdef __ARCH_WANT_SYS_FORK | 1625 | #ifdef __ARCH_WANT_SYS_FORK |
| 1628 | SYSCALL_DEFINE0(fork) | 1626 | SYSCALL_DEFINE0(fork) |
diff --git a/kernel/kcmp.c b/kernel/kcmp.c index 30b7b225306c..e30ac0fe61c3 100644 --- a/kernel/kcmp.c +++ b/kernel/kcmp.c | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/string.h> | 4 | #include <linux/string.h> |
| 5 | #include <linux/random.h> | 5 | #include <linux/random.h> |
| 6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
| 7 | #include <linux/ptrace.h> | ||
| 7 | #include <linux/init.h> | 8 | #include <linux/init.h> |
| 8 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
| 9 | #include <linux/cache.h> | 10 | #include <linux/cache.h> |
diff --git a/kernel/kmod.c b/kernel/kmod.c index 1c317e386831..0023a87e8de6 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
| @@ -219,9 +219,9 @@ static int ____call_usermodehelper(void *data) | |||
| 219 | 219 | ||
| 220 | commit_creds(new); | 220 | commit_creds(new); |
| 221 | 221 | ||
| 222 | retval = kernel_execve(sub_info->path, | 222 | retval = do_execve(sub_info->path, |
| 223 | (const char *const *)sub_info->argv, | 223 | (const char __user *const __user *)sub_info->argv, |
| 224 | (const char *const *)sub_info->envp); | 224 | (const char __user *const __user *)sub_info->envp); |
| 225 | if (!retval) | 225 | if (!retval) |
| 226 | return 0; | 226 | return 0; |
| 227 | 227 | ||
diff --git a/kernel/modsign_pubkey.c b/kernel/modsign_pubkey.c index 045504fffbb2..2b6e69909c39 100644 --- a/kernel/modsign_pubkey.c +++ b/kernel/modsign_pubkey.c | |||
| @@ -34,18 +34,15 @@ static __init int module_verify_init(void) | |||
| 34 | { | 34 | { |
| 35 | pr_notice("Initialise module verification\n"); | 35 | pr_notice("Initialise module verification\n"); |
| 36 | 36 | ||
| 37 | modsign_keyring = key_alloc(&key_type_keyring, ".module_sign", | 37 | modsign_keyring = keyring_alloc(".module_sign", |
| 38 | KUIDT_INIT(0), KGIDT_INIT(0), | 38 | KUIDT_INIT(0), KGIDT_INIT(0), |
| 39 | current_cred(), | 39 | current_cred(), |
| 40 | (KEY_POS_ALL & ~KEY_POS_SETATTR) | | 40 | ((KEY_POS_ALL & ~KEY_POS_SETATTR) | |
| 41 | KEY_USR_VIEW | KEY_USR_READ, | 41 | KEY_USR_VIEW | KEY_USR_READ), |
| 42 | KEY_ALLOC_NOT_IN_QUOTA); | 42 | KEY_ALLOC_NOT_IN_QUOTA, NULL); |
| 43 | if (IS_ERR(modsign_keyring)) | 43 | if (IS_ERR(modsign_keyring)) |
| 44 | panic("Can't allocate module signing keyring\n"); | 44 | panic("Can't allocate module signing keyring\n"); |
| 45 | 45 | ||
| 46 | if (key_instantiate_and_link(modsign_keyring, NULL, 0, NULL, NULL) < 0) | ||
| 47 | panic("Can't instantiate module signing keyring\n"); | ||
| 48 | |||
| 49 | return 0; | 46 | return 0; |
| 50 | } | 47 | } |
| 51 | 48 | ||
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index d73840271dce..a278cad1d5d6 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
| 10 | #include <linux/kernel_stat.h> | 10 | #include <linux/kernel_stat.h> |
| 11 | #include <trace/events/timer.h> | 11 | #include <trace/events/timer.h> |
| 12 | #include <linux/random.h> | ||
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| 14 | * Called after updating RLIMIT_CPU to run cpu timer and update | 15 | * Called after updating RLIMIT_CPU to run cpu timer and update |
| @@ -470,6 +471,8 @@ static void cleanup_timers(struct list_head *head, | |||
| 470 | */ | 471 | */ |
| 471 | void posix_cpu_timers_exit(struct task_struct *tsk) | 472 | void posix_cpu_timers_exit(struct task_struct *tsk) |
| 472 | { | 473 | { |
| 474 | add_device_randomness((const void*) &tsk->se.sum_exec_runtime, | ||
| 475 | sizeof(unsigned long long)); | ||
| 473 | cleanup_timers(tsk->cpu_timers, | 476 | cleanup_timers(tsk->cpu_timers, |
| 474 | tsk->utime, tsk->stime, tsk->se.sum_exec_runtime); | 477 | tsk->utime, tsk->stime, tsk->se.sum_exec_runtime); |
| 475 | 478 | ||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4603d6cb9e25..5eea8707234a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
| @@ -793,8 +793,11 @@ unsigned int sysctl_numa_balancing_scan_delay = 1000; | |||
| 793 | 793 | ||
| 794 | static void task_numa_placement(struct task_struct *p) | 794 | static void task_numa_placement(struct task_struct *p) |
| 795 | { | 795 | { |
| 796 | int seq = ACCESS_ONCE(p->mm->numa_scan_seq); | 796 | int seq; |
| 797 | 797 | ||
| 798 | if (!p->mm) /* for example, ksmd faulting in a user's mm */ | ||
| 799 | return; | ||
| 800 | seq = ACCESS_ONCE(p->mm->numa_scan_seq); | ||
| 798 | if (p->numa_scan_seq == seq) | 801 | if (p->numa_scan_seq == seq) |
| 799 | return; | 802 | return; |
| 800 | p->numa_scan_seq = seq; | 803 | p->numa_scan_seq = seq; |
diff --git a/kernel/signal.c b/kernel/signal.c index 580a91e63471..7aaa51d8e5b8 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/nsproxy.h> | 31 | #include <linux/nsproxy.h> |
| 32 | #include <linux/user_namespace.h> | 32 | #include <linux/user_namespace.h> |
| 33 | #include <linux/uprobes.h> | 33 | #include <linux/uprobes.h> |
| 34 | #include <linux/compat.h> | ||
| 34 | #define CREATE_TRACE_POINTS | 35 | #define CREATE_TRACE_POINTS |
| 35 | #include <trace/events/signal.h> | 36 | #include <trace/events/signal.h> |
| 36 | 37 | ||
| @@ -3094,6 +3095,79 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s | |||
| 3094 | out: | 3095 | out: |
| 3095 | return error; | 3096 | return error; |
| 3096 | } | 3097 | } |
| 3098 | #ifdef CONFIG_GENERIC_SIGALTSTACK | ||
| 3099 | SYSCALL_DEFINE2(sigaltstack,const stack_t __user *,uss, stack_t __user *,uoss) | ||
| 3100 | { | ||
| 3101 | return do_sigaltstack(uss, uoss, current_user_stack_pointer()); | ||
| 3102 | } | ||
| 3103 | #endif | ||
| 3104 | |||
| 3105 | int restore_altstack(const stack_t __user *uss) | ||
| 3106 | { | ||
| 3107 | int err = do_sigaltstack(uss, NULL, current_user_stack_pointer()); | ||
| 3108 | /* squash all but EFAULT for now */ | ||
| 3109 | return err == -EFAULT ? err : 0; | ||
| 3110 | } | ||
| 3111 | |||
| 3112 | int __save_altstack(stack_t __user *uss, unsigned long sp) | ||
| 3113 | { | ||
| 3114 | struct task_struct *t = current; | ||
| 3115 | return __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) | | ||
| 3116 | __put_user(sas_ss_flags(sp), &uss->ss_flags) | | ||
| 3117 | __put_user(t->sas_ss_size, &uss->ss_size); | ||
| 3118 | } | ||
| 3119 | |||
| 3120 | #ifdef CONFIG_COMPAT | ||
| 3121 | #ifdef CONFIG_GENERIC_SIGALTSTACK | ||
| 3122 | asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, | ||
| 3123 | compat_stack_t __user *uoss_ptr) | ||
| 3124 | { | ||
| 3125 | stack_t uss, uoss; | ||
| 3126 | int ret; | ||
| 3127 | mm_segment_t seg; | ||
| 3128 | |||
| 3129 | if (uss_ptr) { | ||
| 3130 | compat_stack_t uss32; | ||
| 3131 | |||
| 3132 | memset(&uss, 0, sizeof(stack_t)); | ||
| 3133 | if (copy_from_user(&uss32, uss_ptr, sizeof(compat_stack_t))) | ||
| 3134 | return -EFAULT; | ||
| 3135 | uss.ss_sp = compat_ptr(uss32.ss_sp); | ||
| 3136 | uss.ss_flags = uss32.ss_flags; | ||
| 3137 | uss.ss_size = uss32.ss_size; | ||
| 3138 | } | ||
| 3139 | seg = get_fs(); | ||
| 3140 | set_fs(KERNEL_DS); | ||
| 3141 | ret = do_sigaltstack((stack_t __force __user *) (uss_ptr ? &uss : NULL), | ||
| 3142 | (stack_t __force __user *) &uoss, | ||
| 3143 | compat_user_stack_pointer()); | ||
| 3144 | set_fs(seg); | ||
| 3145 | if (ret >= 0 && uoss_ptr) { | ||
| 3146 | if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(compat_stack_t)) || | ||
| 3147 | __put_user(ptr_to_compat(uoss.ss_sp), &uoss_ptr->ss_sp) || | ||
| 3148 | __put_user(uoss.ss_flags, &uoss_ptr->ss_flags) || | ||
| 3149 | __put_user(uoss.ss_size, &uoss_ptr->ss_size)) | ||
| 3150 | ret = -EFAULT; | ||
| 3151 | } | ||
| 3152 | return ret; | ||
| 3153 | } | ||
| 3154 | |||
| 3155 | int compat_restore_altstack(const compat_stack_t __user *uss) | ||
| 3156 | { | ||
| 3157 | int err = compat_sys_sigaltstack(uss, NULL); | ||
| 3158 | /* squash all but -EFAULT for now */ | ||
| 3159 | return err == -EFAULT ? err : 0; | ||
| 3160 | } | ||
| 3161 | |||
| 3162 | int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp) | ||
| 3163 | { | ||
| 3164 | struct task_struct *t = current; | ||
| 3165 | return __put_user(ptr_to_compat((void __user *)t->sas_ss_sp), &uss->ss_sp) | | ||
| 3166 | __put_user(sas_ss_flags(sp), &uss->ss_flags) | | ||
| 3167 | __put_user(t->sas_ss_size, &uss->ss_size); | ||
| 3168 | } | ||
| 3169 | #endif | ||
| 3170 | #endif | ||
| 3097 | 3171 | ||
| 3098 | #ifdef __ARCH_WANT_SYS_SIGPENDING | 3172 | #ifdef __ARCH_WANT_SYS_SIGPENDING |
| 3099 | 3173 | ||
