From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755106AbcLZJrr (ORCPT ); Mon, 26 Dec 2016 04:47:47 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:22056 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754771AbcLZJrq (ORCPT ); Mon, 26 Dec 2016 04:47:46 -0500 Subject: Re: Linux 4.10-rc1 To: Al Viro , Kefeng Wang References: <5860D6F5.1050705@huawei.com> <2a166af6-380d-3ce2-abd0-086041f14f05@huawei.com> <20161226091854.GO1555@ZenIV.linux.org.uk> CC: Linus Torvalds , Linux Kernel Mailing List , Will Deacon , "Catalin Marinas" From: Hanjun Guo Message-ID: <5860E6A6.4020905@huawei.com> Date: Mon, 26 Dec 2016 17:45:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20161226091854.GO1555@ZenIV.linux.org.uk> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.17.188] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/12/26 17:18, Al Viro wrote: > On Mon, Dec 26, 2016 at 05:05:37PM +0800, Kefeng Wang wrote: >> It looks like we need revert the changes from assembly files. I tested Kefeng's patch and works. more comments below. > Better yet, split the damn thing in two and include the asm-only part. split will cause other places for building errors, because there is no -#ifndef __ASSEMBLY__ in the file. > >> diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S >> diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S > Missed those two... OK, how about this? > > arm64: don't pull uaccess.h into *.S > > Split asm-only parts of arm64 uaccess.h into a new header and use that > from *.S. > > Signed-off-by: Al Viro > > diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h > new file mode 100644 > index 000000000000..df411f3e083c > --- /dev/null > +++ b/arch/arm64/include/asm/asm-uaccess.h > @@ -0,0 +1,65 @@ > +#ifndef __ASM_ASM_UACCESS_H > +#define __ASM_ASM_UACCESS_H > + > +#include > +#include > +#include > +#include > + > +/* > + * User access enabling/disabling macros. > + */ > +#ifdef CONFIG_ARM64_SW_TTBR0_PAN > + .macro __uaccess_ttbr0_disable, tmp1 > + mrs \tmp1, ttbr1_el1 // swapper_pg_dir > + add \tmp1, \tmp1, #SWAPPER_DIR_SIZE // reserved_ttbr0 at the end of swapper_pg_dir > + msr ttbr0_el1, \tmp1 // set reserved TTBR0_EL1 > + isb > + .endm > + > + .macro __uaccess_ttbr0_enable, tmp1 > + get_thread_info \tmp1 > + ldr \tmp1, [\tmp1, #TSK_TI_TTBR0] // load saved TTBR0_EL1 > + msr ttbr0_el1, \tmp1 // set the non-PAN TTBR0_EL1 > + isb > + .endm > + > + .macro uaccess_ttbr0_disable, tmp1 > +alternative_if_not ARM64_HAS_PAN > + __uaccess_ttbr0_disable \tmp1 > +alternative_else_nop_endif > + .endm > + > + .macro uaccess_ttbr0_enable, tmp1, tmp2 > +alternative_if_not ARM64_HAS_PAN > + save_and_disable_irq \tmp2 // avoid preemption > + __uaccess_ttbr0_enable \tmp1 > + restore_irq \tmp2 > +alternative_else_nop_endif > + .endm > +#else > + .macro uaccess_ttbr0_disable, tmp1 > + .endm > + > + .macro uaccess_ttbr0_enable, tmp1, tmp2 > + .endm > +#endif > + > +/* > + * These macros are no-ops when UAO is present. > + */ > + .macro uaccess_disable_not_uao, tmp1 > + uaccess_ttbr0_disable \tmp1 > +alternative_if ARM64_ALT_PAN_NOT_UAO > + SET_PSTATE_PAN(1) > +alternative_else_nop_endif > + .endm > + > + .macro uaccess_enable_not_uao, tmp1, tmp2 > + uaccess_ttbr0_enable \tmp1, \tmp2 > +alternative_if ARM64_ALT_PAN_NOT_UAO > + SET_PSTATE_PAN(0) > +alternative_else_nop_endif > + .endm > + > +#endif > diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h > index d26750ca6e06..46da3ea638bb 100644 > --- a/arch/arm64/include/asm/uaccess.h > +++ b/arch/arm64/include/asm/uaccess.h > @@ -22,8 +22,6 @@ > #include > #include > > -#ifndef __ASSEMBLY__ > - > /* > * User space memory access functions > */ > @@ -424,66 +422,4 @@ extern long strncpy_from_user(char *dest, const char __user *src, long count); > extern __must_check long strlen_user(const char __user *str); > extern __must_check long strnlen_user(const char __user *str, long n); > > -#else /* __ASSEMBLY__ */ > - > -#include > - > -/* > - * User access enabling/disabling macros. > - */ > -#ifdef CONFIG_ARM64_SW_TTBR0_PAN > - .macro __uaccess_ttbr0_disable, tmp1 > - mrs \tmp1, ttbr1_el1 // swapper_pg_dir > - add \tmp1, \tmp1, #SWAPPER_DIR_SIZE // reserved_ttbr0 at the end of swapper_pg_dir > - msr ttbr0_el1, \tmp1 // set reserved TTBR0_EL1 > - isb > - .endm > - > - .macro __uaccess_ttbr0_enable, tmp1 > - get_thread_info \tmp1 > - ldr \tmp1, [\tmp1, #TSK_TI_TTBR0] // load saved TTBR0_EL1 > - msr ttbr0_el1, \tmp1 // set the non-PAN TTBR0_EL1 > - isb > - .endm > - > - .macro uaccess_ttbr0_disable, tmp1 > -alternative_if_not ARM64_HAS_PAN > - __uaccess_ttbr0_disable \tmp1 > -alternative_else_nop_endif > - .endm > - > - .macro uaccess_ttbr0_enable, tmp1, tmp2 > -alternative_if_not ARM64_HAS_PAN > - save_and_disable_irq \tmp2 // avoid preemption > - __uaccess_ttbr0_enable \tmp1 > - restore_irq \tmp2 > -alternative_else_nop_endif > - .endm > -#else > - .macro uaccess_ttbr0_disable, tmp1 > - .endm > - > - .macro uaccess_ttbr0_enable, tmp1, tmp2 > - .endm > -#endif > - > -/* > - * These macros are no-ops when UAO is present. > - */ > - .macro uaccess_disable_not_uao, tmp1 > - uaccess_ttbr0_disable \tmp1 > -alternative_if ARM64_ALT_PAN_NOT_UAO > - SET_PSTATE_PAN(1) > -alternative_else_nop_endif > - .endm > - > - .macro uaccess_enable_not_uao, tmp1, tmp2 > - uaccess_ttbr0_enable \tmp1, \tmp2 > -alternative_if ARM64_ALT_PAN_NOT_UAO > - SET_PSTATE_PAN(0) > -alternative_else_nop_endif > - .endm > - > -#endif /* __ASSEMBLY__ */ > - > #endif /* __ASM_UACCESS_H */ I think we need to remove the split and keep it unchanged, just add the change below. Thanks Hanjun > diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S > index add4a1334085..e88fb99c1561 100644 > --- a/arch/arm64/lib/clear_user.S > +++ b/arch/arm64/lib/clear_user.S > @@ -17,7 +17,7 @@ > */ > #include > > -#include > +#include > > .text > > diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S > index fd6cd05593f9..4b5d826895ff 100644 > --- a/arch/arm64/lib/copy_from_user.S > +++ b/arch/arm64/lib/copy_from_user.S > @@ -17,7 +17,7 @@ > #include > > #include > -#include > +#include > > /* > * Copy from user space to a kernel buffer (alignment handled by the hardware) > diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S > index d828540ded6f..47184c3a97da 100644 > --- a/arch/arm64/lib/copy_in_user.S > +++ b/arch/arm64/lib/copy_in_user.S > @@ -19,7 +19,7 @@ > #include > > #include > -#include > +#include > > /* > * Copy from user space to user space (alignment handled by the hardware) > diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S > index 3e6ae2663b82..351f0766f7a6 100644 > --- a/arch/arm64/lib/copy_to_user.S > +++ b/arch/arm64/lib/copy_to_user.S > @@ -17,7 +17,7 @@ > #include > > #include > -#include > +#include > > /* > * Copy to user space from a kernel buffer (alignment handled by the hardware) > diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S > index 17f422a4dc55..83c27b6e6dca 100644 > --- a/arch/arm64/mm/cache.S > +++ b/arch/arm64/mm/cache.S > @@ -23,7 +23,7 @@ > #include > #include > #include > -#include > +#include > > /* > * flush_icache_range(start,end) > diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S > index 47cf3f9d89ff..947830a459d2 100644 > --- a/arch/arm64/xen/hypercall.S > +++ b/arch/arm64/xen/hypercall.S > @@ -49,7 +49,7 @@ > > #include > #include > -#include > +#include > #include > > > > . >