From patchwork Fri Nov 3 17:11:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10040873 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 F32AB602D8 for ; Fri, 3 Nov 2017 17:22:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB11929743 for ; Fri, 3 Nov 2017 17:22:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFDB02974E; Fri, 3 Nov 2017 17:22:21 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6079729743 for ; Fri, 3 Nov 2017 17:22:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=umJXCGzYxU4VWIzGUk0CLbXJYWh6xCkYD+wYGTEAjno=; b=FXH2ELbFsXkWUnzOruU+OgpwIX 34K8A/+71IoO+5VT0uoB0ZoSXggkCyrT8xMYOXN03CEMj5eHtzxZJWq6SZ6WjKIA9nzLjTSmeiQ1L 8zC7wNCCijmx60ZSXDLAD649AmMzZR7GAWvKVLaOCrB7AV1jkD7W34i9L7irQv/jp+fktRb7rL64S O4lTA7OHHFfcHhpVvVDXWk1Og7RgGqcoR1KjWuTJDP/XBh4GjSELAI14GNzkdxVx1VgDsD6gWtuHf /t60r82dYL8O/nzveQP4lWiPE/8KChc9w+Z9bkRBfphUd5EAhK4RH7aDhjOeDhecG3gtEERHmzYuQ +dR+S28A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eAffg-0000Wa-Bh; Fri, 03 Nov 2017 17:22:20 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eAfev-0007HN-9v for linux-arm-kernel@bombadil.infradead.org; Fri, 03 Nov 2017 17:21:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9apgeqGEYg1Rpcx6veH6Vmyc4FMC2AFaiUlFuyPTgDU=; b=HSIDMi/DFogmsIRUwve0DV0th eX2RD7M9ZRFyYlXO6sZGwe5jz/Mr+4w0tvnJE7dFKMGWm4VL8PNI2SVgdLqy2Zf1ezm+/l6NT87br eTS6RufBYi64fUXVxZ6jQXMIyh1IRzLmclwQrYSxX09OmeDnLXLl/lJ3YN/JSTi1wXs9lT2KP4yV7 H8nNBfeewMf3f3evdGmKZJoASc54p89ZeplB6ZOOzNZJF7L3A7r5e3gREgKuYqd9ZN2xEkug/zeyE 76MgHrBNMaeWaVMnwCEFJydWFnTJru0H/T62HvdPDkeAKWsJxPgHWncLQ+eTXR3LHWlj4WJ56FjFt 6ybf4bjKg==; Received: from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eAfX0-0003sw-C5 for linux-arm-kernel@lists.infradead.org; Fri, 03 Nov 2017 17:13:24 +0000 Received: by mail-io0-x244.google.com with SMTP id i38so7763530iod.2 for ; Fri, 03 Nov 2017 10:13:02 -0700 (PDT) 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=9apgeqGEYg1Rpcx6veH6Vmyc4FMC2AFaiUlFuyPTgDU=; b=rioUZKA6jdCeIvJ6k2OFKQhBovjEwPD3SGmgSKFTItZK9SKkjshZJTUkJbQveSgWKy wC9dAtFzfYA++kxc0EBnnwdhN89Vp7slaZkOM2AzdSypW0Tny0omr8Fce1U+fMA1vk6U 7rbQGlipUtAwSoKv51FMw3+dWWmyXhgi+82KotRdVMki1tECr1cXv+JnZTUGK+kVQ+yn REATAtZh9bkOfEUU/qavEVNQ+G79YTqmUSdCgT+vZA2jH8iBcZmmegINUudsr8QIYqZy MTloBPybB6qbL/y/Sn+0UIDFWvjFuvQP4aLEBogCQGjog73klDfkjVPEbXZj8VEZ7p6w oxQQ== 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=9apgeqGEYg1Rpcx6veH6Vmyc4FMC2AFaiUlFuyPTgDU=; b=FFlPDTwdmdAUB/hmqi6wica4MKTCV3M+TgNFuE69CfQNrDHeMTUTiqhPa3KTbyOsBj vqCaFSwZgRWJObkm+4HoW29Z5KWGyBm4cYX4T8f59TxYIKyyt2qwV0jOYfKBBEggxMbT J/DXeSZeESwpkZoahmcClgJR9b5vqqhMjdOsP2MuxZeYBIuCxYTemWfoiNHm4wkwsLAR jcYXVhG37hxAw5HSML2eyBuOfvn59pR6Exa96taK6iLXf4rI5bg1XsWICbgu/QmNqsta Wor1f5F8Gxi2RpWyZ+GCXwgfwSin0bp7WvvqnviunBhL7ggOHC2yIeRAG+kNTUlagHQL Q87A== X-Gm-Message-State: AJaThX4vjUWrN8b9bmdldE+Zlvc3o932HK4V1XnxwReGW3ZaqbLFs8HX vdN9M32G8jKR5E7jn55BIldEiKXIB38= X-Google-Smtp-Source: ABhQp+Sgvmn1tG7qjKXdtvTltjPOlVHDdOVJEDZyy95u9Tl4eMa+jVlI6rxUm/yOtM+2VqDjxsYT+Q== X-Received: by 10.36.110.211 with SMTP id w202mr669930itc.79.1509729180546; Fri, 03 Nov 2017 10:13:00 -0700 (PDT) Received: from samitolvanen.mtv.corp.google.com ([100.98.112.14]) by smtp.gmail.com with ESMTPSA id d186sm1370787itd.38.2017.11.03.10.12.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Nov 2017 10:12:59 -0700 (PDT) From: Sami Tolvanen To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 12/15] arm64: add a workaround for GNU gold with ARM64_MODULE_PLTS Date: Fri, 3 Nov 2017 10:11:58 -0700 Message-Id: <20171103171203.107569-15-samitolvanen@google.com> X-Mailer: git-send-email 2.15.0.403.gc27cc4dac6-goog In-Reply-To: <20171103171203.107569-1-samitolvanen@google.com> References: <20171103171203.107569-1-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171103_171322_514982_F400D619 X-CRM114-Status: GOOD ( 14.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sami Tolvanen , Matthias Kaehlcke , Nick Desaulniers , Kees Cook , Greg Hackmann MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP CONFIG_CLANG_LTO depends on GNU gold and due to a known bug, the linker crashes when ARM64_MODULE_PLTS is enabled: https://sourceware.org/bugzilla/show_bug.cgi?id=14592 To work around the problem, this change: 1) Enables ARM64_MODULE_PLTS only when it's needed, i.e. when RANDOMIZE_MODULE_REGION_FULL is selected, 2) and disables RANDOMIZE_MODULE_REGION_FULL with clang LTO. Signed-off-by: Sami Tolvanen --- arch/arm64/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 43ccddb7c8ec..a301fdc90319 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -997,8 +997,8 @@ config RELOCATABLE config RANDOMIZE_BASE bool "Randomize the address of the kernel image" - select ARM64_MODULE_PLTS if MODULES select RELOCATABLE + select ARM64_MODULE_PLTS if RANDOMIZE_MODULE_REGION_FULL help Randomizes the virtual address at which the kernel image is loaded, as a security feature that deters exploit attempts @@ -1016,7 +1016,7 @@ config RANDOMIZE_BASE config RANDOMIZE_MODULE_REGION_FULL bool "Randomize the module region independently from the core kernel" - depends on RANDOMIZE_BASE + depends on RANDOMIZE_BASE && !CLANG_LTO default y help Randomizes the location of the module region without considering the