Linux EFI development
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Arvind Sankar <nivedita@alum.mit.edu>,
	Andy Lutomirski <luto@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-efi <linux-efi@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>
Subject: Re: [PATCH 1/3] efi/x86: simplify 64-bit EFI firmware call wrapper
Date: Sat, 28 Dec 2019 17:00:52 +0800	[thread overview]
Message-ID: <63CD3BC7-8BA7-41D4-9818-48827BBE3573@amacapital.net> (raw)
In-Reply-To: <CAKv+Gu9WF4iRQy9qpxaeFg+3CJkcDXxGePpn4f5ZnaA5yj4cmw@mail.gmail.com>



> On Dec 28, 2019, at 4:51 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> 
> On Sat, 28 Dec 2019 at 08:03, Andy Lutomirski <luto@amacapital.net> wrote:
>> 
>> 
>> 
>>>> On Dec 28, 2019, at 2:35 PM, Arvind Sankar <nivedita@alum.mit.edu> wrote:
>>> 
>>> On Sat, Dec 28, 2019 at 01:29:00PM +0800, Andy Lutomirski wrote:
>>>> 
>>>>> * The stack must be 16-byte aligned
>>>> 
>>>> Nope. The asm needs to do this for runtime services. The kernel runs with 8-byte stack alignment.
>>>> 
>>> 32-bit code is actually only 4-byte aligned in the kernel proper, right?
>> 
>> Right. By “8” I meant “long”.  Sorry.
>> 
>>> 
>>> Currently, only native 64-bit calls always respect the 16-byte alignment
>>> requirement, by aligning explicitly in the asm stubs, or after the
>>> cleanup patches, via the efi bootloader running with 16-byte stack
>>> alignment.
>>> 
>>> I think mixed mode might actually be aligned via the asm stub in the
>>> kernel proper, though it doesn't look like it is in the bootloader
>>> portion.
>> 
>> The underlying problem is that gcc doesn’t give us a way to do CALL from asm while preserving more than a single word of alignment. This forces us to compile the kernel proper with reduced alignment.  (Also, the generated code is better with reduced alignment.)
> 
> At runtime, the 64-bit kernel always uses a 16 byte aligned stack when
> calling into EFI (32 or 64 bit), either by aligning the stack pointer,
> or by switching to a special stack.

Can you point me at the stack switching code?  Stack switches always make me nervous due to interactions with other things, especially NMIs.

  reply	other threads:[~2019-12-28  9:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26 15:14 [PATCH 0/3] efi/x86: clean up and simplify runtime call wrappers Ard Biesheuvel
2019-12-26 15:14 ` [PATCH 1/3] efi/x86: simplify 64-bit EFI firmware call wrapper Ard Biesheuvel
2019-12-27  2:42   ` Andy Lutomirski
2019-12-27 17:51   ` Arvind Sankar
2019-12-27 18:08     ` Arvind Sankar
2019-12-27 18:13       ` Ard Biesheuvel
2019-12-28  3:25         ` Andy Lutomirski
2019-12-28  4:43           ` Arvind Sankar
2019-12-28  5:29             ` Andy Lutomirski
2019-12-28  6:35               ` Arvind Sankar
2019-12-28  7:03                 ` Andy Lutomirski
2019-12-28  8:51                   ` Ard Biesheuvel
2019-12-28  9:00                     ` Andy Lutomirski [this message]
2019-12-28  9:27                       ` Ard Biesheuvel
2019-12-26 15:14 ` [PATCH 2/3] efi/x86: simplify i386 efi_call_phys() " Ard Biesheuvel
2019-12-26 15:14 ` [PATCH 3/3] efi/x86: simplify mixed mode " Ard Biesheuvel
2019-12-27  2:56   ` Andy Lutomirski
2019-12-27  8:04     ` Ard Biesheuvel
2019-12-27  4:34   ` Arvind Sankar
2019-12-27  8:05     ` Ard Biesheuvel
2019-12-27 12:52       ` Arvind Sankar

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=63CD3BC7-8BA7-41D4-9818-48827BBE3573@amacapital.net \
    --to=luto@amacapital.net \
    --cc=ard.biesheuvel@linaro.org \
    --cc=ardb@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=nivedita@alum.mit.edu \
    /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