x86/fred: Fix 64bit identifier in fred_ss
PATCH 1/1 x86/fred: Fix 64bit identifier in fred_ss
FRED can only be enabled in Long Mode. This is the 64bit mode (as opposed to compatibility mode) identifier, rather than being something hard-wired at 1.
---
CC: Xin Li <[email protected]>
CC: "H. Peter Anvin" <[email protected]>
CC: Andy Lutomirski <[email protected]>
CC: Thomas Gleixner <[email protected]>
CC: Ingo Molnar <[email protected]>
CC: Borislav Petkov <[email protected]>
CC: Dave Hansen <[email protected]>
CC: [email protected]
CC: [email protected]
IIRC, this was wrong in an older version of the FRED spec. I made the same mistake in Xen, and I didn't copy Linux's structure.
I don't thinks this warrants backporting, but the fixes tag is:
--- arch/x86/entry/entry_fred.c | 4 ++-- arch/x86/include/asm/fred.h | 2 +- arch/x86/include/asm/ptrace.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/entry/entry_fred.c +2 -2
@@ -78,13 +78,13 @@ static noinstr void fred_intx(struct pt_regs *regs) static __always_inline void fred_other(struct pt_regs *regs) {/* The compiler can fold these conditions into a single test */ -if (likely (regs->fred_ss.vector ==FRED_SYSCALL && regs->fred_ss.lm)) { +if (likely (regs->fred_ss.vector ==FRED_SYSCALL && regs->fred_ss.l)) { regs->orig_ax = regs->ax; regs->ax = -ENOSYS ;do_syscall_64 (regs, regs->orig_ax);return ; }else if (ia32_enabled () && -likely (regs->fred_ss.vector ==FRED_SYSENTER && !regs->fred_ss.lm)) { +likely (regs->fred_ss.vector ==FRED_SYSENTER && !regs->fred_ss.l)) { regs->orig_ax = regs->ax; regs->ax = -ENOSYS ;do_fast_syscall_32 (regs);
arch/x86/include/asm/fred.h +1 -1
@@ -79,7 +79,7 @@ static __always_inline void fred_entry_from_kvm(unsigned int type, unsigned int .type = type, .vector = vector, .nmi = type == EVENT_TYPE_NMI, - .lm = 1, + .l = 1, };asm_fred_entry_from_kvm (ss);
arch/x86/include/asm/ptrace.h +2 -2
@@ -84,8 +84,8 @@ struct fred_ss { : 4,/* Event was incident to enclave execution */ enclave : 1, - /* CPU was in long mode */ - lm : 1, + /* CPU was in 64-bit mode */ + l : 1,/* * Nested exception during FRED delivery, not set * for #DF.
base-commit: 24ea63ea387714634813359e2c8e0e6c36952f73
Signature · 1 line
2.39.5
Quoted 15 lines · Andrew Cooper
FRED can only be enabled in Long Mode. This is the 64bit mode (as opposed to compatibility mode) identifier, rather than being something hard-wired at 1.
Signed-off-by Andrew Cooper <[email protected]>---
CC: Xin Li <[email protected]>
CC: "H. Peter Anvin" <[email protected]>
CC: Andy Lutomirski <[email protected]>
CC: Thomas Gleixner <[email protected]>
CC: Ingo Molnar <[email protected]>
CC: Borislav Petkov <[email protected]>
CC: Dave Hansen <[email protected]>
CC: [email protected]
CC: [email protected]
Quoted 7 lines
IIRC, this was wrong in an older version of the FRED spec. I made the same mistake in Xen, and I didn't copy Linux's structure.
I don't thinks this warrants backporting, but the fixes tag is:
Fixes 3c77bf02d0c0 ("x86/ptrace: Add FRED additional information to the pt_regs structure")---
Oh right — to be precise, long mode (also known as IA-32e mode in the Intel SDM) includes two sub-modes:
1) Compatibility mode
2) 64-bit mode
So, "long mode" is not the correct term in this context and should be corrected.
Quoted 4 lines · Andrew Cooper
FRED can only be enabled in Long Mode. This is the 64bit mode (as opposed to compatibility mode) identifier, rather than being something hard-wired at 1.
Signed-off-by Andrew Cooper <[email protected]>
[...]
Quoted 6 lines
IIRC, this was wrong in an older version of the FRED spec. I made the same mistake in Xen, and I didn't copy Linux's structure.
I don't thinks this warrants backporting, but the fixes tag is:
Fixes 3c77bf02d0c0 ("x86/ptrace: Add FRED additional information to the pt_regs structure")
Please make it explicit that this patch is "no functional change", i.e. it is naming-only patch.
Other than that:
PATCH v2 1/1 x86/fred: Fix 64bit identifier in fred_ss
In reply to Andrew CooperFRED can only be enabled in Long Mode. This is the 64bit mode (as opposed to compatibility mode) identifier, rather than being something hard-wired at 1.
No functional change.
---
CC: Xin Li <[email protected]>
CC: "H. Peter Anvin" <[email protected]>
CC: Andy Lutomirski <[email protected]>
CC: Thomas Gleixner <[email protected]>
CC: Ingo Molnar <[email protected]>
CC: Borislav Petkov <[email protected]>
CC: Dave Hansen <[email protected]>
CC: [email protected]
CC: [email protected]
v2:
* State no functional change.
IIRC, this was wrong in an older version of the FRED spec. I made the same mistake in Xen, and I didn't copy Linux's structure.
I don't thinks this warrants backporting, but the fixes tag is:
--- arch/x86/entry/entry_fred.c | 4 ++-- arch/x86/include/asm/fred.h | 2 +- arch/x86/include/asm/ptrace.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/entry/entry_fred.c +2 -2
@@ -78,13 +78,13 @@ static noinstr void fred_intx(struct pt_regs *regs) static __always_inline void fred_other(struct pt_regs *regs) {/* The compiler can fold these conditions into a single test */ -if (likely (regs->fred_ss.vector ==FRED_SYSCALL && regs->fred_ss.lm)) { +if (likely (regs->fred_ss.vector ==FRED_SYSCALL && regs->fred_ss.l)) { regs->orig_ax = regs->ax; regs->ax = -ENOSYS ;do_syscall_64 (regs, regs->orig_ax);return ; }else if (ia32_enabled () && -likely (regs->fred_ss.vector ==FRED_SYSENTER && !regs->fred_ss.lm)) { +likely (regs->fred_ss.vector ==FRED_SYSENTER && !regs->fred_ss.l)) { regs->orig_ax = regs->ax; regs->ax = -ENOSYS ;do_fast_syscall_32 (regs);
arch/x86/include/asm/fred.h +1 -1
@@ -79,7 +79,7 @@ static __always_inline void fred_entry_from_kvm(unsigned int type, unsigned int .type = type, .vector = vector, .nmi = type == EVENT_TYPE_NMI, - .lm = 1, + .l = 1, };asm_fred_entry_from_kvm (ss);
arch/x86/include/asm/ptrace.h +2 -2
@@ -84,8 +84,8 @@ struct fred_ss { : 4,/* Event was incident to enclave execution */ enclave : 1, - /* CPU was in long mode */ - lm : 1, + /* CPU was in 64-bit mode */ + l : 1,/* * Nested exception during FRED delivery, not set * for #DF.
base-commit: e6b9dce0aeeb91dfc0974ab87f02454e24566182
Signature · 1 line
2.39.5
Quoted 83 lines · Andrew Cooper
FRED can only be enabled in Long Mode. This is the 64bit mode (as opposed to compatibility mode) identifier, rather than being something hard-wired at 1.
No functional change.
Reviewed-by Xin Li (Intel) <[email protected]>Reviewed-by H. Peter Anvin (Intel) <[email protected]>Signed-off-by Andrew Cooper <[email protected]>---
CC: Xin Li <[email protected]>
CC: "H. Peter Anvin" <[email protected]>
CC: Andy Lutomirski <[email protected]>
CC: Thomas Gleixner <[email protected]>
CC: Ingo Molnar <[email protected]>
CC: Borislav Petkov <[email protected]>
CC: Dave Hansen <[email protected]>
CC: [email protected]
CC: [email protected]v2:
* State no functional change.IIRC, this was wrong in an older version of the FRED spec. I made the same mistake in Xen, and I didn't copy Linux's structure.
I don't thinks this warrants backporting, but the fixes tag is:
Fixes 3c77bf02d0c0 ("x86/ptrace: Add FRED additional information to the pt_regs structure")---
arch/x86/entry/entry_fred.c | 4 ++-- arch/x86/include/asm/fred.h | 2 +- arch/x86/include/asm/ptrace.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)arch/x86/entry/entry_fred.c +2
-2@@ -78,13 +78,13 @@ static noinstr void fred_intx(struct pt_regs *regs) static __always_inline void fred_other(struct pt_regs *regs) {/* The compiler can fold these conditions into a single test */ -if (likely (regs->fred_ss.vector ==FRED_SYSCALL && regs->fred_ss.lm)) { +if (likely (regs->fred_ss.vector ==FRED_SYSCALL && regs->fred_ss.l)) { regs->orig_ax = regs->ax; regs->ax = -ENOSYS ;do_syscall_64 (regs, regs->orig_ax);return ; }else if (ia32_enabled () && -likely (regs->fred_ss.vector ==FRED_SYSENTER && !regs->fred_ss.lm)) { +likely (regs->fred_ss.vector ==FRED_SYSENTER && !regs->fred_ss.l)) { regs->orig_ax = regs->ax; regs->ax = -ENOSYS ;do_fast_syscall_32 (regs);arch/x86/include/asm/fred.h +1
-1@@ -79,7 +79,7 @@ static __always_inline void fred_entry_from_kvm(unsigned int type, unsigned int .type = type, .vector = vector, .nmi = type == EVENT_TYPE_NMI, - .lm = 1, + .l = 1, };asm_fred_entry_from_kvm (ss);arch/x86/include/asm/ptrace.h +2
-2@@ -84,8 +84,8 @@ struct fred_ss { : 4,/* Event was incident to enclave execution */ enclave : 1, - /* CPU was in long mode */ - lm : 1, + /* CPU was in 64-bit mode */ + l : 1,/* * Nested exception during FRED delivery, not set * for #DF.
Quoted 1 line
base-commit:
e6b9dce0aeeb91dfc0974ab87f02454e24566182