From patchwork Wed Jul 11 11:29:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10519493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9F7016032A for ; Wed, 11 Jul 2018 11:31:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1DE9268AE for ; Wed, 11 Jul 2018 11:31:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95735284B3; Wed, 11 Jul 2018 11:31:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27123268AE for ; Wed, 11 Jul 2018 11:31:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31A7E6B0288; Wed, 11 Jul 2018 07:30:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2F4996B028A; Wed, 11 Jul 2018 07:30:18 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B9456B028B; Wed, 11 Jul 2018 07:30:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id ABDD96B0288 for ; Wed, 11 Jul 2018 07:30:17 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id d30-v6so4533363edd.0 for ; Wed, 11 Jul 2018 04:30:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=qFrATnS9qFkvl9RrN8gqaZ4bCWV2ZADrIaNwRenKcN4=; b=Vbl52aAbSXXL4sOc50lAmLKYdmqkBsrQZ9ChhpTNGBe3IFLEE7LyKEWoN0/BR94Oir Hnmt0uTTcC8VaRDEsjOmvvaZ7B3javmEgGrxAsNo/IsmEJ3NhdqL509UUi/ZFXWn/5tJ 4umbEEEWZ/uMFWJXYtB0LywnkfRxpB4B2Xpxi2OT5pdfmBSu/W1jKiNUMyPNePurnG8x KmkBwe97YgiGMzYeWGxTaevKVTsSfkad9HGCdZBkjmSXY3huNJRKHZcLAIQHNt99SCCt 2zTxAEhA+fAEdbMKAaEqTNOitY6ftbSNx4JjNkelYSPzr5Duh0pxkOOCKduBnBRgfhQR guFw== X-Gm-Message-State: APt69E0AtbLYaQ6O7TIRy+K3vgrLAg1zH4us9JohITWwXsKUMyYzAfGp iD873Fk6OaAsN1FEPH/4Zks/rfJnsI8+N/w7/9duEP4OYVOAD0tFVMANxkoD/cH9Jn1cR8tB+t8 Y+5V7EOCPFPzoi+bFZSwP+51O1rr0ymWejQpgXl8atKaMUoUBBJPfzrVZtH+87evyXQ== X-Received: by 2002:a50:8a23:: with SMTP id i32-v6mr30964509edi.49.1531308617254; Wed, 11 Jul 2018 04:30:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcufCvL52mSXkIeQNAF+ClNcduG1MoHdny7zEnef8RZ6zEOkQvkLkS2Luy6GVhzzKlEVeF4 X-Received: by 2002:a50:8a23:: with SMTP id i32-v6mr30964469edi.49.1531308616599; Wed, 11 Jul 2018 04:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308616; cv=none; d=google.com; s=arc-20160816; b=zqRNvzupQp2fCVoZ2VyzL5fx22hZm5VQx0H/mwUfY68iyP7D0+nx6zffqjMWutKQeC Im0TJOI0cTJDsg/cxzA8E4HwC+Z21JDFhed/GIxvLAbOvGVPkM7w2E7WKqtmZ9kWDrWh vI3NbwANW9EzyGF5HQDrPZqrq5TAbHsyZIzqiOGxSqrsX97j1ULKOJfXi+s6jwUVRzt7 JjckafwXdax90JPe9QQtYb4MumHApAFhPT7ikn62+qMNbFOdkUF16ysbpi5tY4Gpt3B2 HqCbVUuINSFj2rFBJ1QUc5O5LI/3yfmxzbjTSErRZ3ZkE8AZ0aCmuOovsBA5pI+DQR+W fWAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=qFrATnS9qFkvl9RrN8gqaZ4bCWV2ZADrIaNwRenKcN4=; b=oFwPjTS1K1lsCnAEJ0Q2eNCHfSjVeTorOIJo2rrE23vFomKy6oGfqOlVeGN9kzpssO 2GbTqP3kfG03zJvy/idoFUVr191ohzJxrnYXMIdjzjPTzn2WYJQG3csjDl4sDL923eC5 zNQwFMSJ0yDkCZyAEXaQNNd8SwZgaB7Xn34corSA/RM/tWrI3jn3HReILb1RX61o9l1j 0LeNh1LrnuuwT68noyamAF19e5PcSvOZtWt43ZOw2lX8yjIwvYlYRvtxUSBM+i6Y6u8F d3O1L4/Xv8SsEqbhy+03oojxN5jWUJ5IIXoAYKdlxluFxGe9YuWD4RmBqRWqs7YhaoP5 Tahw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=ADc8m9FP; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from theia.8bytes.org (8bytes.org. [81.169.241.247]) by mx.google.com with ESMTPS id 38-v6si8573796edt.374.2018.07.11.04.30.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 04:30:16 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) client-ip=81.169.241.247; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=ADc8m9FP; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: by theia.8bytes.org (Postfix, from userid 1000) id 103E6AA4; Wed, 11 Jul 2018 13:30:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531308606; bh=yLmhHW0HJjSKO5FWNE0Mj6MD7/zIRvh/dOclstvAtpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ADc8m9FPUU7TC/Tk5YLBsyXYPzqPHCaBPp3E/gImIsWIWsHatJqoGz8igl0/WZsvk 6m7u+75J5lB4oZNfd8KDmrnm4fbxtclGJle8uwfRHX2uxpvOyXuYz2P17HW79Fa7Al E1Zktq0zCkrTgGUk+Tc4HeNPa2SXNdyc+Qg+lCEidJdhunHfxZ5AJZUxc4c3D0EEpT x8a5BUFlcXspMVAH9j/HOLznDKPB9s511C1vIZ3G0hDOCulUpOR92lQdADdA3nokNo 6qkXM2Mmk1vpp+qwq5VpcX+orq4dHkl7ablq6Y66ETvYVOnckMYDGDwvDMrFOsEo2v dg2NvpsFZ3gjg== From: Joerg Roedel To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" , jroedel@suse.de, joro@8bytes.org Subject: [PATCH 27/39] x86/mm/pti: Make pti_clone_kernel_text() compile on 32 bit Date: Wed, 11 Jul 2018 13:29:34 +0200 Message-Id: <1531308586-29340-28-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531308586-29340-1-git-send-email-joro@8bytes.org> References: <1531308586-29340-1-git-send-email-joro@8bytes.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel The pti_clone_kernel_text() function references __end_rodata_hpage_align, which is only present on x86-64. This makes sense as the end of the rodata section is not huge-page aligned on 32 bit. Nevertheless we need a symbol for the function that points at the right address for both 32 and 64 bit. Introduce __end_rodata_aligned for that purpose and use it in pti_clone_kernel_text(). Signed-off-by: Joerg Roedel --- arch/x86/include/asm/sections.h | 1 + arch/x86/kernel/vmlinux.lds.S | 17 ++++++++++------- arch/x86/mm/pti.c | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/sections.h b/arch/x86/include/asm/sections.h index 5c019d2..4a911a3 100644 --- a/arch/x86/include/asm/sections.h +++ b/arch/x86/include/asm/sections.h @@ -7,6 +7,7 @@ extern char __brk_base[], __brk_limit[]; extern struct exception_table_entry __stop___ex_table[]; +extern char __end_rodata_aligned[]; #if defined(CONFIG_X86_64) extern char __end_rodata_hpage_align[]; diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 5e1458f..8bde0a4 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -55,19 +55,22 @@ jiffies_64 = jiffies; * so we can enable protection checks as well as retain 2MB large page * mappings for kernel text. */ -#define X64_ALIGN_RODATA_BEGIN . = ALIGN(HPAGE_SIZE); +#define X86_ALIGN_RODATA_BEGIN . = ALIGN(HPAGE_SIZE); -#define X64_ALIGN_RODATA_END \ +#define X86_ALIGN_RODATA_END \ . = ALIGN(HPAGE_SIZE); \ - __end_rodata_hpage_align = .; + __end_rodata_hpage_align = .; \ + __end_rodata_aligned = .; #define ALIGN_ENTRY_TEXT_BEGIN . = ALIGN(PMD_SIZE); #define ALIGN_ENTRY_TEXT_END . = ALIGN(PMD_SIZE); #else -#define X64_ALIGN_RODATA_BEGIN -#define X64_ALIGN_RODATA_END +#define X86_ALIGN_RODATA_BEGIN +#define X86_ALIGN_RODATA_END \ + . = ALIGN(PAGE_SIZE); \ + __end_rodata_aligned = .; #define ALIGN_ENTRY_TEXT_BEGIN #define ALIGN_ENTRY_TEXT_END @@ -141,9 +144,9 @@ SECTIONS /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE); - X64_ALIGN_RODATA_BEGIN + X86_ALIGN_RODATA_BEGIN RO_DATA(PAGE_SIZE) - X64_ALIGN_RODATA_END + X86_ALIGN_RODATA_END /* Data */ .data : AT(ADDR(.data) - LOAD_OFFSET) { diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index 2eadab0..4f6e933 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -470,7 +470,7 @@ void pti_clone_kernel_text(void) * clone the areas past rodata, they might contain secrets. */ unsigned long start = PFN_ALIGN(_text); - unsigned long end = (unsigned long)__end_rodata_hpage_align; + unsigned long end = (unsigned long)__end_rodata_aligned; if (!pti_kernel_image_global_ok()) return;