From patchwork Wed Jun 27 16:05:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 140360 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1069057ljj; Wed, 27 Jun 2018 09:06:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc8uSaxEqlb4bZu/DxTOXQGbTfxsbQCcVoBiHzaz/EUAn6l2aT6fmnn6FpWPoMxFuxLaZfI X-Received: by 2002:a62:5486:: with SMTP id i128-v6mr6443378pfb.166.1530115573321; Wed, 27 Jun 2018 09:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530115573; cv=none; d=google.com; s=arc-20160816; b=VP8bAQ7ZW//qU0GtNsC4b7u6VMCg+Qc8DM+3ARJvAzANcQWAh818le57ue8jji//Jx bOJ0iZub2SUgFZR4PQ3e1AzRcwhKIgxxTVxmqa+UcQg//m9+bbCt+vXtgOqbmZ/S0tYy PgtMl8b271pHFnB7u84MLhflZfTDctm+zW/viK2HLob0Dx9pOR2Dy2EHlIKHgz77dLb2 Iy1g9nFGsyByr/aW9FvVToUGxesYLrRas89xxFU6XCINpBYRg2JLPWJCUQxA3Yk10JwC E4lovtJhtvfJ2yesWpjdMWgk18QxFckVdLZQLtO6hzfZCF6nAOFZXAiwjljS0i9imXDB /aVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=d07Srbly/tt/fvCsX1MMBKhoekqXeQyhFpS+MSSA/fE=; b=fio0C69SbV8uVOAFGle7XuIvYXugAvyKmGbfj9oHueVXpxIdeZ/1o8MSY5AKquoXv2 LS5tVY1iUrtF16cv2hFQWUIkSWMcDdB8fgPrmaoS28LLyMRusQF0dZ/E4MKwfr/IRvBj lF27peXP2tlLynBU5UllO478nySoVpx18xV8AEsGENaGRVEcOyXnq+b4zHg1UecTyGCJ hAzahlo9FmFroqgPiypov3TAVEzlr4q3rYkUn7FzqCWDRR5Y/CeUAv8s+H+SZpHELbtq a4TL6Mvn6rS8trYpcM7ABMcIvxIbEYaBbyz+oO2TFD3IuhA5Lisk8L8iPBRI6/2tMWOu 7YnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h+ncVKpL; 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 b8-v6si4272434ple.469.2018.06.27.09.06.12; Wed, 27 Jun 2018 09:06:13 -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=h+ncVKpL; 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 S935037AbeF0QGK (ORCPT + 31 others); Wed, 27 Jun 2018 12:06:10 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55293 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934916AbeF0QGJ (ORCPT ); Wed, 27 Jun 2018 12:06:09 -0400 Received: by mail-wm0-f65.google.com with SMTP id i139-v6so6416125wmf.4 for ; Wed, 27 Jun 2018 09:06:08 -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=d07Srbly/tt/fvCsX1MMBKhoekqXeQyhFpS+MSSA/fE=; b=h+ncVKpLgZIVoT/zoAtsE24msoiNglHONdMxZzbpI1BQ+XxcDh2PiyT/VO6D/Elplk 8xQkHSC/UO5Wb/Yk4LNtTk8XucIlCfg1gDIqSote/nBy0xa92Wxxhlga02pBGLlYgCE8 VyX5zPnwwOg1nWzwOBJG886N4/wWq+55K/A9w= 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; bh=d07Srbly/tt/fvCsX1MMBKhoekqXeQyhFpS+MSSA/fE=; b=CsaCVOSxB+Bhifh6lfZS3hgEesWv8lW3pxt87OAjLvor/gtCaLPhFdGGB2yijoSnFY 4X68pob26mVTCUYQIeptO6+Fcoi3cIbL0Kmi4JQjCf62Spqdd+/P+5dGna/xMnghy4iE uw5jZNpR5qZS0BqegwULMuozVWU3KIeGrPjP//Fg66/1C4F5Hw0lbFpKx+wm+7ORr01U KFvs07DQFVWUvVB5NEbYFKln7VgLVx63BBn9KyWmde5f+PP8FQhBiMr13Oof7qAdjUfb QtOeogbbSAguj5BYbfbM9tMsbzwAj7Ft6unZ836+Griu9/RUmdetxxD5ymPVBn8ZOhQt Hjgg== X-Gm-Message-State: APt69E0y+/diDI3vNoIJDCRZMlZNvhMmdbPx2MbcnJUZQmMKDBVCKTz5 1L2T9nmYu/TtujyqfwQlh9iPxr7oJTo= X-Received: by 2002:a1c:8010:: with SMTP id b16-v6mr1421618wmd.41.1530115567483; Wed, 27 Jun 2018 09:06:07 -0700 (PDT) Received: from rev02.home ([2a01:cb1d:112:6f00:4d04:66e:dea8:5b23]) by smtp.gmail.com with ESMTPSA id s2-v6sm7055000wrn.75.2018.06.27.09.06.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 09:06:06 -0700 (PDT) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Arnd Bergmann , Steven Rostedt , Peter Zijlstra Subject: [PATCH 0/5] add support for relative references in jump tables Date: Wed, 27 Jun 2018 18:05:59 +0200 Message-Id: <20180627160604.8154-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series implements support for emitting the data structures associated with jump tables as 32-bit relative references instead of absolute references, which take up more space on builds that target 64-bit architectures, or implement self relocation [or both]. This series enables it for arm64 and x86, although other architectures might benefit as well. Patch #1 does some preparatory refactoring before patch #2 introduces the generic pieces required for using relative references. Patch #3 wires everything up for arm64. For x86, patch #4 applies some preparatory changes for the arch specific jump label C code, which is a lot more involved than on arm64, which is why it is split off in this case. Patch #5 wires it up for x86 as well. Cc: Catalin Marinas Cc: Will Deacon Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Arnd Bergmann Cc: Steven Rostedt Cc: Peter Zijlstra Ard Biesheuvel (5): kernel/jump_label: abstract jump_entry member accessors kernel/jump_label: implement generic support for relative references arm64/kernel: jump_label: switch to relative references x86: jump_label: switch to jump_entry accessors x86/kernel: jump_table: use relative references arch/Kconfig | 3 + arch/arm64/Kconfig | 1 + arch/arm64/include/asm/jump_label.h | 16 ++--- arch/arm64/kernel/jump_label.c | 6 +- arch/x86/Kconfig | 1 + arch/x86/include/asm/jump_label.h | 28 +++------ arch/x86/kernel/jump_label.c | 43 +++++++------ include/linux/jump_label.h | 64 ++++++++++++++++++++ kernel/jump_label.c | 56 ++++++++++------- tools/objtool/special.c | 4 +- 10 files changed, 145 insertions(+), 77 deletions(-) -- 2.11.0