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: <20191215193054.GA2187004@rani.riverdale.lan>
Date:   Sun, 15 Dec 2019 14:30:58 -0500
From:   Arvind Sankar <nivedita@...m.mit.edu>
To:     Ard Biesheuvel <ardb@...nel.org>
Cc:     linux-kernel@...r.kernel.org, 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>,
        Arvind Sankar <nivedita@...m.mit.edu>
Subject: Re: [PATCH 10/10] efi/libstub/x86: avoid thunking for native
 firmware calls

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?

> @@ -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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ