From patchwork Wed May 23 19:54:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 10422301 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 24D1C60224 for ; Wed, 23 May 2018 20:01:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1314B291DB for ; Wed, 23 May 2018 20:01:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0538E291DD; Wed, 23 May 2018 20:01: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=-12.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 24A63291DB for ; Wed, 23 May 2018 20:01:02 +0000 (UTC) Received: (qmail 24560 invoked by uid 550); 23 May 2018 19:56:23 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 24442 invoked from network); 23 May 2018 19:56:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cyyF4wHk/zKWGmIFpk4WndLFw4kArPA59TSlO4K7Zeg=; b=au7RRE4xeyr4luRtQ4y/Ab6/seoKktY+UihzqugJZlm8ec1Zdlcq2yK360juAhrt36 xynQ4W4EPqLDVcxRfqaTSg1XbJ6wvgGblrlsbH3n0uoQVXc7KBdrlS9cwAcj1snE7XoR TYHSPrj5BCjY5XWdTbowqrJsu8z7HKaTEDsdxmR2MvOmdVrPBX98OMXX5CNMIhJ7xt5x bPyUD4IAg0Xdt/EllIkbbstvQtVYYICWzdLYWoNo3Pd4EV/OKlFQfjdqmwKp15+pXTY4 Z1qulSoQZfJ5rM3ZyzltD6yme7kXIT3mMZx2jR0ArpPqWZDJC5m4aEibd8tEhV11eb4G Ta1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cyyF4wHk/zKWGmIFpk4WndLFw4kArPA59TSlO4K7Zeg=; b=uiECwM75UhNAF1Cr9FqRCAQ4Qy5nPYQsB9CGFADQbOkJXscZe/xjCCkm34Kc+D/llC LV8qscodeS2rFf982NEQ5iJtYuGUuP+ZlM1AnVGr5/27W9DnccwNwrfm2S0P/fhl67WG XdhDfq6hIzf+KuikPPxITl60Y3/byHEUJEUXO+RxNyv0a9tftWjm4UJUxJyxfz0bGBBV UUAd0b17Vj4sLa3Mk1jFwZ24dwX1pdCaTeov5N4KHQsagMm31gbm0sgM3OxDrsY/6FI8 0MBxVuP3UWwuOWhDoKZQahW2dSTCHluUt5DooPhjpmOcA4FhrntIqljEafobQ42a8K2g MTvA== X-Gm-Message-State: ALKqPwcbTAPc3uti4qOVAchs+moYmoIElPWMnPp2bNrM/D9pF7T/f+9Q nTbSh6W2dQxaUGqg2dQxXu+M7A== X-Google-Smtp-Source: AB8JxZouxOEFE1FSIv5BUD5ggvyHu5Z4m9gEvS2mihb6KMmir3qScZnpXmeuSdd+2cIsI6LqzZKDPQ== X-Received: by 2002:a17:902:b7ca:: with SMTP id v10-v6mr1659567plz.224.1527105363781; Wed, 23 May 2018 12:56:03 -0700 (PDT) From: Thomas Garnier To: Herbert Xu , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Greg Kroah-Hartman , Thomas Garnier , Philippe Ombredanne , Kate Stewart , Arnaldo Carvalho de Melo , Yonghong Song , Andrey Ryabinin , Kees Cook , Tom Lendacky , "Kirill A . Shutemov" , Andy Lutomirski , Dominik Brodowski , Borislav Petkov , Borislav Petkov , "Rafael J . Wysocki" , Len Brown , Pavel Machek , Juergen Gross , Alok Kataria , Steven Rostedt , Jan Kiszka , Tejun Heo , Christoph Lameter , Dennis Zhou , Boris Ostrovsky , Alexey Dobriyan , Masami Hiramatsu , Cao jin , Francis Deslauriers , "Paul E . McKenney" , Nicolas Pitre , Andrew Morton , Randy Dunlap , "Luis R . Rodriguez" , Arnd Bergmann , Christopher Li , Jason Baron , Mika Westerberg , Lukas Wunner , Dou Liyang , Sergey Senozhatsky , Petr Mladek , Masahiro Yamada , Ingo Molnar , Nicholas Piggin , "H . J . Lu" , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Joerg Roedel , David Woodhouse , Dave Hansen , Rik van Riel , Jia Zhang , Ricardo Neri , Jonathan Corbet , Jan Beulich , Matthias Kaehlcke , Baoquan He , =?UTF-8?q?Jan=20H=20=2E=20Sch=C3=B6nherr?= , Daniel Micay Cc: x86@kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-arch@vger.kernel.org, linux-sparse@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCH v3 24/27] x86/mm: Make the x86 GOT read-only Date: Wed, 23 May 2018 12:54:18 -0700 Message-Id: <20180523195421.180248-25-thgarnie@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180523195421.180248-1-thgarnie@google.com> References: <20180523195421.180248-1-thgarnie@google.com> X-Virus-Scanned: ClamAV using ClamSMTP The GOT is changed during early boot when relocations are applied. Make it read-only directly. This table exists only for PIE binary. Position Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier --- include/asm-generic/vmlinux.lds.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index e373e2e10f6a..e5b0710fe693 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -314,6 +314,17 @@ __end_ro_after_init = .; #endif +#ifdef CONFIG_X86_PIE +#define RO_GOT_X86 \ + .got : AT(ADDR(.got) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start_got) = .; \ + *(.got); \ + VMLINUX_SYMBOL(__end_got) = .; \ + } +#else +#define RO_GOT_X86 +#endif + /* * Read only Data */ @@ -370,6 +381,7 @@ __end_builtin_fw = .; \ } \ \ + RO_GOT_X86 \ TRACEDATA \ \ /* Kernel symbol table: Normal symbols */ \