From patchwork Tue Mar 10 05:00:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 11428457 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 369DF92A for ; Tue, 10 Mar 2020 05:01:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1888C2467C for ; Tue, 10 Mar 2020 05:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726220AbgCJFBk (ORCPT ); Tue, 10 Mar 2020 01:01:40 -0400 Received: from mga07.intel.com ([134.134.136.100]:16457 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725947AbgCJFBk (ORCPT ); Tue, 10 Mar 2020 01:01:40 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2020 22:01:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,535,1574150400"; d="scan'208";a="353525567" Received: from ldmartin1-desk.jf.intel.com ([10.165.21.151]) by fmsmga001.fm.intel.com with ESMTP; 09 Mar 2020 22:01:39 -0700 From: Lucas De Marchi To: linux-modules@vger.kernel.org Cc: Yanko Kaneti , gladkov.alexey@gmail.com, auke-jan.h.kok@intel.com, Lucas De Marchi Subject: [PATCH 0/6] Fix modules.builtin.alias handling Date: Mon, 9 Mar 2020 22:00:23 -0700 Message-Id: <20200310050029.27678-1-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: owner-linux-modules@vger.kernel.org Precedence: bulk List-ID: This should fix 2 bugs reported last week: - `depmod -n` failing. Like for other binary indexes we just skip now - programs like lspci failing since they don't ignore errors from kmod_load_resources() - the new modules.builtin.alias.bin may not exist if depmod from kmod 27 wasn't executed for that kernel version. Also modules.builtin.modinfo (from where the former is extracted) is only available on recent kernel versions. So make this index optional for kmod_load_resources() - other parts of the code already assume it's optional Lucas De Marchi (6): gitignore: ignore .cache.mk when building modules depmod: do not output .bin to stdout libkmod: simplify lookup when builtin.modinfo.bin file is missing libkmod: fix return error when opening index libkmod: allow modules.alias.builtin to be optional testsuite: add check for kmod_load_resources libkmod/libkmod-index.c | 31 ++++++----- libkmod/libkmod-index.h | 4 +- libkmod/libkmod-module.c | 8 +-- libkmod/libkmod.c | 50 ++++++++++-------- testsuite/module-playground/.gitignore | 1 + .../lib/modules/5.6.0/modules.alias | 1 + .../lib/modules/5.6.0/modules.alias.bin | Bin 0 -> 12 bytes .../lib/modules/5.6.0/modules.builtin | 1 + .../lib/modules/5.6.0/modules.builtin.bin | Bin 0 -> 39 bytes .../lib/modules/5.6.0/modules.dep | 0 .../lib/modules/5.6.0/modules.dep.bin | Bin 0 -> 12 bytes .../lib/modules/5.6.0/modules.devname | 1 + .../lib/modules/5.6.0/modules.softdep | 1 + .../lib/modules/5.6.0/modules.symbols | 1 + .../lib/modules/5.6.0/modules.symbols.bin | Bin 0 -> 12 bytes testsuite/test-init.c | 31 +++++++++++ tools/depmod.c | 6 ++- 17 files changed, 95 insertions(+), 41 deletions(-) create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.alias create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.alias.bin create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.builtin create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.builtin.bin create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.dep create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.dep.bin create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.devname create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.softdep create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.symbols create mode 100644 testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.symbols.bin