public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Mirsad Todorovac <mtodorovac69@gmail.com>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Daniel Sneddon <daniel.sneddon@linux.intel.com>,
	Arnd Bergmann <arnd@arndb.de>, Brian Gerst <brgerst@gmail.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
	Peter Collingbourne <pcc@google.com>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] x86/syscall: Avoid memcpy() for ia32 syscall_get_arguments()
Date: Thu, 22 Aug 2024 17:12:37 -0700	[thread overview]
Message-ID: <202408221712.DC796105C@keescook> (raw)
In-Reply-To: <842a88e0-90ae-48be-91c9-8a7c3a8359a9@intel.com>

On Thu, Jul 11, 2024 at 02:01:53PM -0700, Dave Hansen wrote:
> On 7/8/24 13:22, Kees Cook wrote:
> ...
> > diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
> > index 2fc7bc3863ff..7c488ff0c764 100644
> > --- a/arch/x86/include/asm/syscall.h
> > +++ b/arch/x86/include/asm/syscall.h
> > @@ -82,7 +82,12 @@ static inline void syscall_get_arguments(struct task_struct *task,
> >  					 struct pt_regs *regs,
> >  					 unsigned long *args)
> >  {
> > -	memcpy(args, &regs->bx, 6 * sizeof(args[0]));
> > +	args[0] = regs->bx;
> > +	args[1] = regs->cx;
> > +	args[2] = regs->dx;
> > +	args[3] = regs->si;
> > +	args[4] = regs->di;
> > +	args[5] = regs->bp;
> >  }
> >  
> 
> Yeah, that's much less magic.  I'll stick this in the queue to go in to
> the tree in a few weeks.
> 
> Acked-by: Dave Hansen <dave.hansen@linux.intel.com>

Ping. I can take it via the hardening tree if you want, though?

-- 
Kees Cook

  reply	other threads:[~2024-08-23  0:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08 20:22 [PATCH] x86/syscall: Avoid memcpy() for ia32 syscall_get_arguments() Kees Cook
2024-07-08 23:44 ` Gustavo A. R. Silva
2024-07-09 18:20   ` Mirsad Todorovac
2024-07-09 18:37     ` Gustavo A. R. Silva
2024-07-11 21:01 ` Dave Hansen
2024-08-23  0:12   ` Kees Cook [this message]
2024-07-11 21:44 ` Peter Zijlstra
2024-07-11 23:10   ` Kees Cook
2024-07-12  9:00     ` Peter Zijlstra
2024-07-12 17:55       ` Kees Cook
2024-07-15  8:37         ` Peter Zijlstra
2024-07-15 17:01           ` Kees Cook

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=202408221712.DC796105C@keescook \
    --to=kees@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=daniel.sneddon@linux.intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mtodorovac69@gmail.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=pcc@google.com \
    --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