From patchwork Wed Dec 6 14:15:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 120849 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp7112489qgn; Wed, 6 Dec 2017 06:18:05 -0800 (PST) X-Google-Smtp-Source: AGs4zMYBA1PN/vD21r9ZhF3qDOu0lQDh6m1/r4SLJnt0iXRZdpslnJFnGGAMY46zwlrhXFzkjHr0 X-Received: by 10.99.115.79 with SMTP id d15mr21764403pgn.340.1512569885828; Wed, 06 Dec 2017 06:18:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512569885; cv=none; d=google.com; s=arc-20160816; b=RVmWBMYox/vPCsoplC/aG4scgXuluNo12PIYtOv+irZrZQm4Rv0gWaw4bzF3+AvCr6 YQGaASNc6g+M/1CW8f/ADCG6yzibXhIT4dguUSVhLzGz72oToRG7Ehu3bqlKyTT/Dsk7 uL/MgA/MgWDjAMam+8S+DtKlVo9lPWXb2YUCYnFDopJqEcvqdJWKA5Wgs9xQe/FnGYUv pQOQBCL5CCGAOgnpzhYkEKVTo4GA75lTnmkQkgnolK0BRIckuYRjWuW+Atwx0kmn0I8P PyrSDbEDKbVi/UK2Rs9SLzpgSUkK+7qBwMkjc7Vzq7LlQERanMXViOgzkyP2ynGGTyHe aVsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=eQeOEL0w3upVUnawrEI02jTi9/NhgNoKksGNs0HAz38=; b=RKbXoF/7/vHQzzuN8pqyXv89p55YmaOZhspuwaIN71BHFPvRbpS1ci2ofnJiBwXdBV +XcnRR5Vj1onMIJTKZS5BBgQZjPs4NMROBeUOfdbFg9wi9gl23X4bIP4wR34ENyOrh8V CvXAt6vGnnwhSB3yW2ke/FpcQFGAEXpuVd6sBd+CDyg87AZfFP8zrBe/es0SZqxhS5Yh cNcf1KbVqTtRpG7/qH/D1K/EZW+8LivoSGet95tV25oBySOGnQH2crt6GwzLiUjUttU1 OgZfkI1wO+9guiV9+DPp2j1ibiHO2nLaG/kKpgOl3cb+TjQA4aDPqFv1almudtWEeuSX DGSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e63si2218509pfm.46.2017.12.06.06.18.05; Wed, 06 Dec 2017 06:18:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752212AbdLFOSE (ORCPT + 28 others); 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 Received: from wuerfel.lan ([149.172.96.106]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0MD8ge-1eJEQt3Zz2-00Gahj; Wed, 06 Dec 2017 15:16:31 +0100 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 Precedence: bulk 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(-) -- 2.9.0 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; }