diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sys.c | 5 |
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); |
