Commit 7cc7e935 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-misc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull misc x86 updates from Ingo Molnar:

 - extend the decoder maps with CET instructions

 - fix !vDSO corner cases

* 'x86-misc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/tests: Add CET instructions to the new instructions test
  x86/insn: Add Control-flow Enforcement (CET) instructions to the opcode map
  selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault
  selftests/x86/vdso: Fix no-vDSO segfaults
parents d0be2d53 1032f326
......@@ -366,7 +366,7 @@ AVXcode: 1
1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv
1c: Grp20 (1A),(1C)
1d:
1e:
1e: Grp21 (1A)
1f: NOP Ev
# 0x0f 0x20-0x2f
20: MOV Rd,Cd
......@@ -803,8 +803,8 @@ f0: MOVBE Gy,My | MOVBE Gw,Mw (66) | CRC32 Gd,Eb (F2) | CRC32 Gd,Eb (66&F2)
f1: MOVBE My,Gy | MOVBE Mw,Gw (66) | CRC32 Gd,Ey (F2) | CRC32 Gd,Ew (66&F2)
f2: ANDN Gy,By,Ey (v)
f3: Grp17 (1A)
f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v)
f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v)
f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) | WRUSSD/Q My,Gy (66)
f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) | WRSSD/Q My,Gy
f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v)
f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3)
f9: MOVDIRI My,Gy
......@@ -970,7 +970,7 @@ GrpTable: Grp7
2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B)
3: LIDT Ms
4: SMSW Mw/Rv
5: rdpkru (110),(11B) | wrpkru (111),(11B)
5: rdpkru (110),(11B) | wrpkru (111),(11B) | SAVEPREVSSP (F3),(010),(11B) | RSTORSSP Mq (F3) | SETSSBSY (F3),(000),(11B)
6: LMSW Ew
7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B)
EndTable
......@@ -1041,8 +1041,8 @@ GrpTable: Grp15
2: vldmxcsr Md (v1) | WRFSBASE Ry (F3),(11B)
3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B)
4: XSAVE | ptwrite Ey (F3),(11B)
5: XRSTOR | lfence (11B)
6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B)
5: XRSTOR | lfence (11B) | INCSSPD/Q Ry (F3),(11B)
6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) | CLRSSBSY Mq (F3)
7: clflush | clflushopt (66) | sfence (11B)
EndTable
......@@ -1077,6 +1077,11 @@ GrpTable: Grp20
0: cldemote Mb
EndTable
GrpTable: Grp21
1: RDSSPD/Q Ry (F3),(11B)
7: ENDBR64 (F3),(010),(11B) | ENDBR32 (F3),(011),(11B)
EndTable
# AMD's Prefetch Group
GrpTable: GrpP
0: PREFETCH
......
......@@ -366,7 +366,7 @@ AVXcode: 1
1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv
1c: Grp20 (1A),(1C)
1d:
1e:
1e: Grp21 (1A)
1f: NOP Ev
# 0x0f 0x20-0x2f
20: MOV Rd,Cd
......@@ -803,8 +803,8 @@ f0: MOVBE Gy,My | MOVBE Gw,Mw (66) | CRC32 Gd,Eb (F2) | CRC32 Gd,Eb (66&F2)
f1: MOVBE My,Gy | MOVBE Mw,Gw (66) | CRC32 Gd,Ey (F2) | CRC32 Gd,Ew (66&F2)
f2: ANDN Gy,By,Ey (v)
f3: Grp17 (1A)
f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v)
f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v)
f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) | WRUSSD/Q My,Gy (66)
f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) | WRSSD/Q My,Gy
f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v)
f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3)
f9: MOVDIRI My,Gy
......@@ -970,7 +970,7 @@ GrpTable: Grp7
2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B)
3: LIDT Ms
4: SMSW Mw/Rv
5: rdpkru (110),(11B) | wrpkru (111),(11B)
5: rdpkru (110),(11B) | wrpkru (111),(11B) | SAVEPREVSSP (F3),(010),(11B) | RSTORSSP Mq (F3) | SETSSBSY (F3),(000),(11B)
6: LMSW Ew
7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B)
EndTable
......@@ -1041,8 +1041,8 @@ GrpTable: Grp15
2: vldmxcsr Md (v1) | WRFSBASE Ry (F3),(11B)
3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B)
4: XSAVE | ptwrite Ey (F3),(11B)
5: XRSTOR | lfence (11B)
6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B)
5: XRSTOR | lfence (11B) | INCSSPD/Q Ry (F3),(11B)
6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) | CLRSSBSY Mq (F3)
7: clflush | clflushopt (66) | sfence (11B)
EndTable
......@@ -1077,6 +1077,11 @@ GrpTable: Grp20
0: cldemote Mb
EndTable
GrpTable: Grp21
1: RDSSPD/Q Ry (F3),(11B)
7: ENDBR64 (F3),(010),(11B) | ENDBR32 (F3),(011),(11B)
EndTable
# AMD's Prefetch Group
GrpTable: GrpP
0: PREFETCH
......
......@@ -2085,6 +2085,118 @@
"67 f3 0f 38 f8 1c \tenqcmds (%si),%bx",},
{{0x67, 0xf3, 0x0f, 0x38, 0xf8, 0x8c, 0x34, 0x12, }, 8, 0, "", "",
"67 f3 0f 38 f8 8c 34 12 \tenqcmds 0x1234(%si),%cx",},
{{0xf3, 0x0f, 0xae, 0xe8, }, 4, 0, "", "",
"f3 0f ae e8 \tincsspd %eax",},
{{0x0f, 0xae, 0x28, }, 3, 0, "", "",
"0f ae 28 \txrstor (%eax)",},
{{0x0f, 0xae, 0x2d, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "",
"0f ae 2d 78 56 34 12 \txrstor 0x12345678",},
{{0x0f, 0xae, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "",
"0f ae ac c8 78 56 34 12 \txrstor 0x12345678(%eax,%ecx,8)",},
{{0x0f, 0xae, 0xe8, }, 3, 0, "", "",
"0f ae e8 \tlfence ",},
{{0xf3, 0x0f, 0x1e, 0xc8, }, 4, 0, "", "",
"f3 0f 1e c8 \trdsspd %eax",},
{{0xf3, 0x0f, 0x01, 0xea, }, 4, 0, "", "",
"f3 0f 01 ea \tsaveprevssp ",},
{{0xf3, 0x0f, 0x01, 0x28, }, 4, 0, "", "",
"f3 0f 01 28 \trstorssp (%eax)",},
{{0xf3, 0x0f, 0x01, 0x2d, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "",
"f3 0f 01 2d 78 56 34 12 \trstorssp 0x12345678",},
{{0xf3, 0x0f, 0x01, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "",
"f3 0f 01 ac c8 78 56 34 12 \trstorssp 0x12345678(%eax,%ecx,8)",},
{{0x0f, 0x38, 0xf6, 0x08, }, 4, 0, "", "",
"0f 38 f6 08 \twrssd %ecx,(%eax)",},
{{0x0f, 0x38, 0xf6, 0x15, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "",
"0f 38 f6 15 78 56 34 12 \twrssd %edx,0x12345678",},
{{0x0f, 0x38, 0xf6, 0x94, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "",
"0f 38 f6 94 c8 78 56 34 12 \twrssd %edx,0x12345678(%eax,%ecx,8)",},
{{0x66, 0x0f, 0x38, 0xf5, 0x08, }, 5, 0, "", "",
"66 0f 38 f5 08 \twrussd %ecx,(%eax)",},
{{0x66, 0x0f, 0x38, 0xf5, 0x15, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "",
"66 0f 38 f5 15 78 56 34 12 \twrussd %edx,0x12345678",},
{{0x66, 0x0f, 0x38, 0xf5, 0x94, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "",
"66 0f 38 f5 94 c8 78 56 34 12 \twrussd %edx,0x12345678(%eax,%ecx,8)",},
{{0xf3, 0x0f, 0x01, 0xe8, }, 4, 0, "", "",
"f3 0f 01 e8 \tsetssbsy ",},
{{0x0f, 0x01, 0xee, }, 3, 0, "", "",
"0f 01 ee \trdpkru ",},
{{0x0f, 0x01, 0xef, }, 3, 0, "", "",
"0f 01 ef \twrpkru ",},
{{0xf3, 0x0f, 0xae, 0x30, }, 4, 0, "", "",
"f3 0f ae 30 \tclrssbsy (%eax)",},
{{0xf3, 0x0f, 0xae, 0x35, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "",
"f3 0f ae 35 78 56 34 12 \tclrssbsy 0x12345678",},
{{0xf3, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "",
"f3 0f ae b4 c8 78 56 34 12 \tclrssbsy 0x12345678(%eax,%ecx,8)",},
{{0xf3, 0x0f, 0x1e, 0xfb, }, 4, 0, "", "",
"f3 0f 1e fb \tendbr32 ",},
{{0xf3, 0x0f, 0x1e, 0xfa, }, 4, 0, "", "",
"f3 0f 1e fa \tendbr64 ",},
{{0xff, 0xd0, }, 2, 0, "call", "indirect",
"ff d0 \tcall *%eax",},
{{0xff, 0x10, }, 2, 0, "call", "indirect",
"ff 10 \tcall *(%eax)",},
{{0xff, 0x15, 0x78, 0x56, 0x34, 0x12, }, 6, 0, "call", "indirect",
"ff 15 78 56 34 12 \tcall *0x12345678",},
{{0xff, 0x94, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "call", "indirect",
"ff 94 c8 78 56 34 12 \tcall *0x12345678(%eax,%ecx,8)",},
{{0xf2, 0xff, 0xd0, }, 3, 0, "call", "indirect",
"f2 ff d0 \tbnd call *%eax",},
{{0xf2, 0xff, 0x10, }, 3, 0, "call", "indirect",
"f2 ff 10 \tbnd call *(%eax)",},
{{0xf2, 0xff, 0x15, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "call", "indirect",
"f2 ff 15 78 56 34 12 \tbnd call *0x12345678",},
{{0xf2, 0xff, 0x94, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "call", "indirect",
"f2 ff 94 c8 78 56 34 12 \tbnd call *0x12345678(%eax,%ecx,8)",},
{{0x3e, 0xff, 0xd0, }, 3, 0, "call", "indirect",
"3e ff d0 \tnotrack call *%eax",},
{{0x3e, 0xff, 0x10, }, 3, 0, "call", "indirect",
"3e ff 10 \tnotrack call *(%eax)",},
{{0x3e, 0xff, 0x15, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "call", "indirect",
"3e ff 15 78 56 34 12 \tnotrack call *0x12345678",},
{{0x3e, 0xff, 0x94, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "call", "indirect",
"3e ff 94 c8 78 56 34 12 \tnotrack call *0x12345678(%eax,%ecx,8)",},
{{0x3e, 0xf2, 0xff, 0xd0, }, 4, 0, "call", "indirect",
"3e f2 ff d0 \tnotrack bnd call *%eax",},
{{0x3e, 0xf2, 0xff, 0x10, }, 4, 0, "call", "indirect",
"3e f2 ff 10 \tnotrack bnd call *(%eax)",},
{{0x3e, 0xf2, 0xff, 0x15, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "call", "indirect",
"3e f2 ff 15 78 56 34 12 \tnotrack bnd call *0x12345678",},
{{0x3e, 0xf2, 0xff, 0x94, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "call", "indirect",
"3e f2 ff 94 c8 78 56 34 12 \tnotrack bnd call *0x12345678(%eax,%ecx,8)",},
{{0xff, 0xe0, }, 2, 0, "jmp", "indirect",
"ff e0 \tjmp *%eax",},
{{0xff, 0x20, }, 2, 0, "jmp", "indirect",
"ff 20 \tjmp *(%eax)",},
{{0xff, 0x25, 0x78, 0x56, 0x34, 0x12, }, 6, 0, "jmp", "indirect",
"ff 25 78 56 34 12 \tjmp *0x12345678",},
{{0xff, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "jmp", "indirect",
"ff a4 c8 78 56 34 12 \tjmp *0x12345678(%eax,%ecx,8)",},
{{0xf2, 0xff, 0xe0, }, 3, 0, "jmp", "indirect",
"f2 ff e0 \tbnd jmp *%eax",},
{{0xf2, 0xff, 0x20, }, 3, 0, "jmp", "indirect",
"f2 ff 20 \tbnd jmp *(%eax)",},
{{0xf2, 0xff, 0x25, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "jmp", "indirect",
"f2 ff 25 78 56 34 12 \tbnd jmp *0x12345678",},
{{0xf2, 0xff, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "jmp", "indirect",
"f2 ff a4 c8 78 56 34 12 \tbnd jmp *0x12345678(%eax,%ecx,8)",},
{{0x3e, 0xff, 0xe0, }, 3, 0, "jmp", "indirect",
"3e ff e0 \tnotrack jmp *%eax",},
{{0x3e, 0xff, 0x20, }, 3, 0, "jmp", "indirect",
"3e ff 20 \tnotrack jmp *(%eax)",},
{{0x3e, 0xff, 0x25, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "jmp", "indirect",
"3e ff 25 78 56 34 12 \tnotrack jmp *0x12345678",},
{{0x3e, 0xff, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "jmp", "indirect",
"3e ff a4 c8 78 56 34 12 \tnotrack jmp *0x12345678(%eax,%ecx,8)",},
{{0x3e, 0xf2, 0xff, 0xe0, }, 4, 0, "jmp", "indirect",
"3e f2 ff e0 \tnotrack bnd jmp *%eax",},
{{0x3e, 0xf2, 0xff, 0x20, }, 4, 0, "jmp", "indirect",
"3e f2 ff 20 \tnotrack bnd jmp *(%eax)",},
{{0x3e, 0xf2, 0xff, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "jmp", "indirect",
"3e f2 ff 25 78 56 34 12 \tnotrack bnd jmp *0x12345678",},
{{0x3e, 0xf2, 0xff, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "jmp", "indirect",
"3e f2 ff a4 c8 78 56 34 12 \tnotrack bnd jmp *0x12345678(%eax,%ecx,8)",},
{{0x0f, 0x01, 0xcf, }, 3, 0, "", "",
"0f 01 cf \tencls ",},
{{0x0f, 0x01, 0xd7, }, 3, 0, "", "",
......
This diff is collapsed.
......@@ -414,8 +414,12 @@ int main()
#if defined(__i386__) && (!defined(__GLIBC__) || __GLIBC__ > 2 || __GLIBC_MINOR__ >= 16)
vsyscall32 = (void *)getauxval(AT_SYSINFO);
printf("[RUN]\tCheck AT_SYSINFO return regs\n");
test_sys32_regs(do_full_vsyscall32);
if (vsyscall32) {
printf("[RUN]\tCheck AT_SYSINFO return regs\n");
test_sys32_regs(do_full_vsyscall32);
} else {
printf("[SKIP]\tAT_SYSINFO is not available\n");
}
#endif
test_ptrace_syscall_restart();
......
......@@ -259,6 +259,11 @@ static void test_one_clock_gettime(int clock, const char *name)
static void test_clock_gettime(void)
{
if (!vdso_clock_gettime) {
printf("[SKIP]\tNo vDSO, so skipping clock_gettime() tests\n");
return;
}
for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]);
clock++) {
test_one_clock_gettime(clock, clocknames[clock]);
......
......@@ -15,6 +15,7 @@
#include <err.h>
#include <stdio.h>
#include <dlfcn.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
......@@ -46,11 +47,23 @@ int main()
int nerrs = 0;
struct real_sigaction sa;
void *vdso = dlopen("linux-vdso.so.1",
RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
if (!vdso)
vdso = dlopen("linux-gate.so.1",
RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
if (!vdso) {
printf("[SKIP]\tFailed to find vDSO. Tests are not expected to work.\n");
return 0;
}
memset(&sa, 0, sizeof(sa));
sa.handler = handler_with_siginfo;
sa.flags = SA_SIGINFO;
sa.restorer = NULL; /* request kernel-provided restorer */
printf("[RUN]\tRaise a signal, SA_SIGINFO, sa.restorer == NULL\n");
if (syscall(SYS_rt_sigaction, SIGUSR1, &sa, NULL, 8) != 0)
err(1, "raw rt_sigaction syscall");
......@@ -63,6 +76,8 @@ int main()
nerrs++;
}
printf("[RUN]\tRaise a signal, !SA_SIGINFO, sa.restorer == NULL\n");
sa.flags = 0;
sa.handler = handler_without_siginfo;
if (syscall(SYS_sigaction, SIGUSR1, &sa, 0) != 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment