All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Brian Gerst <brgerst@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>, Steven Rostedt <rostedt@goodmis.org>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: Why is irq_stack_union a union?
Date: Tue, 1 Sep 2015 14:42:28 -0700	[thread overview]
Message-ID: <CALCETrVME33SKP9sURj5S_1sFmLH5csHCHBJZppCLY3uncXrOA@mail.gmail.com> (raw)
In-Reply-To: <CAMzpN2hDmLyW2rC6kA2xc609t2LRAAZrSRb5gf+D=Ami30jCCg@mail.gmail.com>

On Mon, Aug 31, 2015 at 8:55 PM, Brian Gerst <brgerst@gmail.com> wrote:
> On Mon, Aug 31, 2015 at 6:01 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>> On Mon, Aug 31, 2015 at 2:47 PM, Brian Gerst <brgerst@gmail.com> wrote:
>>> On Mon, Aug 31, 2015 at 5:00 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>>>> Why not just a struct? Also, why is this all tangled up in gsbase initialization?
>>>
>>> It has to do with the fact that the GCC stackprotector is hardcoded to
>>> look for the canary at %gs:40.  Since we also use %gs for the percpu
>>> segment, we have to make sure that the canary is placed at the start
>>> of the percpu section.  Overlaying it onto the bottom of the IRQ stack
>>> and was the most convenient way to do it, with a side benefit that
>>> overflowing the stack will trip the canary.
>>
>> Would a struct not make more sense, then?
>
> Why would it?  A union shows the overlay better.

I guess you're thinking of it as an overlay and I'm thinking of it as
the layout being the IRQ stack directly above the stack canary.

--Andy

>
> --
> Brian Gerst



-- 
Andy Lutomirski
AMA Capital Management, LLC

      reply	other threads:[~2015-09-01 21:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31 21:00 Why is irq_stack_union a union? Andy Lutomirski
2015-08-31 21:47 ` Brian Gerst
2015-08-31 22:01   ` Andy Lutomirski
2015-09-01  3:55     ` Brian Gerst
2015-09-01 21:42       ` Andy Lutomirski [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=CALCETrVME33SKP9sURj5S_1sFmLH5csHCHBJZppCLY3uncXrOA@mail.gmail.com \
    --to=luto@amacapital.net \
    --cc=andi@firstfloor.org \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.