Re: [PATCH] x86/mm/kaiser: avoid 32-bit/PAE build warning
From: Arnd Bergmann
Date: Wed Feb 14 2018 - 17:12:32 EST
On Wed, Dec 6, 2017 at 4:08 PM, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> wrote:
> On 12/06/2017 07:03 AM, Arnd Bergmann wrote:
>> On Wed, Dec 6, 2017 at 3:15 PM, Arnd Bergmann <arnd@xxxxxxxx> wrote:
>>
>>> This changes the type to u64 in the architecture-independent dummy,
>>> and to pteval_t in the x86 specific portion that is used when KAISER
>>> is enabled, ensuring that the flags can always fit. Unfortunately,
>>> pteval_t is not provided by most other architectures, so we are
>>> a little bit inconsistent here.
>>
>> I ran into a new regression with my patch applied, after doing more randconfig
>> builds:
>>
>> In file included from /git/arm-soc/include/linux/kaiser.h:5,
>> from /git/arm-soc/arch/x86/events/intel/ds.c:4:
>> arch/x86/include/asm/kaiser.h:34:10: error: unknown type name
>> 'pteval_t'; did you mean 'dev_t'?
>>
>> Maybe it's better to just to the last one-line change in include/linux/kaiser.h.
>
> Hi Arnd,
>
> Are you hitting this in -next?
>
> The newest version of this code has a single kpti_init() function that
> shouldn't have any of these problems.
Coming back to an old thread...
I did some randconfig testing on 4.9.80, and now I see the same problem there,
since that version uses the KAISER patches rather than PTI:
/git/arm-soc/arch/x86/kernel/ldt.c: In function 'alloc_ldt_struct':
/git/arm-soc/arch/x86/include/asm/pgtable_types.h:208:24: error: large
integer implicitly truncated to unsigned type [-Werror=overflow]
#define __PAGE_KERNEL (__PAGE_KERNEL_EXEC | _PAGE_NX)
^
/git/arm-soc/arch/x86/kernel/ldt.c:81:6: note: in expansion of macro
'__PAGE_KERNEL'
__PAGE_KERNEL);
^~~~~~~~~~~~~
I also saw another warning:
/git/arm-soc/arch/x86/mm/kaiser.c: In function 'kaiser_init':
/git/arm-soc/arch/x86/mm/kaiser.c:347:8: error: 'vsyscall_pgprot'
undeclared (first use in this function); did you mean
'massage_pgprot'?
I can send this as proper patches for inclusion in 4.9-stable, unless
someone has a better idea or finds a problem
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
diff --git a/include/linux/kaiser.h b/include/linux/kaiser.h
index 58c55b1589d0..b56c19010480 100644
--- a/include/linux/kaiser.h
+++ b/include/linux/kaiser.h
@@ -32,7 +32,7 @@ static inline void kaiser_init(void)
{
}
static inline int kaiser_add_mapping(unsigned long addr,
- unsigned long size, unsigned long flags)
+ unsigned long size, u64 flags)
{
return 0;
}
--- a/arch/x86/include/asm/vsyscall.h
+++ b/arch/x86/include/asm/vsyscall.h
@@ -13,7 +13,6 @@ extern void map_vsyscall(void);
*/
extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
extern bool vsyscall_enabled(void);
-extern unsigned long vsyscall_pgprot;
#else
static inline void map_vsyscall(void) {}
static inline bool emulate_vsyscall(struct pt_regs *regs, unsigned
long address)
@@ -23,4 +22,6 @@ static inline bool emulate_vsyscall(struct pt_regs
*regs, unsigned long address)
static inline bool vsyscall_enabled(void) { return false; }
#endif
+extern unsigned long vsyscall_pgprot;
+
#endif /* _ASM_X86_VSYSCALL_H */
Arnd