From patchwork Tue Jan 24 16:16:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 92370 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1774389obz; Tue, 24 Jan 2017 08:16:58 -0800 (PST) X-Received: by 10.107.128.204 with SMTP id k73mr28484751ioi.188.1485274618513; Tue, 24 Jan 2017 08:16:58 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si19745573pfw.94.2017.01.24.08.16.58; Tue, 24 Jan 2017 08:16:58 -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; 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 S1751175AbdAXQQv (ORCPT + 25 others); Tue, 24 Jan 2017 11:16:51 -0500 Received: from mail-wj0-f171.google.com ([209.85.210.171]:34901 "EHLO mail-wj0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750762AbdAXQQt (ORCPT ); Tue, 24 Jan 2017 11:16:49 -0500 Received: by mail-wj0-f171.google.com with SMTP id b20so767424wjs.2 for ; Tue, 24 Jan 2017 08:16:49 -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; bh=H6GdgKUY2zuKPnCTap63Mo1yUOR+E+Ae5Vuc0YO5xBI=; b=jFMEf0CS/HKow8ImM9Nha046SK+pFTE83/kcqeywXdgMDES6E8k9MDQ4eTk8HYWepU O6Hj6rxM7FxTr5FjJGaqcCdL5VCFa0dxHlB7qc3HzZMvvHy6ikBrKStoBkTqkA3r9Acz MlYSR1K2wNiE7CRn+ZdZci1UWcAUTsBmr8HNc= 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=H6GdgKUY2zuKPnCTap63Mo1yUOR+E+Ae5Vuc0YO5xBI=; b=VxAIdRA55FzDAPGt6MpDaCxvRHrf9qVf3HDfRMmhy+lUw8YjtBxqAz3h5YMA3xG6P9 UxRW1MNqchJOlrJpJ3J6XW8CId1MsSYwXxYCKc6OEnsJwRXJnKqtt9PI0u4HOFusWf68 k4wUIah7USw0oPAOYWqV4uI6LJPpOuMDJnmkjt2FsscOVCjQW4mwNdYhcCQ9ieIP8g7l MC4uu0HA7af2pVCiAXhkJTcI34PhIuOPhtGW2HGYNcLVFntq9OIUAXseNlHkG80Kmz6l 2+b+dT+cv5biJIJ/eKJmE3jh7zmuP0x3sBHQCYiUXkJ0fbgn7FR4JvuVT2gg218/SpSI plvg== X-Gm-Message-State: AIkVDXLI1xhtwCw5mUsSQYtIlK2+ZOpiFknwNMyTKimoG6sQmLjAysCrrWdwH8g7zj1NF9IO X-Received: by 10.223.179.15 with SMTP id j15mr24327465wrd.159.1485274608128; Tue, 24 Jan 2017 08:16:48 -0800 (PST) Received: from localhost.localdomain ([160.163.215.165]) by smtp.gmail.com with ESMTPSA id n13sm17142511wrn.40.2017.01.24.08.16.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 08:16:47 -0800 (PST) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, torvalds@linux-foundation.org, arnd@arndb.de, rusty@rustcorp.com.au, jeyu@redhat.com, mpe@ellerman.id.au, viro@zeniv.linux.org.uk, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, linux-arch@vger.kernel.org, Ard Biesheuvel Subject: [PATCH v4 0/2] modversions: redefine kcrctab entries as 32-bit values Date: Tue, 24 Jan 2017 16:16:38 +0000 Message-Id: <1485274600-21976-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This v4 is a followup to [0] 'modversions: redefine kcrctab entries as relative CRC pointers', but since relative CRC pointers do not work in modules, and are actually only needed by powerpc with CONFIG_RELOCATABLE=y, I have made it a Kconfig selectable feature instead. Patch #1 introduces the MODULE_REL_CRCS Kconfig symbol, and adds the kbuild handling of it, i.e., modpost, genksyms and kallsyms. Patch #2 switches all architectures to 32-bit CRC entries in kcrctab, where all architectures except powerpc with CONFIG_RELOCATABLE=y use absolute ELF symbol references as before. v4: make relative CRCs kconfig selectable use absolute CRC symbols in modules regardless of kconfig selection split into two patches v3: emit CRCs into .rodata rather than .rodata.modver, given that the latter will be emitted with read-write permissions, making the CRCs end up in a writable module segment. fold the modpost fix to ensure that the section address is only substracted from the symbol address when the ELF object in question is fully linked (i.e., ET_DYN or ET_EXEC, and not ET_REL) v2: update modpost as well, so that genksyms no longer has to emit symbols for both the actual CRC value and the reference to where it is stored in the image [0] http://marc.info/?l=linux-arch&m=148493613415294&w=2 Ard Biesheuvel (2): kbuild: modversions: add infrastructure for emitting relative CRCs modversions: treat symbol CRCs as 32 bit quantities arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/module.h | 4 -- arch/powerpc/kernel/module_64.c | 8 ---- include/asm-generic/export.h | 11 ++--- include/linux/export.h | 14 ++++++ include/linux/module.h | 14 +++--- init/Kconfig | 4 ++ kernel/module.c | 45 ++++++++++---------- scripts/Makefile.build | 2 + scripts/genksyms/genksyms.c | 19 ++++++--- scripts/kallsyms.c | 12 ++++++ scripts/mod/modpost.c | 10 +++++ 12 files changed, 93 insertions(+), 51 deletions(-) -- 2.7.4