* [PATCH] x86/fred: Fix 64bit identifier in fred_ss
@ 2025-08-14 19:04 Andrew Cooper
2025-08-15 3:55 ` Xin Li
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Andrew Cooper @ 2025-08-14 19:04 UTC (permalink / raw)
To: LKML
Cc: Andrew Cooper, Xin Li, H. Peter Anvin, Andy Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86
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 <andrew.cooper3@citrix.com>
---
CC: Xin Li <xin@zytor.com>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Andy Lutomirski <luto@kernel.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: Borislav Petkov <bp@alien8.de>
CC: Dave Hansen <dave.hansen@linux.intel.com>
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org
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(-)
diff --git a/arch/x86/entry/entry_fred.c b/arch/x86/entry/entry_fred.c
index f004a4dc74c2..94e626cc6a07 100644
--- a/arch/x86/entry/entry_fred.c
+++ b/arch/x86/entry/entry_fred.c
@@ -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);
diff --git a/arch/x86/include/asm/fred.h b/arch/x86/include/asm/fred.h
index 12b34d5b2953..2bb65677c079 100644
--- a/arch/x86/include/asm/fred.h
+++ b/arch/x86/include/asm/fred.h
@@ -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);
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 50f75467f73d..37370c3b1ffd 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -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
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/fred: Fix 64bit identifier in fred_ss
2025-08-14 19:04 [PATCH] x86/fred: Fix 64bit identifier in fred_ss Andrew Cooper
@ 2025-08-15 3:55 ` Xin Li
2025-08-15 16:21 ` H. Peter Anvin
2025-09-02 23:01 ` [PATCH v2] " Andrew Cooper
2 siblings, 0 replies; 5+ messages in thread
From: Xin Li @ 2025-08-15 3:55 UTC (permalink / raw)
To: Andrew Cooper, LKML
Cc: H. Peter Anvin, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86
On 8/14/2025 12:04 PM, Andrew Cooper wrote:
> 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 <andrew.cooper3@citrix.com>
> ---
> CC: Xin Li <xin@zytor.com>
> CC: "H. Peter Anvin" <hpa@zytor.com>
> CC: Andy Lutomirski <luto@kernel.org>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Ingo Molnar <mingo@redhat.com>
> CC: Borislav Petkov <bp@alien8.de>
> CC: Dave Hansen <dave.hansen@linux.intel.com>
> CC: x86@kernel.org
> CC: linux-kernel@vger.kernel.org
>
> 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.
Reviewed-by: Xin Li (Intel) <xin@zytor.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/fred: Fix 64bit identifier in fred_ss
2025-08-14 19:04 [PATCH] x86/fred: Fix 64bit identifier in fred_ss Andrew Cooper
2025-08-15 3:55 ` Xin Li
@ 2025-08-15 16:21 ` H. Peter Anvin
2025-09-02 23:01 ` [PATCH v2] " Andrew Cooper
2 siblings, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2025-08-15 16:21 UTC (permalink / raw)
To: Andrew Cooper, LKML
Cc: Xin Li, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86
On 2025-08-14 12:04, Andrew Cooper wrote:
> 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 <andrew.cooper3@citrix.com>
[...]
> 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:
Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] x86/fred: Fix 64bit identifier in fred_ss
2025-08-14 19:04 [PATCH] x86/fred: Fix 64bit identifier in fred_ss Andrew Cooper
2025-08-15 3:55 ` Xin Li
2025-08-15 16:21 ` H. Peter Anvin
@ 2025-09-02 23:01 ` Andrew Cooper
2025-09-03 0:01 ` H. Peter Anvin
2 siblings, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2025-09-02 23:01 UTC (permalink / raw)
To: LKML
Cc: Andrew Cooper, Xin Li, H . Peter Anvin, Andy Lutomirski,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86
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) <xin@zytor.com>
Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Xin Li <xin@zytor.com>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Andy Lutomirski <luto@kernel.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: Borislav Petkov <bp@alien8.de>
CC: Dave Hansen <dave.hansen@linux.intel.com>
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org
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(-)
diff --git a/arch/x86/entry/entry_fred.c b/arch/x86/entry/entry_fred.c
index f004a4dc74c2..94e626cc6a07 100644
--- a/arch/x86/entry/entry_fred.c
+++ b/arch/x86/entry/entry_fred.c
@@ -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);
diff --git a/arch/x86/include/asm/fred.h b/arch/x86/include/asm/fred.h
index 12b34d5b2953..2bb65677c079 100644
--- a/arch/x86/include/asm/fred.h
+++ b/arch/x86/include/asm/fred.h
@@ -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);
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 50f75467f73d..37370c3b1ffd 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -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
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] x86/fred: Fix 64bit identifier in fred_ss
2025-09-02 23:01 ` [PATCH v2] " Andrew Cooper
@ 2025-09-03 0:01 ` H. Peter Anvin
0 siblings, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2025-09-03 0:01 UTC (permalink / raw)
To: Andrew Cooper, LKML
Cc: Xin Li, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86
On September 2, 2025 4:01:17 PM PDT, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>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) <xin@zytor.com>
>Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
>Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>---
>CC: Xin Li <xin@zytor.com>
>CC: "H. Peter Anvin" <hpa@zytor.com>
>CC: Andy Lutomirski <luto@kernel.org>
>CC: Thomas Gleixner <tglx@linutronix.de>
>CC: Ingo Molnar <mingo@redhat.com>
>CC: Borislav Petkov <bp@alien8.de>
>CC: Dave Hansen <dave.hansen@linux.intel.com>
>CC: x86@kernel.org
>CC: linux-kernel@vger.kernel.org
>
>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(-)
>
>diff --git a/arch/x86/entry/entry_fred.c b/arch/x86/entry/entry_fred.c
>index f004a4dc74c2..94e626cc6a07 100644
>--- a/arch/x86/entry/entry_fred.c
>+++ b/arch/x86/entry/entry_fred.c
>@@ -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);
>diff --git a/arch/x86/include/asm/fred.h b/arch/x86/include/asm/fred.h
>index 12b34d5b2953..2bb65677c079 100644
>--- a/arch/x86/include/asm/fred.h
>+++ b/arch/x86/include/asm/fred.h
>@@ -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);
>diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
>index 50f75467f73d..37370c3b1ffd 100644
>--- a/arch/x86/include/asm/ptrace.h
>+++ b/arch/x86/include/asm/ptrace.h
>@@ -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
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-03 0:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14 19:04 [PATCH] x86/fred: Fix 64bit identifier in fred_ss Andrew Cooper
2025-08-15 3:55 ` Xin Li
2025-08-15 16:21 ` H. Peter Anvin
2025-09-02 23:01 ` [PATCH v2] " Andrew Cooper
2025-09-03 0:01 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).