From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752211AbdLFOSE (ORCPT ); Wed, 6 Dec 2017 09:18:04 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:56613 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbdLFOSC (ORCPT ); Wed, 6 Dec 2017 09:18:02 -0500 From: Arnd Bergmann To: x86@kernel.org Cc: Arnd Bergmann , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Dave Hansen , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: [PATCH] x86/mm/kaiser: avoid 32-bit/PAE build warning Date: Wed, 6 Dec 2017 15:15:41 +0100 Message-Id: <20171206141627.688219-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:JTNPWwnGLAgdezzCY6MqJSaTFG8V4sL0CWi7wiTFYubi9dXulty F73fVPYpNmnztjJ7eXEnD+dq6PSAIw0Ur4ylTMQuCPZ1KvTyEBEWuRLUuaIns10tIt/ES9I KxsKlgReSMchPmHfclkrW6Vr0S5ldgt1o+wplLjS/83VwSY4pl36WpUGBxYGXIHiKvpqWWi L2w465NeTIqB8hb6xHUzg== X-UI-Out-Filterresults: notjunk:1;V01:K0:pcfJXwW/hqU=:ZhEZSiJrMZgbgQabqKyoHO QbpewJJFCDIxxY5eAatQv7xxNpW/ULcCFvCMe2tbUi/Pwp7Q3GhINVgXD9HcJ+saED7/sRLL2 C9GePHyErrDepd+tdSUKIOeW8+EqLuSbJXC4RGY7MKYh5TNego1lnWJIFp4tqWrC6TRslabck e/KAr50GCZMh9N5/mAKKW6ZNiQiesP0lQgUUMgZZf6eNRRBQtwXhEn2JJyBNe0FksltuiBcsu 3V+5sdLBRhstGTQKcxjc0aGatHIRQSfMB634kPVIkG7KDyQLbfHhbBK12oB6D5VG9/ZqpYOHW HruK6HsQg4TePy51bDU38VexFCGL14hfh7m4Q8cvBg6agVoDx/+yvxFSMGwJ0kwReOIC9xA/a Imx9qYKpJqHFbYEYNLFeL2+DqOapUwSQKRZmHYnhOWH+FANu5jvL52y3cS4V/l4duO5i2w4vc TPZtHJjrehNpx2AfzcGvpmv9DCqtfBRWOScqTbvO48X/al8l3Beh2uNBXSfg4F5Q5+DtrN5bH w6wTvYhom4HxdBIfcs3W7+TTtb8eBaVOdXl5BhUuM6MFN9VQFkjGMDq5RQXrVznzzEVo5DkSA UhoEHVuxvOcrwAfe+XQDuZFfVBn8tOkia1tgQxnTj7H6HlSKmvPcXfdwKB0qFWhvT+1tDh5zN 4JyRgWFJFQeT8fM/gM1+NYLKA3bOtD9MPN1+zqLud2DGcitoXu+H7KweCjxZgEChjFKj+5ZuI 5Fr2WRphmKehwi056ikAJWijS7lVkxE3w5HFCw== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new kaiser_add_mapping() function is provided globally and called from x86 code that can be used in configurations without KAISER but with 64-bit page flags, in particular _PAGE_NX, which uses bit 63, leading to a compiler warning: arch/x86/kernel/ldt.c: In function 'alloc_ldt_struct': arch/x86/include/asm/pgtable_types.h:183:24: error: conversion from 'long long unsigned int' to 'long unsigned int' changes value from '9223372036854776163' to '355' [-Werror=overflow] #define __PAGE_KERNEL (__PAGE_KERNEL_EXEC | _PAGE_NX) ^ arch/x86/kernel/ldt.c:104:6: note: in expansion of macro '__PAGE_KERNEL' __PAGE_KERNEL | _PAGE_GLOBAL); arch/x86/kernel/ldt.c: In function 'alloc_ldt_struct': arch/x86/include/asm/pgtable_types.h:183:24: error: conversion from 'long long unsigned int' to 'long unsigned int' changes value from '9223372036854776163' to '355' [-Werror=overflow] #define __PAGE_KERNEL (__PAGE_KERNEL_EXEC | _PAGE_NX) ^ arch/x86/kernel/ldt.c:104:6: note: in expansion of macro '__PAGE_KERNEL' __PAGE_KERNEL | _PAGE_GLOBAL); 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. Fixes: efd9d1a6b30b ("x86/mm/kaiser: Unmap kernel mappings from userspace page tables, core patch") Signed-off-by: Arnd Bergmann --- I only started building linux-next again today, so this probably got noticed by others already, and it's possible someone had a better fix for it. If so, please just ignore my version. --- arch/x86/include/asm/kaiser.h | 2 +- arch/x86/mm/kaiser.c | 6 +++--- include/linux/kaiser.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/kaiser.h b/arch/x86/include/asm/kaiser.h index 7c636cd25d65..5fcb9f81e615 100644 --- a/arch/x86/include/asm/kaiser.h +++ b/arch/x86/include/asm/kaiser.h @@ -31,7 +31,7 @@ * table. */ extern int kaiser_add_mapping(unsigned long addr, unsigned long size, - unsigned long flags); + pteval_t flags); /** * kaiser_add_mapping_cpu_entry - map the cpu entry area diff --git a/arch/x86/mm/kaiser.c b/arch/x86/mm/kaiser.c index 0ff502fa655b..2e2d340edbf0 100644 --- a/arch/x86/mm/kaiser.c +++ b/arch/x86/mm/kaiser.c @@ -261,7 +261,7 @@ static pte_t *kaiser_shadow_pagetable_walk(unsigned long address, * table pages. */ int kaiser_add_user_map(const void *__start_addr, unsigned long size, - unsigned long flags) + pteval_t flags) { unsigned long start_addr = (unsigned long)__start_addr; unsigned long address = start_addr & PAGE_MASK; @@ -312,7 +312,7 @@ int kaiser_add_user_map(const void *__start_addr, unsigned long size, int kaiser_add_user_map_ptrs(const void *__start_addr, const void *__end_addr, - unsigned long flags) + pteval_t flags) { return kaiser_add_user_map(__start_addr, __end_addr - __start_addr, @@ -470,7 +470,7 @@ static int __init kaiser_boottime_control(void) subsys_initcall(kaiser_boottime_control); int kaiser_add_mapping(unsigned long addr, unsigned long size, - unsigned long flags) + pteval_t flags) { return kaiser_add_user_map((const void *)addr, size, flags); } diff --git a/include/linux/kaiser.h b/include/linux/kaiser.h index 77db4230a0dd..795fccf76849 100644 --- a/include/linux/kaiser.h +++ b/include/linux/kaiser.h @@ -20,7 +20,7 @@ static inline void kaiser_remove_mapping(unsigned long start, unsigned long size } static inline int kaiser_add_mapping(unsigned long addr, unsigned long size, - unsigned long flags) + u64 flags) { return 0; } -- 2.9.0