public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Gerst <brgerst@gmail.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Brian Gerst <brgerst@gmail.com>
Subject: [PATCH 1/4] x86-32: Simplify ELF_CORE_COPY_REGS
Date: Fri, 25 Mar 2022 11:39:50 -0400	[thread overview]
Message-ID: <20220325153953.162643-2-brgerst@gmail.com> (raw)
In-Reply-To: <20220325153953.162643-1-brgerst@gmail.com>

GS is now always a user segment, so there is no difference between
user and kernel registers.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/include/asm/elf.h | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 29fea180a665..cb0ff1055ab1 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -116,7 +116,7 @@ extern unsigned int vdso32_enabled;
  * now struct_user_regs, they are different)
  */
 
-#define ELF_CORE_COPY_REGS_COMMON(pr_reg, regs)	\
+#define ELF_CORE_COPY_REGS(pr_reg, regs)	\
 do {						\
 	pr_reg[0] = regs->bx;			\
 	pr_reg[1] = regs->cx;			\
@@ -128,6 +128,7 @@ do {						\
 	pr_reg[7] = regs->ds;			\
 	pr_reg[8] = regs->es;			\
 	pr_reg[9] = regs->fs;			\
+	savesegment(gs, pr_reg[10]);		\
 	pr_reg[11] = regs->orig_ax;		\
 	pr_reg[12] = regs->ip;			\
 	pr_reg[13] = regs->cs;			\
@@ -136,18 +137,6 @@ do {						\
 	pr_reg[16] = regs->ss;			\
 } while (0);
 
-#define ELF_CORE_COPY_REGS(pr_reg, regs)	\
-do {						\
-	ELF_CORE_COPY_REGS_COMMON(pr_reg, regs);\
-	pr_reg[10] = get_user_gs(regs);		\
-} while (0);
-
-#define ELF_CORE_COPY_KERNEL_REGS(pr_reg, regs)	\
-do {						\
-	ELF_CORE_COPY_REGS_COMMON(pr_reg, regs);\
-	savesegment(gs, pr_reg[10]);		\
-} while (0);
-
 #define ELF_PLATFORM	(utsname()->machine)
 #define set_personality_64bit()	do { } while (0)
 
-- 
2.35.1


  reply	other threads:[~2022-03-25 15:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 15:39 [PATCH 0/4] x86-32: Clean up GS segment handling Brian Gerst
2022-03-25 15:39 ` Brian Gerst [this message]
2022-04-15  9:42   ` [tip: x86/core] x86/32: Simplify ELF_CORE_COPY_REGS tip-bot2 for Brian Gerst
2022-03-25 15:39 ` [PATCH 2/4] ELF: Remove elf_core_copy_kernel_regs() Brian Gerst
2022-04-13 11:41   ` Borislav Petkov
2022-04-13 12:31     ` Michael Ellerman
2022-04-15  9:42   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2022-03-25 15:39 ` [PATCH 3/4] x86-32: Remove lazy GS macros Brian Gerst
2022-04-15  9:42   ` [tip: x86/core] x86/32: " tip-bot2 for Brian Gerst
2022-03-25 15:39 ` [PATCH 4/4] x86: Merge load_gs_index() Brian Gerst
2022-04-15  9:42   ` [tip: x86/core] x86/asm: " tip-bot2 for Brian Gerst
2022-03-25 15:45 ` [PATCH 0/4] x86-32: Clean up GS segment handling Andy Lutomirski
2022-04-05 16:12 ` Thomas Gleixner

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=20220325153953.162643-2-brgerst@gmail.com \
    --to=brgerst@gmail.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --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