lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMzpN2jjcBtr73iuw8QaJ6MQxnnSRzr2SqDDKhfyDVnRETzLPg@mail.gmail.com>
Date: Mon, 3 Mar 2025 19:25:06 -0500
From: Brian Gerst <brgerst@...il.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, 
	Ingo Molnar <mingo@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH] x86/asm: Merge KSTK_ESP() implementations

On Mon, Mar 3, 2025 at 7:01 PM H. Peter Anvin <hpa@...or.com> wrote:
>
> On March 3, 2025 10:31:11 AM PST, Brian Gerst <brgerst@...il.com> wrote:
> >Commit 263042e4630a ("Save user RSP in pt_regs->sp on SYSCALL64
> >fastpath") simplified the 64-bit implementation of KSTK_ESP() which is
> >now identical to 32-bit.  Merge them into a common definition.
> >
> >No functional change.
> >
> >Signed-off-by: Brian Gerst <brgerst@...il.com>
> >---
> > arch/x86/include/asm/processor.h | 5 +----
> > arch/x86/kernel/process_64.c     | 5 -----
> > 2 files changed, 1 insertion(+), 9 deletions(-)
> >
> >diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> >index a969bea1ed07..55f0e48413b0 100644
> >--- a/arch/x86/include/asm/processor.h
> >+++ b/arch/x86/include/asm/processor.h
> >@@ -652,8 +652,6 @@ static __always_inline void prefetchw(const void *x)
> >       .sysenter_cs            = __KERNEL_CS,                            \
> > }
> >
> >-#define KSTK_ESP(task)                (task_pt_regs(task)->sp)
> >-
> > #else
> > extern unsigned long __top_init_kernel_stack[];
> >
> >@@ -661,8 +659,6 @@ extern unsigned long __top_init_kernel_stack[];
> >       .sp     = (unsigned long)&__top_init_kernel_stack,              \
> > }
> >
> >-extern unsigned long KSTK_ESP(struct task_struct *task);
> >-
> > #endif /* CONFIG_X86_64 */
> >
> > extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
> >@@ -676,6 +672,7 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
> > #define TASK_UNMAPPED_BASE            __TASK_UNMAPPED_BASE(TASK_SIZE_LOW)
> >
> > #define KSTK_EIP(task)                (task_pt_regs(task)->ip)
> >+#define KSTK_ESP(task)                (task_pt_regs(task)->sp)
> >
> > /* Get/set a process' ability to use the timestamp counter instruction */
> > #define GET_TSC_CTL(adr)      get_tsc_mode((adr))
> >diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
> >index 4ca73ddfb30b..f983d2a57ac3 100644
> >--- a/arch/x86/kernel/process_64.c
> >+++ b/arch/x86/kernel/process_64.c
> >@@ -979,8 +979,3 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
> >
> >       return ret;
> > }
> >-
> >-unsigned long KSTK_ESP(struct task_struct *task)
> >-{
> >-      return task_pt_regs(task)->sp;
> >-}
> >
> >base-commit: 693c8502970a533363e9ece482c80bb6db0c12a5
>
> Why using the macro version?

Why call an out-of-line function?  I guess it could be an inline
function (along with KSK_EIP()).


Brian Gerst

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ