From patchwork Wed Jul 18 09:41:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10531889 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 0E89E600F4 for ; Wed, 18 Jul 2018 09:43:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F22AC28FBC for ; Wed, 18 Jul 2018 09:43:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E50C528FCD; Wed, 18 Jul 2018 09:43:04 +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=unavailable 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 84C7428FBC for ; Wed, 18 Jul 2018 09:43:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2CCE96B02A3; Wed, 18 Jul 2018 05:41:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1FDE36B02A7; Wed, 18 Jul 2018 05:41:40 -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 F17A86B02A8; Wed, 18 Jul 2018 05:41:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 8C5DF6B02A3 for ; Wed, 18 Jul 2018 05:41:39 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id i26-v6so1708031edr.4 for ; Wed, 18 Jul 2018 02:41:39 -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=HKoUZH6FSTm0ysPU0gSEXWjwb1+jfEibrlqRhIN//YGnm1zdumJN7A8Z7EwfASl5mo phmMrxaSIYEh8rHbdQLrZ0pQSwPx2DpgxNjRb++HNFIAaT3dbpBlcYSln6qg/qsG/UQW 8D/PywXjh+kbHGI09I1ouHh4SyQPG81782eRq7BReib8Guw45o0KV7Jx9Uq2/YV8HQfH fUUskp4NreyRP9ZnTaSJLe8IoGPFNBBByic2lG6kjYNabN++bBbpVpRrs5s7eSFp2LYN HWp1nkY0pCARyxcFueVUUInd5HHqHFJlCkksxtxVvrnSbgV1daxO8woPQ0m+kXS2PzBL +oXw== X-Gm-Message-State: AOUpUlFsr0TSI1909QZ0MPEtZ08osTR7G4r1VTxEKGk17nMvIS/GJct6 omT5WvL5IN42zVowj3ZoyOxehLzRgi4edFD+Ze2baHedecK6HOE2kvwlAUEEGXjD+R2Mo5WTQck Sh24Z0ays1gVG1elC8AY7GLaBaMz1ZU/pM3jItX38Wrfk7QXc/bvg+QrIixu7IcDsqw== X-Received: by 2002:a50:c2d1:: with SMTP id u17-v6mr6405698edf.119.1531906899135; Wed, 18 Jul 2018 02:41:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc5oDW/SrwkUJVFZka1zXg5YQgA0BE3VcdSnuVJPCRYFj+BkscsYjaGlSLFHXwgBkpWCfS4 X-Received: by 2002:a50:c2d1:: with SMTP id u17-v6mr6405659edf.119.1531906898466; Wed, 18 Jul 2018 02:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531906898; cv=none; d=google.com; s=arc-20160816; b=SjuJIgcFu32vAY23gbKKMLW+3A/npuZYJ9hly5iw+xGRNIiBNgpX3kh9m3sGEmiSH8 ugcSUmqAb4Ct6SupyCcOdCtF2lZzZw106R6kr6FheTn0U8FKNNo0xppPD3BBoxnOKhBv rlooagWpHldI/52APKV6//lQocmrAczbqRjwou0ON8GnyLqAiasOe8206akmDpHNoRkT Iv/wxB9cnkbz6CPXs+rArfUtYEYu8eohHDEboOPd6ZtNv0g13HZNk928sYzWc1grNsw6 3UJEavsjkcsjN8UH2XQp+TAHQS39k9Q/LaSCjS4die1tx7nusR3NDn55rXKysJDA3sI5 nrTA== 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=Wi/evJdDPQ9Ws3AUnPUAx0ydJvRls7v+fIcqhkqU/GllpY9IBH2QsqvxRyNYdEGUtZ gkwfOeDKwRTc7J68rhVda7RkBsnzsBsfL8FWnFowuq02z06FMePb9AoTlVSe7PA4vs9j m/b0cx/2Y2Eak36pp1tn1dSAN+JeYO0hi9WztBDtHGsLt+YXInlu9XEGOORJcaDD3UOW mucqdYABvfufAPPxBn8mdJHhceu5pmO3B9dPHW4RJu9SSPOlxLeK5ypg28zgtubJk2l2 LQGHJDsv+aE15ZxcC5hmMZegT63xGVERgYqLSEepZ4/z+UD/mzMIeqgAZVawYmXXP0UT QK7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=efTZHSAc; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 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. [2a01:238:4383:600:38bc:a715:4b6d:a889]) by mx.google.com with ESMTPS id f15-v6si2973927ede.13.2018.07.18.02.41.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 02:41:38 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) client-ip=2a01:238:4383:600:38bc:a715:4b6d:a889; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=efTZHSAc; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 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 65BF63C8F; Wed, 18 Jul 2018 11:41:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531906885; bh=yLmhHW0HJjSKO5FWNE0Mj6MD7/zIRvh/dOclstvAtpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=efTZHSAcIJxliJWJsIykoPT3ort+AtnsZwLyfs2rQjkH4aB36PJKFpYjt/F50omQ3 T49QDFqcQKzMXw9r+QWftEqNfuzlzBCkujzAuvCt686AeI5Cu5aLVZUdmXtsZ9J2WX lZcBpEtroAeQA3RPT6oPIEomUBPnwBN6+g0D/m11ZX+KlEqtf02pElHT+kDFCQG07G dJ89e7BcMh6oQ5olwBfRASFrmEiu2UssBNNnNkZMI0siEcl1tOf4jkrQR0Smd3XSBG e9S29VMMjjOtMgJDPFkDqq5hrhvsNAiQIrZ3f4Zd0pEaspn1tLnHqBrM1deDYInojH IKAOB+mMWAbnw== 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, 18 Jul 2018 11:41:04 +0200 Message-Id: <1531906876-13451-28-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531906876-13451-1-git-send-email-joro@8bytes.org> References: <1531906876-13451-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;