From patchwork Tue Jan 2 20:05:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 123214 Delivered-To: patch@linaro.org Received: by 10.80.135.92 with SMTP id 28csp4760901edv; Tue, 2 Jan 2018 12:06:30 -0800 (PST) X-Google-Smtp-Source: ACJfBosoJC0RgfUETe+l45MJ8EEDixF6UTaMLWhTii3StfVWF2H7bOVtRwUaMdWL+axWPtUePP7k X-Received: by 10.101.66.12 with SMTP id c12mr16841950pgq.63.1514923589384; Tue, 02 Jan 2018 12:06:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514923589; cv=none; d=google.com; s=arc-20160816; b=sXm/vUP605a3taF0Ot+cEzAnaG5Mwo7yb/+J96D3E0/RANksr/aFpHKVDkZGwR2uby hhjM5+ke7KNWzyDR6o1S1OQ9SKJB4djtyPgbfOXGMvyV61xGe6FBBLlSIAiJdwu2yGxX Vm3FR8ArETfPCbhZjtn7auflMKAdx6rcAgtGCfa3l/8K1J28MfFkpJxQbZbgay04+Iyp qP5DF7JWxEw9b52A8ZYg1yXPOaqpxczIkIMhp3fRVS17nOHz1mVFeSAzklGJzUoET9ws V1TJbeqFEq/WXQTnhyD6t7EpUmt07nSG7XaEsegoWUBbV3Yp3Vw9Kb4hdDXIYsGhMfE0 xhnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=8wbbwFOWuQMFP0SKy8UHj3NriHdOJ7kBnwcJ7OnyKjo=; b=gG9lNcegbsE7hMZCzoVFBj7e+qAh0VTA7ScKr+gE/8xe+6xw4c8WzwF5apy7tGqb44 +uEYGikUeJs9DEkaSpfoI9mk5hRh//4LCX7y+dVdat4oNyrOqSQf7hPbx31aFEVTUxSf 44Dm8oSGl4LsWBczyQ5uoJAEq/sGKCHiz1QaEMy/MyzFL9cN9OiVGtQN2w3c3155f6fN uBtuqGwVcWczDBkMzovX+8C/dP/S98nQySEfXjhHVJFz2AH4Qc/QYgjzJiaRArNYQSaA IL8I72LM3JO6bETm2ZOH/h7y4TLk8WhO/rbX90HdRkup2z+BFSleZW/7CbK0dXIB5GPI SV9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DYml98nl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si2242279pfh.232.2018.01.02.12.06.28; Tue, 02 Jan 2018 12:06:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DYml98nl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751059AbeABUGY (ORCPT + 28 others); Tue, 2 Jan 2018 15:06:24 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:40266 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbeABUGT (ORCPT ); Tue, 2 Jan 2018 15:06:19 -0500 Received: by mail-wr0-f194.google.com with SMTP id p17so25843299wre.7 for ; Tue, 02 Jan 2018 12:06:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8wbbwFOWuQMFP0SKy8UHj3NriHdOJ7kBnwcJ7OnyKjo=; b=DYml98nl5C9dxpX8PaphCwO1AwOOVT37wBSgEpvuWvz1+8lzAEk4lAznRm97Y/6LxX Y4BE3AmmwB7ErSHppbzjssrLWql23m3K278dd7UPXIhPBJLssy7YFhsS3HVTTffQ0BvS xMwTDlpUaHy6gjzAk7kS/8JHmrEGXAcyxkyKE= 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=8wbbwFOWuQMFP0SKy8UHj3NriHdOJ7kBnwcJ7OnyKjo=; b=GvEGA/kt6HDPWqBqCZiRr0OD+ZCz83cIKtkoklLbSmmbFQkWv6Kov1ZKs+839CvB4p CFIzveSmgHhEEZ4ii8K1px/A71HPNEflmc769cEnnXbpDJk4Dqhqc1dowL8g3wfM+tfx 9T/BK16H8vWuzrI7LwWKtqQSYBtbE4KwBoru5pHzAtXxPAw1OGzN9IeiPxoAIjnnZynx aUqklRSELIB9aiSS94h1vKX4O/wdpu308m4OA8KqWUNNeiTEmEVEjqvqpoICetF9wT3D 7R0qSj0Ajn92NuAKSznPryE2SpTYNuQfrmaIGBUWKD1zBtDAq9z+CSrskmq+TrziPuFs Ltyw== X-Gm-Message-State: AKGB3mLfnwS8VSFOjJUKncNciXdOwNHUk0uKClxE+RfjiOc8M/kkNa3u 8vyDVAoI1F6VIFoLA4vl6tv+/BkGmjc= X-Received: by 10.223.151.146 with SMTP id s18mr20037055wrb.180.1514923577962; Tue, 02 Jan 2018 12:06:17 -0800 (PST) Received: from localhost.localdomain ([160.89.138.198]) by smtp.gmail.com with ESMTPSA id m70sm19128526wma.36.2018.01.02.12.06.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jan 2018 12:06:17 -0800 (PST) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , "H. Peter Anvin" , Ralf Baechle , Arnd Bergmann , Heiko Carstens , Kees Cook , Will Deacon , Michael Ellerman , Thomas Garnier , Thomas Gleixner , "Serge E. Hallyn" , Bjorn Helgaas , Benjamin Herrenschmidt , Russell King , Paul Mackerras , Catalin Marinas , "David S. Miller" , Petr Mladek , Ingo Molnar , James Morris , Andrew Morton , Nicolas Pitre , Josh Poimboeuf , Steven Rostedt , Martin Schwidefsky , Sergey Senozhatsky , Linus Torvalds , Jessica Yu , linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH v7 01/10] arch: enable relative relocations for arm64, power and x86 Date: Tue, 2 Jan 2018 20:05:40 +0000 Message-Id: <20180102200549.22984-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180102200549.22984-1-ard.biesheuvel@linaro.org> References: <20180102200549.22984-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before updating certain subsystems to use place relative 32-bit relocations in special sections, to save space and reduce the number of absolute relocations that need to be processed at runtime by relocatable kernels, introduce the Kconfig symbol and define it for some architectures that should be able to support and benefit from it. Cc: Catalin Marinas Cc: Will Deacon Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Ard Biesheuvel --- arch/Kconfig | 10 ++++++++++ arch/arm64/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/x86/Kconfig | 1 + 4 files changed, 13 insertions(+) -- 2.11.0 diff --git a/arch/Kconfig b/arch/Kconfig index 400b9e1b2f27..dbc036a7bd1b 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -959,4 +959,14 @@ config REFCOUNT_FULL against various use-after-free conditions that can be used in security flaw exploits. +config HAVE_ARCH_PREL32_RELOCATIONS + bool + help + May be selected by an architecture if it supports place-relative + 32-bit relocations, both in the toolchain and in the module loader, + in which case relative references can be used in special sections + for PCI fixup, initcalls etc which are only half the size on 64 bit + architectures, and don't require runtime relocation on relocatable + kernels. + source "kernel/gcov/Kconfig" diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index c9a7e9e1414f..66c7b9ab2a3d 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -89,6 +89,7 @@ config ARM64 select HAVE_ARCH_KGDB select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT + select HAVE_ARCH_PREL32_RELOCATIONS select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c51e6ce42e7a..e172478e2ae7 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -177,6 +177,7 @@ config PPC select HAVE_ARCH_KGDB select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT + select HAVE_ARCH_PREL32_RELOCATIONS select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !RELOCATABLE && !HIBERNATION) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d4fc98c50378..9f2bb853aedb 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -115,6 +115,7 @@ config X86 select HAVE_ARCH_MMAP_RND_BITS if MMU select HAVE_ARCH_MMAP_RND_COMPAT_BITS if MMU && COMPAT select HAVE_ARCH_COMPAT_MMAP_BASES if MMU && COMPAT + select HAVE_ARCH_PREL32_RELOCATIONS select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE