lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKv+Gu9Ycs8JRvimxfFMRy=tQ0SqX3MYnv0VfUPVAE_Q1S0y1A@mail.gmail.com>
Date:   Tue, 17 Dec 2019 08:32:39 +0000
From:   Ard Biesheuvel <ard.biesheuvel@...aro.org>
To:     Arvind Sankar <nivedita@...m.mit.edu>
Cc:     Ard Biesheuvel <ardb@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-efi <linux-efi@...r.kernel.org>,
        Hans de Goede <hdegoede@...hat.com>,
        Matthew Garrett <matthewgarrett@...gle.com>,
        Ingo Molnar <mingo@...nel.org>,
        Andy Lutomirski <luto@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 10/10] efi/libstub/x86: avoid thunking for native firmware calls

On Sun, 15 Dec 2019 at 21:31, Arvind Sankar <nivedita@...m.mit.edu> wrote:
>
> On Sat, Dec 14, 2019 at 06:57:35PM +0100, Ard Biesheuvel wrote:
> >
> > @@ -232,7 +232,7 @@ static inline bool efi_is_native(void)
> >  #define efi_table_attr(table, attr, instance) ({                     \
> >       __typeof__(((table##_t *)0)->attr) __ret;                       \
> >       if (efi_is_native()) {                                          \
> > -             __ret = ((table##_t *)instance)->attr;                  \
> > +             __ret = instance->attr;                                 \
> >       } else {                                                        \
> >               __typeof__(((table##_32_t *)0)->attr) at;               \
> >               at = (((table##_32_t *)(unsigned long)instance)->attr); \
>
> Is there a reason we didn't remove this cast for native-mode earlier in
> the series?
>

Yes. In patch 9/10, I fix a couple of occurrences where the protocol
pointer is a void*, so without the cast, things break.

> > @@ -242,19 +242,25 @@ static inline bool efi_is_native(void)
> >  })
> >
> >  #define efi_call_proto(protocol, f, instance, ...)                   \
> > -     __efi_early()->call((unsigned long)                             \
> > +     efi_is_native()                                                 \
> > +             ? instance->f(instance, ##__VA_ARGS__)                  \
> > +             : efi64_thunk((unsigned long)                           \
> >                               efi_table_attr(protocol, f, instance),  \
> > -             instance, ##__VA_ARGS__)
> > +                     instance, ##__VA_ARGS__)
> >
> >  #define efi_call_early(f, ...)                                               \
> > -     __efi_early()->call((unsigned long)                             \
> > +     efi_is_native()                                                 \
> > +             ? __efi_early()->boot_services->f(__VA_ARGS__)          \
> > +             : efi64_thunk((unsigned long)                           \
> >                               efi_table_attr(efi_boot_services, f,    \
> > -             __efi_early()->boot_services), __VA_ARGS__)
> > +                     __efi_early()->boot_services), __VA_ARGS__)
> >
> >  #define efi_call_runtime(f, ...)                                     \
> > -     __efi_early()->call((unsigned long)                             \
> > +     efi_is_native()                                                 \
> > +             ? __efi_early()->runtime_services->f(__VA_ARGS__)       \
> > +             : efi64_thunk((unsigned long)                           \
> >                               efi_table_attr(efi_runtime_services, f, \
> > -             __efi_early()->runtime_services), __VA_ARGS__)
> > +                     __efi_early()->runtime_services), __VA_ARGS__)
> >
> >  extern bool efi_reboot_required(void);
> >  extern bool efi_is_table_address(unsigned long phys_addr);
>
> For the efi_call macros, their definition should be enclosed in
> parentheses now that it's a ternary operator.

Ack

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ