Print this page
11787 Kernel needs to be built with retpolines
11788 Kernel needs to generally use RSB stuffing
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>
@@ -34,11 +34,11 @@
/* Copyright (c) 1987, 1988 Microsoft Corporation */
/* All Rights Reserved */
/*
- * Copyright (c) 2018 Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
*/
#include <sys/errno.h>
#include <sys/asm_linkage.h>
@@ -480,11 +480,11 @@
leaq L(fwdPxQx)(%rip), %r10
addq %rdx, %rdi
addq %rdx, %rsi
movslq (%r10,%rdx,4), %rcx
leaq (%rcx,%r10,1), %r10
- jmpq *%r10
+ INDIRECT_JMP_REG(r10)
.p2align 4
L(fwdPxQx):
.int L(P0Q0)-L(fwdPxQx) /* 0 */
.int L(P1Q0)-L(fwdPxQx)
@@ -936,11 +936,11 @@
leaq L(fwdPxQx)(%rip), %r10
addq %rdx, %rdi
addq %rdx, %rsi
movslq (%r10,%rdx,4), %rcx
leaq (%rcx,%r10,1), %r10
- jmpq *%r10
+ INDIRECT_JMP_REG(r10)
/*
* Use rep smovq. Clear remainder via unrolled code
*/
.p2align 4
@@ -1168,11 +1168,11 @@
*/
leaq L(setPxQx)(%rip), %r10
addq %rsi, %rdi
movslq (%r10,%rsi,4), %rcx
leaq (%rcx,%r10,1), %r10
- jmpq *%r10
+ INDIRECT_JMP_REG(r10)
.p2align 4
L(setPxQx):
.int L(P0Q0)-L(setPxQx) /* 0 */
.int L(P1Q0)-L(setPxQx)
@@ -1439,11 +1439,11 @@
9:
leaq L(setPxQx)(%rip), %r10
addq %rsi, %rdi
movslq (%r10,%rsi,4), %rcx
leaq (%rcx,%r10,1), %r10
- jmpq *%r10
+ INDIRECT_JMP_REG(r10)
/*
* Use rep sstoq. Clear any remainder via unrolled code
*/
.p2align 4
@@ -1575,11 +1575,12 @@
*/
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leave
- jmp *CP_COPYIN(%rax)
+ movq CP_COPYIN(%rax), %rax
+ INDIRECT_JMP_REG(rax)
2: movl $-1, %eax
leave
ret
SET_SIZE(copyin)
@@ -1720,11 +1721,12 @@
*/
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leave
- jmp *CP_XCOPYIN(%r8)
+ movq CP_XCOPYIN(%r8), %r8
+ INDIRECT_JMP_REG(r8)
2: leave
ret
SET_SIZE(xcopyin_nta)
@@ -1863,11 +1865,12 @@
*/
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leave
- jmp *CP_COPYOUT(%rax)
+ movq CP_COPYOUT(%rax), %rax
+ INDIRECT_JMP_REG(rax)
2: movl $-1, %eax
leave
ret
SET_SIZE(copyout)
@@ -2008,11 +2011,12 @@
*/
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leave
- jmp *CP_XCOPYOUT(%r8)
+ movq CP_XCOPYOUT(%r8), %r8
+ INDIRECT_JMP_REG(r8)
2: leave
ret
SET_SIZE(xcopyout_nta)
@@ -2322,11 +2326,12 @@
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
leave
- jmp *CP_COPYINSTR(%rax)
+ movq CP_COPYINSTR(%rax), %rax
+ INDIRECT_JMP_REG(rax)
2: movl $EFAULT, %eax /* return EFAULT */
leave
ret
SET_SIZE(copyinstr)
@@ -2444,11 +2449,12 @@
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
leave
- jmp *CP_COPYOUTSTR(%rax)
+ movq CP_COPYOUTSTR(%rax), %rax
+ INDIRECT_JMP_REG(rax)
2: movl $EFAULT, %eax /* return EFAULT */
leave
ret
SET_SIZE(copyoutstr)
@@ -2560,11 +2566,12 @@
movq $0, T_LOFAULT(%r9); \
1: \
movq T_COPYOPS(%r9), %rax; \
cmpq $0, %rax; \
jz 2f; \
- jmp *COPYOP(%rax); \
+ movq COPYOP(%rax), %rax; \
+ INDIRECT_JMP_REG(rax); \
2: \
movl $-1, %eax; \
ret; \
SET_SIZE(NAME)
@@ -2669,11 +2676,12 @@
movq $0, T_LOFAULT(%r9); \
1: \
movq T_COPYOPS(%r9), %rax; \
cmpq $0, %rax; \
jz 3f; \
- jmp *COPYOP(%rax); \
+ movq COPYOP(%rax), %rax; \
+ INDIRECT_JMP_REG(rax); \
3: \
movl $-1, %eax; \
ret; \
SET_SIZE(NAME)