From patchwork Fri Nov 3 17:12:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10040837 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 902CB60384 for ; Fri, 3 Nov 2017 17:14:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74B2129684 for ; Fri, 3 Nov 2017 17:14:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66130296A8; Fri, 3 Nov 2017 17:14:38 +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 E9A0F29684 for ; Fri, 3 Nov 2017 17:14:37 +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=dg3r7uohHTp0e1y88WfX0HIzm4 Ec52i2AAz7kY5UTYhKYaxY0AMqzAEZC2y0d52Vnyig94IkgSmtIDkG6RhPTW/5wqB2VEc7NE82C7M IBRNKfyIoT+0edLWGzbk7/WM0G5X3fwecjpdQ54zzmuyisjABD4v4qmMDLODhN9oOqiSgfSUWQQpt OkXmiIVcf0twBfVemWJmLNSFkjKtf7umj0IfVzIys6rxQaltknYgzPnD2EAHvMyYwuC4mmWrXLfun kxuR7Zu/lhSG7luNa0S+WL8Av15mKFHZv2tqzvM4ZVleDBOAyzEQWk7jph52Jm5DJ8DdY2qPvDBKA 9hMCRoDw==; 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 1eAfYD-0001Za-1d; Fri, 03 Nov 2017 17:14:37 +0000 Received: from mail-io0-x241.google.com ([2607:f8b0:4001:c06::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eAfWy-00009n-8u for linux-arm-kernel@lists.infradead.org; Fri, 03 Nov 2017 17:13:48 +0000 Received: by mail-io0-x241.google.com with SMTP id m81so7681643ioi.13 for ; Fri, 03 Nov 2017 10:13:04 -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=e1fqmZfh85g8dRdlqnpf8UeiX3hNoMzQUigF+ZScfv3fRmt/lmXUAH+FkE4pY/vXSK QMZ6MjXtXUicW0EoYisqmWjaXMgcNL/JvfzVpl4v7zpFqAP0njG4ELFaTY6wc9eUaREp ++AT1H7cn5m8DQhU02ZC5qjaw+rLqaaM9QbZPGpouu+1wEnWJtcLBTo6FGExYBMsMR4M hbbrpqVImmnBZQDcqRvZM4ppgJDtWuHkcwLCAhXiMFQsM4RX6aAxgJ+eykRHfWqhNbfK 0dKNL1YU78S5qh8D9eg+1QF2E6akpU32COFn0ZVNzBu9f2HRmcloqr752f7Nvn6UHJK9 v92Q== 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=jgoYjp0tDxGp+bGARdduEzKwPwUjDFa798b8oymy65Ko7VliTu/OphT/fvCZV2Kxz5 GnaIuLgGBMmnJbvOXfjbhhDYifC7kYlS3q1er4MqUEp5GKpvLCc1Xwd0jiW9yjncgREw l/UBJrdMCozk1gQxZOJ+lE36gsTLjOoNACDw2jgz+HBr3SuOfiAF3YvikOPWNBcBawnx t4BF66/ZLJ/Mhoey/dyX6WdlPlC1fb2zRti/OzWilFYXvqgSExkDMwOuj8CMxNng+Xbg lUJDTfCcZlCRlMWNaeSa4K2Fq10CMOkm+oldrnhb21b0ImILijBVxA4/9yNcPrTzudxc NipQ== X-Gm-Message-State: AJaThX6XfPqkz1bjnuaeTEQyjgyJDoyxqa+vKJU6elvKJ+o/19wZ8m8r wW0E2YSpbrQCZ6fCyYHedZxTziMEYDY= X-Google-Smtp-Source: ABhQp+RsIJ55jMVYvqZ54USYx3Gsq7a7V18JwvXulmQxMfWpQYmdK2f70njaGQQwVKaTGJ0bZEJY0g== X-Received: by 10.107.151.19 with SMTP id z19mr10114742iod.248.1509729183589; Fri, 03 Nov 2017 10:13:03 -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.13.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Nov 2017 10:13:02 -0700 (PDT) From: Sami Tolvanen To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 13/15] arm64: add a workaround for GNU gold with ARM64_MODULE_PLTS Date: Fri, 3 Nov 2017 10:12:00 -0700 Message-Id: <20171103171203.107569-17-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_101321_056540_7503BE89 X-CRM114-Status: GOOD ( 12.55 ) 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