linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org,  linux-efi@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	 Peter Jones <pjones@redhat.com>,
	Daniel Berrange <berrange@redhat.com>,
	 Emanuele Giuseppe Esposito <eesposit@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	 Luca Boccassi <bluca@debian.org>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	 James Bottomley <James.Bottomley@hansenpartnership.com>,
	 Eric Snowberg <eric.snowberg@oracle.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2 2/2] x86/efi: Implement support for embedding SBAT data for x86
Date: Tue, 13 May 2025 13:22:41 +0100	[thread overview]
Message-ID: <CAMj1kXFpO+qya2Nngrj-eUPXQo4WMd2ZRn5EqD-46J85hLMSeg@mail.gmail.com> (raw)
In-Reply-To: <8734d9oosf.fsf@redhat.com>

On Mon, 12 May 2025 at 16:02, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
> Ard Biesheuvel <ardb@kernel.org> writes:
>
> > On Mon, 5 May 2025 at 17:46, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
> >>
...
> >> +       .ascii  ".text\0\0\0"
> >> +#ifdef CONFIG_EFI_SBAT
> >> +       .long   ZO__sbat                        # VirtualSize
> >> +       .long   setup_size                      # VirtualAddress
> >> +       .long   ZO__sbat                        # SizeOfRawData
> >> +#else
> >> +       .long   ZO__data                        # VirtualSize
> >> +       .long   setup_size                      # VirtualAddress
> >> +       .long   ZO__data                        # SizeOfRawData
> >> +#endif
> >> +       .long   setup_size                      # PointerToRawData
> >
> > Would it work if we do the following here
> >
> > #ifdef CONFIG_EFI_SBAT
> >   .set .Ltextsize, ZO__sbat
> > #else
> >   .set .Ltextsize, ZO__data
> > #endif
> >
> > and keep a single section definition for .text
> >
> >   .ascii  ".text\0\0\0"
> >   .long   .Ltextsize                  # VirtualSize
> >   .long   setup_size                  # VirtualAddress
> >   .long   .Ltextsize                  # SizeOfRawData
> >   .long   setup_size                  # PointerToRawData
> >
>
> As we already have '#ifdef CONFIG_EFI_SBAT' below I'd suggest we set
> textsize there, basically:
>
> @@ -199,16 +194,20 @@ pecompat_fstart:
>                 IMAGE_SCN_MEM_EXECUTE           # Characteristics
>
>  #ifdef CONFIG_EFI_SBAT
> -       .ascii ".sbat\0\0\0"
> -       .long   ZO__esbat - ZO__sbat            # VirtualSize
> -       .long   setup_size + ZO__sbat           # VirtualAddress
> -       .long   ZO__esbat - ZO__sbat            # SizeOfRawData
> -       .long   setup_size + ZO__sbat           # PointerToRawData
> +       .ascii  ".sbat\0\0\0"
> +       .long   ZO__esbat - ZO__sbat            # VirtualSize
> +       .long   setup_size + ZO__sbat           # VirtualAddress
> +       .long   ZO__esbat - ZO__sbat            # SizeOfRawData
> +       .long   setup_size + ZO__sbat           # PointerToRawData
>
>         .long   0, 0, 0
>         .long   IMAGE_SCN_CNT_INITIALIZED_DATA  | \
>                 IMAGE_SCN_MEM_READ              | \
>                 IMAGE_SCN_MEM_DISCARDABLE       # Characteristics
> +
> +       .set textsize, ZO__sbat
> +#else
> +       .set textsize, ZO__data
>  #endif
>
>         .ascii  ".data\0\0\0"
>
> and nobody seems to care that we use it first and define/set it later.
>

Yeah that looks fine.

> BTW, does '.L' prefix you suggest has a meaning here? I see we don't use
> it for e.g. 'pecompat_fstart', 'section_count'.
>

The .L prefix prevents the symbols from ending up in the ELF file -
you can drop it if you like, it doesn't really matter one way or the
other.

      reply	other threads:[~2025-05-13 12:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 15:45 [PATCH v2 0/2] efi: Add a mechanism for embedding SBAT section Vitaly Kuznetsov
2025-05-05 15:45 ` [PATCH v2 1/2] efi: zboot specific " Vitaly Kuznetsov
2025-05-09  9:16   ` Ard Biesheuvel
2025-05-05 15:45 ` [PATCH v2 2/2] x86/efi: Implement support for embedding SBAT data for x86 Vitaly Kuznetsov
2025-05-09  9:20   ` Ard Biesheuvel
2025-05-12 15:02     ` Vitaly Kuznetsov
2025-05-13 12:22       ` Ard Biesheuvel [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=CAMj1kXFpO+qya2Nngrj-eUPXQo4WMd2ZRn5EqD-46J85hLMSeg@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=berrange@redhat.com \
    --cc=bluca@debian.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=eesposit@redhat.com \
    --cc=eric.snowberg@oracle.com \
    --cc=hpa@zytor.com \
    --cc=kraxel@redhat.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=pbonzini@redhat.com \
    --cc=pjones@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).