aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-05-25 23:24:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-05-25 23:24:28 -0400
commitbc2dbc5420e82560e650f8531ceca597441ca171 (patch)
treeac93448eaba1fe89fa007f9945f7e507b97dba8e /kernel
parent03250e1028057173b212341015d5fbf53327042c (diff)
parent3f1959721558a976aaf9c2024d5bc884e6411bf7 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "16 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: kasan: fix memory hotplug during boot kasan: free allocated shadow memory on MEM_CANCEL_ONLINE checkpatch: fix macro argument precedence test init/main.c: include <linux/mem_encrypt.h> kernel/sys.c: fix potential Spectre v1 issue mm/memory_hotplug: fix leftover use of struct page during hotplug proc: fix smaps and meminfo alignment mm: do not warn on offline nodes unless the specific node is explicitly requested mm, memory_hotplug: make has_unmovable_pages more robust mm/kasan: don't vfree() nonexistent vm_area MAINTAINERS: change hugetlbfs maintainer and update files ipc/shm: fix shmat() nil address after round-down when remapping Revert "ipc/shm: Fix shmat mmap nil-page protection" idr: fix invalid ptr dereference on item delete ocfs2: revert "ocfs2/o2hb: check len for bio_add_page() to avoid getting incorrect bio" mm: fix nr_rotate_swap leak in swapon() error case
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sys.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index b0eee418ee0d..d1b2b8d934bb 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -71,6 +71,9 @@
71#include <asm/io.h> 71#include <asm/io.h>
72#include <asm/unistd.h> 72#include <asm/unistd.h>
73 73
74/* Hardening for Spectre-v1 */
75#include <linux/nospec.h>
76
74#include "uid16.h" 77#include "uid16.h"
75 78
76#ifndef SET_UNALIGN_CTL 79#ifndef SET_UNALIGN_CTL
@@ -1453,6 +1456,7 @@ SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
1453 if (resource >= RLIM_NLIMITS) 1456 if (resource >= RLIM_NLIMITS)
1454 return -EINVAL; 1457 return -EINVAL;
1455 1458
1459 resource = array_index_nospec(resource, RLIM_NLIMITS);
1456 task_lock(current->group_leader); 1460 task_lock(current->group_leader);
1457 x = current->signal->rlim[resource]; 1461 x = current->signal->rlim[resource];
1458 task_unlock(current->group_leader); 1462 task_unlock(current->group_leader);
@@ -1472,6 +1476,7 @@ COMPAT_SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
1472 if (resource >= RLIM_NLIMITS) 1476 if (resource >= RLIM_NLIMITS)
1473 return -EINVAL; 1477 return -EINVAL;
1474 1478
1479 resource = array_index_nospec(resource, RLIM_NLIMITS);
1475 task_lock(current->group_leader); 1480 task_lock(current->group_leader);
1476 r = current->signal->rlim[resource]; 1481 r = current->signal->rlim[resource];
1477 task_unlock(current->group_leader); 1482 task_unlock(current->group_leader);