mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikolay Borisov <nik.borisov@suse.com>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, mohocko@suse.com, jslaby@suse.cz,
	Nikolay Borisov <nik.borisov@suse.com>
Subject: [PATCH v4 2/6] x86/entry: Rename ignore_sysret()
Date: Fri, 23 Jun 2023 14:14:05 +0300	[thread overview]
Message-ID: <20230623111409.3047467-3-nik.borisov@suse.com> (raw)
In-Reply-To: <20230623111409.3047467-1-nik.borisov@suse.com>

The SYSCALL instruction cannot really be disabled in compatibility mode.
The best that can be done is to configure the CSTAR msr to point to a
minimal handler. Currently this handler has a rather misleading name -
ignore_sysret() as it's not really doing anything with sysret.

Give it a more descriptive name.

Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
---
 arch/x86/entry/entry_64.S        | 4 ++--
 arch/x86/include/asm/processor.h | 2 +-
 arch/x86/kernel/cpu/common.c     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index f31e286c2977..ccce0ccd8589 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1519,12 +1519,12 @@ SYM_CODE_END(asm_exc_nmi)
  * This handles SYSCALL from 32-bit code.  There is no way to program
  * MSRs to fully disable 32-bit SYSCALL.
  */
-SYM_CODE_START(ignore_sysret)
+SYM_CODE_START(entry_SYSCALL32_ignore)
 	UNWIND_HINT_END_OF_STACK
 	ENDBR
 	mov	$-ENOSYS, %eax
 	sysretl
-SYM_CODE_END(ignore_sysret)
+SYM_CODE_END(entry_SYSCALL32_ignore)
 #endif
 
 .pushsection .text, "ax"
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index a1e4fa58b357..61c10b4e3e35 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -399,7 +399,7 @@ static inline unsigned long cpu_kernelmode_gs_base(int cpu)
 	return (unsigned long)per_cpu(fixed_percpu_data.gs_base, cpu);
 }
 
-extern asmlinkage void ignore_sysret(void);
+extern asmlinkage void entry_SYSCALL32_ignore(void);
 
 /* Save actual FS/GS selectors and bases to current->thread */
 void current_save_fsgs(void);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 80710a68ef7d..b20774181e1a 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -2066,7 +2066,7 @@ void syscall_init(void)
 		    (unsigned long)(cpu_entry_stack(smp_processor_id()) + 1));
 	wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat);
 #else
-	wrmsrl_cstar((unsigned long)ignore_sysret);
+	wrmsrl_cstar((unsigned long)entry_SYSCALL32_ignore);
 	wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG);
 	wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL);
 	wrmsrl_safe(MSR_IA32_SYSENTER_EIP, 0ULL);
-- 
2.34.1


  parent reply	other threads:[~2023-06-23 11:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 11:14 [PATCH v4 0/6] Make IA32_EMULATION boot time overridable Nikolay Borisov
2023-06-23 11:14 ` [PATCH v4 1/6] x86: Introduce ia32_enabled() Nikolay Borisov
2023-06-30 11:18   ` Thomas Gleixner
2023-06-30 11:44     ` Thomas Gleixner
2023-09-14 11:27   ` [tip: x86/entry] " tip-bot2 for Nikolay Borisov
2023-06-23 11:14 ` Nikolay Borisov [this message]
2023-09-14 11:27   ` [tip: x86/entry] x86/entry: Rename ignore_sysret() tip-bot2 for Nikolay Borisov
2023-06-23 11:14 ` [PATCH v4 3/6] x86/entry: Compile entry_SYSCALL32_ignore() unconditionally Nikolay Borisov
2023-09-14 11:27   ` [tip: x86/entry] " tip-bot2 for Nikolay Borisov
2023-06-23 11:14 ` [PATCH v4 4/6] x86/elf: Make loading of 32bit processes depend on ia32_enabled() Nikolay Borisov
2023-09-14 11:27   ` [tip: x86/entry] " tip-bot2 for Nikolay Borisov
2023-06-23 11:14 ` [PATCH v4 5/6] x86/entry: Make IA32 syscalls' availability " Nikolay Borisov
2023-09-14 11:27   ` [tip: x86/entry] " tip-bot2 for Nikolay Borisov
2023-06-23 11:14 ` [PATCH v4 6/6] x86: Make IA32_EMULATION boot time configurable Nikolay Borisov
2023-09-14 11:27   ` [tip: x86/entry] " tip-bot2 for Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230623111409.3047467-3-nik.borisov@suse.com \
    --to=nik.borisov@suse.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mohocko@suse.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®