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]
Date:   Tue, 21 Nov 2017 08:20:37 +0100
From:   Ingo Molnar <mingo@...nel.org>
To:     Andy Lutomirski <luto@...nel.org>
Cc:     X86 ML <x86@...nel.org>, Borislav Petkov <bpetkov@...e.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Brian Gerst <brgerst@...il.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH 11/16] x86/asm/64: Use a percpu trampoline stack for IDT
 entries


* Andy Lutomirski <luto@...nel.org> wrote:

> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index 1ea03027a4a9..e4a941be96cf 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c

> -asmlinkage __visible notrace
> +asmlinkage __visible notrace __no_sanitize_address
>  struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
>  {
>  	/*
>  	 * This is called from entry_64.S early in handling a fault
>  	 * caused by a bad iret to user mode.  To handle the fault
> -	 * correctly, we want move our stack frame to task_pt_regs
> -	 * and we want to pretend that the exception came from the
> -	 * iret target.
> +	 * correctly, we want move our stack frame to where it would
> +	 * be had we entered directly on the entry stack (rather than
> +	 * just below the IRET frame) and we want to pretend that the
> +	 * exception came from the iret target.
>  	 */
>  	struct bad_iret_stack *new_stack =
> -		container_of(task_pt_regs(current),
> -			     struct bad_iret_stack, regs);
> +		(struct bad_iret_stack *)this_cpu_read(cpu_tss.x86_tss.sp0) - 1;
>  
>  	/* Copy the IRET target to the new stack. */
>  	memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8);

So the addition of the __no_sanitize_address attribute to fixup_bad_iret() made 
the 64-bit allyesconfig/allmodconfig kernels fail the build:

 In file included from ./include/linux/bitmap.h:9:0,
 arch/x86/kernel/traps.c: In function ‘fixup_bad_iret’:
 ./include/linux/string.h:344:24: error: inlining failed in call to always_inline 
 ‘memmove’: function attribute mismatch
  __FORTIFY_INLINE void *memmove(void *p, const void *q, __kernel_size_t size)
 arch/x86/kernel/traps.c:645:2: error: called from here
 In file included from ./include/linux/bitmap.h:9:0,
 ./include/linux/string.h:344:24: error: inlining failed in call to always_inline 
 ‘memmove’: function attribute mismatch
  __FORTIFY_INLINE void *memmove(void *p, const void *q, __kernel_size_t size)
 arch/x86/kernel/traps.c:642:2: error: called from here
 scripts/Makefile.build:314: recipe for target 'arch/x86/kernel/traps.o' failed

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ