From patchwork Wed Jul 4 08:36:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 141026 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp543418ljj; Wed, 4 Jul 2018 01:41:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeMEWsN3iPNvVMYyK/mwX5aGlfekc+M8rDrXcbOgOHJGt1Gt1dO+PZF0WNZ1nPJA65g4gsr X-Received: by 2002:a65:61af:: with SMTP id i15-v6mr1064488pgv.349.1530693688996; Wed, 04 Jul 2018 01:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530693688; cv=none; d=google.com; s=arc-20160816; b=J/b73ZUeXT/CkE4CamOlZFJUGEYSlbBJjepYEowWS/Hlrl9p6vTeUJDjoVd9Q2EItj Hd17gHJyW2/JzfRgJ9TyUVAxiRgfgdNvgnk9urbW4J60zcN5YjBTwK2rbugvBogzJw1B 4isiFkiyRzxuGAG3d7BNM0Tqor56BulzkOv9jzLdJFklPd3uTkRVv8Egu0KE+igWsfhK e6cO7qCop+1VdMyBn4YNX/dj/dKq4J1djdyFvKq3z+HobVI+6wH0FMxhlzTn+bQuqZFF nEyuYnMfLrwfDKyq9U9i6cArFsS/R4lSQAwhK2WDPbNgm/d0isFRhihf+zGjnG944ss+ Dwcw== 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=FvlJovxgJJ+QheLrbv7UTmXIJsBE8E1kyVYaaE1/yZw=; b=KwJHprjYUiDSuRA4YFUWSDdPc6uUkqv8bHHg7cpTTMVs4HTzls/Oyd1ieoXlSE6e/K fJ6KtoEvVlV4U0pFOVGg2/2lX8OXVwtmFCdQWjKRjHwlo+0aRq7OPEz0C7m1aDhojcUy AGG2ik2aNrISrYaLAB2CiuvavbiABACgFOngmkhevj64d/+6JMr7zj+RkfhyTnO/IhOP jEpKmsN1BY+3hN/gjyWHn1JCF48Qug1IcuSopaMygMK+tTV1F71I0VL079ybK+1zfeuW a4vS08P/gn/aNOURClIdIi9SBbIbilpwrxjVyVKW6+DgkuJ5eU/BnzR3OATdxBtjUz0l 5zsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SRshl8rh; 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 u6-v6si3149899plr.437.2018.07.04.01.41.28; Wed, 04 Jul 2018 01:41:28 -0700 (PDT) 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=SRshl8rh; 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 S934388AbeGDIlW (ORCPT + 31 others); Wed, 4 Jul 2018 04:41:22 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:34104 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933050AbeGDIit (ORCPT ); Wed, 4 Jul 2018 04:38:49 -0400 Received: by mail-ed1-f67.google.com with SMTP id d3-v6so3477385edi.1 for ; Wed, 04 Jul 2018 01:38:48 -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:in-reply-to:references; bh=FvlJovxgJJ+QheLrbv7UTmXIJsBE8E1kyVYaaE1/yZw=; b=SRshl8rhluInJKzqhBxvquTse209GvHLTUrF9aCGlZ6nEHaH1VTiPTbYPXUcbCb+a+ CanuIV+YSPI9fQGaPxCA6y/sZ6A2bNAuuBf8kf+E/rTCjsu7IFInTnKFhmb5fWDdU8AV CMe2EYDfFpFvPQAAN1eCohJQFn7LthzXTVMpY= 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=FvlJovxgJJ+QheLrbv7UTmXIJsBE8E1kyVYaaE1/yZw=; b=QbnYNddRhGNcOCBe86PbY6V6UOc7L0U4bO5wSkqyIpICOrOMtGu+9ycZK7ELeeyzhl xqSrrmcfXNUYdaeAK2hG2j0DyPQqO72BTQ/wax931RqGeMBPupdsUHUoAU2V4JUE+QJc atqno9bcH+rlBIB6M5QGOgagOVorX58WCWUC24gvhrtmsfAI5fVsHIM80FdLXvljBeX0 gQJjmOPvVKeoWEcr1M9trk7sXL2If+KX80bQTEuHbD2OJDwUyyKudNlJErlbK5ujO1Rv Iv20jsSb0cZtwM/jF/k3+bQHAoK0qpEDQ26tZbsTm7wWJKaB1NbbVeMa3ETMxrgVBsGA eq8A== X-Gm-Message-State: APt69E3dpU/+v3JNa7OTbelsI0XfWYoFa9L9FJ5D701OfZB+XhTTAIOK BiIbM+fHWNRA/W4yhPlNRkXd0lJ6QZ4= X-Received: by 2002:a50:d9c7:: with SMTP id x7-v6mr1722213edj.95.1530693527904; Wed, 04 Jul 2018 01:38:47 -0700 (PDT) Received: from ards-mac-mini.arnhem.chello.nl (dhcp-077-251-017-237.chello.nl. [77.251.17.237]) by smtp.gmail.com with ESMTPSA id k13-v6sm1821740edj.55.2018.07.04.01.38.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jul 2018 01:38:47 -0700 (PDT) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , Arnd Bergmann , Kees Cook , Will Deacon , Michael Ellerman , Thomas Garnier , Thomas Gleixner , "Serge E. Hallyn" , Bjorn Helgaas , Benjamin Herrenschmidt , Russell King , Paul Mackerras , Catalin Marinas , Petr Mladek , Ingo Molnar , James Morris , Andrew Morton , Nicolas Pitre , Josh Poimboeuf , Steven Rostedt , Sergey Senozhatsky , Linus Torvalds , Jessica Yu , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: [PATCH v10 1/6] arch: enable relative relocations for arm64, power and x86 Date: Wed, 4 Jul 2018 10:36:46 +0200 Message-Id: <20180704083651.24360-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180704083651.24360-1-ard.biesheuvel@linaro.org> References: <20180704083651.24360-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. Acked-by: Michael Ellerman Reviewed-by: Will Deacon Acked-by: Ingo Molnar 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.17.1 diff --git a/arch/Kconfig b/arch/Kconfig index 1aa59063f1fd..2b8b70820002 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -971,4 +971,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 42c090cf0292..1940c6405d04 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -95,6 +95,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_THREAD_STRUCT_WHITELIST select HAVE_ARCH_TRACEHOOK diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 9f2b75fe2c2d..e4fe19789b8b 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 HAVE_CBPF_JIT if !PPC64 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f1dbb4ee19d7..e10a3542db7e 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -123,6 +123,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_THREAD_STRUCT_WHITELIST select HAVE_ARCH_TRACEHOOK