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  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]
Date:   Fri, 24 Nov 2017 17:23:02 -0800
From:   Eduardo Valentin <eduval@...zon.com>
To:     Dave Hansen <dave.hansen@...ux.intel.com>
CC:     <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
        <moritz.lipp@...k.tugraz.at>, <daniel.gruss@...k.tugraz.at>,
        <michael.schwarz@...k.tugraz.at>,
        <richard.fellner@...dent.tugraz.at>, <luto@...nel.org>,
        <torvalds@...ux-foundation.org>, <keescook@...gle.com>,
        <hughd@...gle.com>, <x86@...nel.org>, <aliguori@...zon.com>
Subject: Re: [PATCH 20/23] x86, kaiser: add a function to check for KAISER
 being enabled

On Wed, Nov 22, 2017 at 04:35:18PM -0800, Dave Hansen wrote:
> 
> From: Dave Hansen <dave.hansen@...ux.intel.com>
> 
> Currently, all of the checks for KAISER are compile-time checks.
> 
> Runtime checks are needed for turning it on/off at runtime.
> 
> Add a function to do that.
> 
> Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Moritz Lipp <moritz.lipp@...k.tugraz.at>
> Cc: Daniel Gruss <daniel.gruss@...k.tugraz.at>
> Cc: Michael Schwarz <michael.schwarz@...k.tugraz.at>
> Cc: Richard Fellner <richard.fellner@...dent.tugraz.at>
> Cc: Andy Lutomirski <luto@...nel.org>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Kees Cook <keescook@...gle.com>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: x86@...nel.org
> ---
> 
>  b/arch/x86/include/asm/kaiser.h |    5 +++++
>  b/include/linux/kaiser.h        |    5 +++++
>  2 files changed, 10 insertions(+)
> 
> diff -puN arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func arch/x86/include/asm/kaiser.h
> --- a/arch/x86/include/asm/kaiser.h~kaiser-dynamic-check-func	2017-11-22 15:45:55.262619723 -0800
> +++ b/arch/x86/include/asm/kaiser.h	2017-11-22 15:45:55.267619723 -0800
> @@ -56,6 +56,11 @@ extern void kaiser_remove_mapping(unsign
>   */
>  extern void kaiser_init(void);
>  
> +static inline bool kaiser_active(void)
> +{
> +	extern int kaiser_enabled;

Should this really be extern ? 

I am getting a compilation error while linking the bzImage with this series:
arch/x86/boot/compressed/pagetable.o: In function `kernel_ident_mapping_init':
pagetable.c:(.text+0x336): undefined reference to `kaiser_enabled'
arch/x86/boot/compressed/Makefile:109: recipe for target 'arch/x86/boot/compressed/vmlinux' failed
make[2]: *** [arch/x86/boot/compressed/vmlinux] Error 1
arch/x86/boot/Makefile:112: recipe for target 'arch/x86/boot/compressed/vmlinux' failed
make[1]: *** [arch/x86/boot/compressed/vmlinux] Error 2
arch/x86/Makefile:296: recipe for target 'bzImage' failed
make: *** [bzImage] Error 2

What I did was to remove the extern and  EXPORT_SYMBOL(kaiser_enabled) and initialize kaiser_enabled as 0, after that I got a proper bzImage.

> +	return kaiser_enabled;
> +}
>  #endif
>  
>  #endif /* __ASSEMBLY__ */
> diff -puN include/linux/kaiser.h~kaiser-dynamic-check-func include/linux/kaiser.h
> --- a/include/linux/kaiser.h~kaiser-dynamic-check-func	2017-11-22 15:45:55.264619723 -0800
> +++ b/include/linux/kaiser.h	2017-11-22 15:45:55.268619723 -0800
> @@ -28,5 +28,10 @@ static inline int kaiser_add_mapping(uns
>  static inline void kaiser_add_mapping_cpu_entry(int cpu)
>  {
>  }
> +
> +static inline bool kaiser_active(void)
> +{
> +	return 0;
> +}
>  #endif /* !CONFIG_KAISER */
>  #endif /* _INCLUDE_KAISER_H */
> _
> 

-- 
All the best,
Eduardo Valentin

Powered by blists - more mailing lists