From patchwork Thu Oct 13 16:42:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77633 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp327006qge; Thu, 13 Oct 2016 09:44:10 -0700 (PDT) X-Received: by 10.98.73.23 with SMTP id w23mr11404666pfa.178.1476377050130; Thu, 13 Oct 2016 09:44:10 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id c68si13963876pfj.269.2016.10.13.09.44.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2016 09:44:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1buj5k-00086i-U3; Thu, 13 Oct 2016 16:42:48 +0000 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1buj5h-000827-0c for linux-arm-kernel@lists.infradead.org; Thu, 13 Oct 2016 16:42:45 +0000 Received: by mail-qk0-x232.google.com with SMTP id z190so100842787qkc.2 for ; Thu, 13 Oct 2016 09:42:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=NjRKs7n8UJlPKJLrqnflWy/fsCtVU3ir41I5fnxdTbQ=; b=GTGB2PrMR6zpPdOOxVfjt0V3IKE6ZxJecNwegqhA0a3gP7qg9GWLy5C7SNrjEtdVhF CcKGSF1OEZeTqUXQ3Cczq9W8c/T1nEonNGryMDnZp60PNqxxN+LpttpYf/3oCW5GB1CM 5PZtBAVFzpO6lWPnuGPMtr4FpgLPHbp7ohXuU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NjRKs7n8UJlPKJLrqnflWy/fsCtVU3ir41I5fnxdTbQ=; b=eX2kUioj3gvSCISi5Eer9lDv6vo7auLQ72aIPhtM+y4D7i2JPlx++wzOS0JysVk8ca BEGvkEZWQxtdjeLcXig3kEFarr/ziUz5Izn7Z5K2fTKtmZPgz1ptwr+NLNyPAGapG65v dO88T6cNQ956rjKdRMC090azAyghsZe9XfEz68As+lv64W8Hsl3jCQLI3BohNgHdndej sVg9DXHZ+Dv8/3FYsqtt8JpT32vTUjMP5/v2A37mIU6OaR5rl1DmALLMgvUjRyLcEytp 80zx0uU7zHRHTYFX5XK7f3v8j2MeGJVFFKbtz3xZWh15Yp2CnrEW2JvJMVhY2bgxNeh6 zWlw== X-Gm-Message-State: AA6/9RnDd4tKXJBefObqu96rZ5YB2drzonBFxde/wVCrosqP7jdgunQW4bjI540vG//Aiiuq X-Received: by 10.194.55.65 with SMTP id q1mr7643598wjp.45.1476376943514; Thu, 13 Oct 2016 09:42:23 -0700 (PDT) Received: from localhost.localdomain ([105.130.27.23]) by smtp.gmail.com with ESMTPSA id p3sm23806488wjr.31.2016.10.13.09.42.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Oct 2016 09:42:22 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, timur@codeaurora.org, dann.frazier@canonical.com, will.deacon@arm.com, catalin.marinas@arm.com Subject: [PATCH] arm64: kaslr: fix breakage with CONFIG_MODVERSIONS=y Date: Thu, 13 Oct 2016 17:42:09 +0100 Message-Id: <1476376929-29688-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161013_094245_244246_AC0BA6A5 X-CRM114-Status: GOOD ( 10.13 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400d:c09:0:0:0:232 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org As it turns out, the KASLR code breaks CONFIG_MODVERSIONS, since the kcrctab has an absolute address field that is relocated at runtime when the kernel offset is randomized. This has been fixed already for PowerPC in the past, so simply wire up the existing code dealing with this issue. Signed-off-by: Ard Biesheuvel --- Given that I spotted this when trying to boot a distro kernel, this probably deserves a cc stable. Timur, could you please test this and report back? Thanks. arch/arm64/include/asm/module.h | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h index e12af6754634..06ff7fd9e81f 100644 --- a/arch/arm64/include/asm/module.h +++ b/arch/arm64/include/asm/module.h @@ -17,6 +17,7 @@ #define __ASM_MODULE_H #include +#include #define MODULE_ARCH_VERMAGIC "aarch64" @@ -32,6 +33,10 @@ u64 module_emit_plt_entry(struct module *mod, const Elf64_Rela *rela, Elf64_Sym *sym); #ifdef CONFIG_RANDOMIZE_BASE +#ifdef CONFIG_MODVERSIONS +#define ARCH_RELOCATES_KCRCTAB +#define reloc_start (kimage_vaddr - KIMAGE_VADDR) +#endif extern u64 module_alloc_base; #else #define module_alloc_base ((u64)_etext - MODULES_VSIZE)