From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753050AbdKUHUm (ORCPT ); Tue, 21 Nov 2017 02:20:42 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:40430 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752816AbdKUHUl (ORCPT ); Tue, 21 Nov 2017 02:20:41 -0500 X-Google-Smtp-Source: AGs4zMZsnhJKqy1ZyaTWXFajjZplgtLjkUBU8bJMBLH7X8/Y8zL2x04qYW2dbELIK66JYAkhkxyR8w== Date: Tue, 21 Nov 2017 08:20:37 +0100 From: Ingo Molnar To: Andy Lutomirski Cc: X86 ML , Borislav Petkov , "linux-kernel@vger.kernel.org" , Brian Gerst , Dave Hansen , Linus Torvalds , Josh Poimboeuf Subject: Re: [PATCH 11/16] x86/asm/64: Use a percpu trampoline stack for IDT entries Message-ID: <20171121072037.kkgaxvtalvv7d4sc@gmail.com> References: <3ff604702987cf6af1e191705fd937517ceeeeb7.1511195781.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3ff604702987cf6af1e191705fd937517ceeeeb7.1511195781.git.luto@kernel.org> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski 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