From patchwork Fri Feb 3 09:54:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 93151 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp515327qgi; Fri, 3 Feb 2017 01:54:43 -0800 (PST) X-Received: by 10.99.143.90 with SMTP id r26mr16757678pgn.128.1486115683719; Fri, 03 Feb 2017 01:54:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x63si24996624pff.206.2017.02.03.01.54.43; Fri, 03 Feb 2017 01:54:43 -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 S1753130AbdBCJyc (ORCPT + 25 others); Fri, 3 Feb 2017 04:54:32 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37278 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753112AbdBCJy3 (ORCPT ); Fri, 3 Feb 2017 04:54:29 -0500 Received: by mail-wm0-f44.google.com with SMTP id v77so19567655wmv.0 for ; Fri, 03 Feb 2017 01:54:28 -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=B2oioeasOE0n9Y3f9m2H83M6EAzQK9EJwzungespqwc=; b=MW40K6LDjwii1gq+mmMgpDJw71R7SlmUhIbicYkUrTRT85jCYD1hSp2w9hSt6obwJx m6a5yXqsgmGbYndgcsPXY6W9GJuzN+z7F2mowHDSb1J4ApNmoVW41gixfNgDIMt6uaSO t4uQXStsdbzUkRUYImv0zVLh3YlbfhEP+TsnM= 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=B2oioeasOE0n9Y3f9m2H83M6EAzQK9EJwzungespqwc=; b=sYpLEuekFEXimWdjxcfCaHR2d24bqR44uOd0llPlEgCvA2ulQHQxJmt1ax2UPyADZz aVnGEB82Vr0kcDa/V/BYSBJBZJbFWuHRdlPuNIV3F532PDpe3sfPH+p7GXmUDc7zjBDu 1nSPEjBP2IQzv93XL0Fny4nmbpgTN+9gZqw/z+7sSd8qVLFWGKm/zzbrMVvznVrI10GZ bXyPEGRcy+P/mEvxLfi4mkSX7NjI3L+3493VrEfbLcHer7gy93QEmYTagDk6fKukpp69 Rb1YJQ9lQy1+lKzBD3mGSfawr4JU+WVlWhJh79HNkfy5K+lDWKTV67DJi7zxYgUA4b11 yJQw== X-Gm-Message-State: AMke39lqHGeYvzkEhRZNEwCfhGpgCxYcGsVq+eL1rDSX2c2d5a5aTeiksjDNfJJXuCGvx/zb X-Received: by 10.28.139.74 with SMTP id n71mr590591wmd.139.1486115667968; Fri, 03 Feb 2017 01:54:27 -0800 (PST) Received: from localhost.localdomain ([105.130.17.13]) by smtp.gmail.com with ESMTPSA id l67sm2144562wmf.1.2017.02.03.01.54.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Feb 2017 01:54:26 -0800 (PST) From: Ard Biesheuvel To: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, jeyu@redhat.com, rusty@rustcorp.com.au, mmarek@suse.com, mpe@ellerman.id.au Cc: torvalds@linux-foundation.org, arnd@arndb.de, viro@zeniv.linux.org.uk, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH v5 0/3] modversions: redefine kcrctab entries as 32-bit values Date: Fri, 3 Feb 2017 09:54:04 +0000 Message-Id: <1486115647-27680-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. v5: make MODULE_REL_CRCS apply to both vmlinux and modules when selected reinstate Rusty's ack on #2, given that it is now mostly identical again to the patch he acked 3 months ago 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 (3): kbuild: modversions: add infrastructure for emitting relative CRCs modversions: treat symbol CRCs as 32 bit quantities module: unify absolute krctab definitions for 32-bit and 64-bit 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 | 17 +++++-- include/linux/module.h | 14 +++--- init/Kconfig | 4 ++ kernel/module.c | 53 +++++++++----------- scripts/Makefile.build | 2 + scripts/genksyms/genksyms.c | 19 +++++-- scripts/kallsyms.c | 12 +++++ scripts/mod/modpost.c | 10 ++++ 12 files changed, 93 insertions(+), 62 deletions(-) -- 2.7.4