1
0
Fork 0
mirror of git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git synced 2026-03-07 04:00:20 +00:00
No description
Find a file
Wentao Guan 326b32c70c libkmod: Fix open file which some char device
use lseek SEEK_CUR to get whether it is a regular file,
lseek return -ESPIPE when fd is associated with a pipe, socket, or FIFO.

commit 883d931d1b upstream
("modprobe: Allow passing path to module") allow to modprobe a file,
but not handle opening a FIFO device such as modprobe /dev/tty1.

commit 8d03b6c7d9 uptream
("libkmod: Use pread where appropriate") fix some cases,
such as open /dev/tty1, but not for /dev/vmnet0 or /dev/userio etc.

Can be reproduced in run lshw in root and install some vm such ad vmware,
more about the case are in the Link.

Reference: https://github.com/lyonel/lshw/pull/110
Closes: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/2069649
Closes: https://bbs.deepin.org.cn/post/291466
Reported-by: Qi Xu <xuqi@uniontech.com>
Reported-by: lionheartyu <dongshengyuan@uniontech.com>
Fixes: 883d931d1b ("modprobe: Allow passing path to module")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/407
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2026-02-22 13:14:16 -06:00
.github ci: bump the all-actions group across 1 directory with 2 updates 2026-02-12 10:55:47 -06:00
libkmod libkmod: Fix open file which some char device 2026-02-22 13:14:16 -06:00
man Use $(uname -r) throughout 2026-02-09 09:55:41 -06:00
scripts man: de-duplicate AUTHOR/BUGS sections 2026-02-02 22:59:03 -06:00
shared shared/util.h: Protect custom overflow checks 2026-02-18 01:00:36 -06:00
shell-completion insmod: Support --force-{vermagic,modversion} arguments 2025-05-09 09:07:14 -05:00
testsuite testsuite: Prefer _cleanup_free_ to free temp storage 2026-02-18 09:00:22 -06:00
tools tools/depmod: Fix memory leak in depmod_module_add error path 2026-02-18 08:59:57 -06:00
.clang-format Remove _always_inline_ attribute 2025-07-08 07:17:14 -05:00
.codespellignore ci: add more SPDX copyright/license identifiers 2024-09-27 23:08:09 -05:00
.editorconfig ci: add more SPDX copyright/license identifiers 2024-09-27 23:08:09 -05:00
.gitignore .gitignore: remove majority of listings 2026-02-02 22:59:03 -06:00
.mailmap .mailmap: Forward to my personal email 2024-06-14 13:49:03 -05:00
build-dev.ini Enable sanitizers in build-dev.ini 2024-10-18 13:22:11 -05:00
CODING-STYLE.md CODING-STYLE.md: mention clang-format 2026-02-02 22:59:06 -06:00
CONTRIBUTING.md CODING-STYLE.md: convert to markdown 2026-02-02 22:59:06 -06:00
COPYING Clarify what licences apply where 2014-10-09 01:26:34 -03:00
meson.build meson: reuse f strings where possible 2026-02-02 22:59:03 -06:00
meson_options.txt meson: Allow to set dlopen option for compression libraries 2024-12-06 13:15:20 -08:00
NEWS NEWS: squash a couple of typos 2025-03-11 13:44:23 -05:00
README.md libkmod/README.md: convert to markdown 2026-02-02 22:59:06 -06:00

kmod - Linux kernel module handling

OVERVIEW

kmod is a set of tools to handle common tasks with Linux kernel modules like insert, remove, list, check properties, resolve dependencies and aliases.

These tools are designed on top of libkmod, a library that is shipped with kmod. See libkmod/README.md for more details on this library and how to use it. The aim is to be compatible with tools, configurations and indexes from module-init-tools project.

Links

Compilation and installation

In order to compile the source code you need:

  • C11 compiler, supporting a range of GNU extensions - GCC 8+, Clang 6+
  • POSIX.1-2008 C runtime library - Bionic, GNU C library, musl

Optional dependencies, required with the default build configuration:

  • ZLIB library
  • LZMA library
  • ZSTD library
  • OPENSSL library (signature handling in modinfo)

Typical configuration and installation

meson setup builddir/
meson compile -C builddir/
sudo meson install -C builddir/

For end-user and distributions builds, it's recommended to use:

meson setup --buildtype release builddir/

Hacking

When working on kmod, use the included build-dev.ini file, as:

meson setup --native-file build-dev.ini builddir/

The testsuite can be executed with:

meson test -C builddir

It builds test kernel modules, so kernel headers need to be pre-installed. By default it tries to use the kernel header for the currently running kernel. KDIR=any environment variable can be used to tell it to use any installed kernel header or KDIR=/path/to/specific/headers when a specific one is needed. Example:

KDIR=any meson test -C builddir

Make sure to read our contributing guide and the other READMEs: libkmod and testsuite.

Compatibility with module-init-tools

kmod replaced module-init-tools, which was EOL'ed in 2011. All the tools were rewritten on top of libkmod and they can be used as drop in replacements. Along the years there were a few behavior changes and new features implemented, following feedback from Linux kernel community and distros.