From patchwork Tue May 29 22:15:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 10437341 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 09A24601E9 for ; Tue, 29 May 2018 22:22:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E865D28900 for ; Tue, 29 May 2018 22:22:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBAA12892D; Tue, 29 May 2018 22:22:58 +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 162FA28900 for ; Tue, 29 May 2018 22:22:57 +0000 (UTC) Received: (qmail 23656 invoked by uid 550); 29 May 2018 22:18:27 -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 23552 invoked from network); 29 May 2018 22:18:25 -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=3Onmr25dSz8ZQ73uJeO5gQYDVwNXRukF6Ht8jmOe+V4=; b=vI5HpMsUBvKn0l9Bw0w35FQmKAqYgCQ39WmeBsfnuM6M4cwgpNAc0exCjXMbPvXBHG V2XB1PmjgWppHBeAMqWwxpZs3ycndsl9BKAbXq/lFgEvrmcS9Xh/QbpFuiZ9amfX/IOK RWrceX46Lr8irc0p2jMvmKx857oWRZVhB+D9GAkaoMLV8mOGZTCaZrUW7UTi0Fhz+RbM aGPgSlIrUaPicOFzeqkxh+11VqrthD4FtCscdlTUdxpK6sm+iSQvOnq5+wWlz67NzK7t pBldHosBLe5AsOqXt1oewwEybxlk8baxxuDBcuPSpvI66AUacXM0iQP38Xo+/a4FwxhX M1/w== 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=3Onmr25dSz8ZQ73uJeO5gQYDVwNXRukF6Ht8jmOe+V4=; b=JPNFEw06VPzbHUuASIIt07qKG7GZeNukw8Ta3J/+e6Yu9d+FrPutJz/thlV9WXNzeu q7cROsLWgOae98kzwj5svNR5rxdihmMQaQ+U8DkaSNAQSlfZO+5AVtNeVgijB+uRCEb6 0sLy9WzycVqxbV4W3sqnqllrcIpQZmEmr5qCzdZUID0maVyXew+ptmLsWy9tBGCPqbDA jKkbwb55ynuZR5uHl+qHwKR1XfVMCZ7D54cEPjcx4BMq8VWuRc9jyeuMA7yx8anprCTX MAwLOnZ3ZN2BVXWhDxrj2KsFA0TiEBSuBCC9ZgsHSjhzsBaix+a9PA5VbXt/ErQGj7PL PQ7w== X-Gm-Message-State: ALKqPwcK50V15xWSKeF84oUm8xEEYXg50YJsbWbp8UNnMZT+UxxdlVac rD/A5jjoaVISZ0HuFbCsvsj4Q4NFSeg= X-Google-Smtp-Source: ADUXVKIa4PTBoXkbyzG0EB8pFFPhllkHTtiNYU9v48K5NoN90Cht/c5WcWrtv/Sg3whys8FFwfox8A== X-Received: by 2002:a17:902:43:: with SMTP id 61-v6mr246452pla.112.1527632293806; Tue, 29 May 2018 15:18:13 -0700 (PDT) From: Thomas Garnier To: kernel-hardening@lists.openwall.com Cc: Thomas Garnier , Arnd Bergmann , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 24/27] x86/mm: Make the x86 GOT read-only Date: Tue, 29 May 2018 15:15:25 -0700 Message-Id: <20180529221625.33541-25-thgarnie@google.com> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog In-Reply-To: <20180529221625.33541-1-thgarnie@google.com> References: <20180529221625.33541-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 extend the KASLR randomization range 0xffffffff80000000. 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 */ \