linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Peter Zijlstra' <peterz@infradead.org>
Cc: 'Mathieu Desnoyers' <mathieu.desnoyers@efficios.com>,
	Christian Brauner <christian.brauner@ubuntu.com>,
	Christian Brauner <brauner@kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	paulmck <paulmck@kernel.org>, Boqun Feng <boqun.feng@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Paul Turner <pjt@google.com>,
	linux-api <linux-api@vger.kernel.org>,
	Florian Weimer <fw@deneb.enyo.de>, carlos <carlos@redhat.com>
Subject: RE: [RFC PATCH v2 1/2] rseq: x86: implement abort-at-ip extension
Date: Wed, 12 Jan 2022 15:53:52 +0000	[thread overview]
Message-ID: <d3276adfc6b34cf0a9a4497f276c4bf0@AcuMS.aculab.com> (raw)
In-Reply-To: <Yd708EjQNEa9dFXZ@hirez.programming.kicks-ass.net>

From: Peter Zijlstra 
> Sent: 12 January 2022 15:34
> 
> On Wed, Jan 12, 2022 at 03:15:27PM +0000, David Laight wrote:
> > From: Mathieu Desnoyers
> > > Sent: 12 January 2022 15:06
> > >
> > > ----- On Jan 12, 2022, at 9:58 AM, David Laight David.Laight@ACULAB.COM wrote:
> > >
> > > >>  * [*] The openrisc, powerpc64 and x86-64 architectures define a "redzone" as a
> > > >>  *     stack area beyond the stack pointer which can be used by the compiler
> > > >>  *     to store local variables in leaf functions.
> > > >
> > > > I wonder if that is really worth the trouble it causes!
> > > > By the time a function is spilling values to stack the cost
> > > > of a %sp update is almost certainly noise.
> > > >
> > > > Someone clearly thought it was a 'good idea (tm)'.
> > >
> > > I must admit that I've been surprised to learn about these redzones. Thanks for
> > > pointing them out to me, it was clearly a blind spot. I suspect it would be useful
> > > to introduce per-architecture KERNEL_REDZONE, USER_REDZONE and COMPAT_USER_REDZONE
> > > with a asm-generic version defining them to 0, with proper documentation. It would
> > > make it clearer to kernel developers working on stuff similar to signal handler
> > > delivery that they need to consider these carefully.
> >
> > They can never be used in kernel - any ISR would overwrite them.
> 
> That depends on how the architecture does exceptions;

True, many newer ones don't actually write anything to the stack.
Makes the cpu simpler.

> also consider:
> 
>   https://www.intel.com/content/www/us/en/develop/download/flexible-return-and-event-delivery-
> specification.html

That contains the snippet:
	The SWAPGS instruction supports efficient updates of the GS base address.

Which is just so horribly not true...
Even FRED is always doing a GS swap - so you can easily lose the kernel GS value.

I remember fixing all the 'in kernel' faults in the netbsd x86-64 return to user path.
Entirely horrid...

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


      reply	other threads:[~2022-01-12 15:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 17:16 [RFC PATCH v2 1/2] rseq: x86: implement abort-at-ip extension Mathieu Desnoyers
2022-01-10 17:16 ` [RFC PATCH v2 2/2] selftests: rseq: test abort-at-ip extension on x86 Mathieu Desnoyers
2022-01-11 11:05 ` [RFC PATCH v2 1/2] rseq: x86: implement abort-at-ip extension Christian Brauner
2022-01-11 17:43   ` Mathieu Desnoyers
2022-01-12  8:46     ` Christian Brauner
2022-01-12 14:47       ` Mathieu Desnoyers
2022-01-12 14:55         ` Christian Brauner
2022-01-12 14:58         ` David Laight
2022-01-12 15:05           ` Mathieu Desnoyers
2022-01-12 15:15             ` David Laight
2022-01-12 15:24               ` Mathieu Desnoyers
2022-01-12 15:34               ` Peter Zijlstra
2022-01-12 15:53                 ` David Laight [this message]

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=d3276adfc6b34cf0a9a4497f276c4bf0@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=boqun.feng@gmail.com \
    --cc=brauner@kernel.org \
    --cc=carlos@redhat.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=fw@deneb.enyo.de \
    --cc=hpa@zytor.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).