]> git.ipfire.org Git - thirdparty/kmod.git/log
thirdparty/kmod.git
32 hours agoCOPYING: drop double-space the Copyright example master
Emil Velikov [Sat, 18 Jul 2026 17:42:20 +0000 (18:42 +0100)] 
COPYING: drop double-space the Copyright example

I am assuming that the COPYING boilerplate is the source for all the
varying double-space instances we have (had) in-tree.

Update those, so we can avoid them in the future.

As always, the typical IANAL disclaimer applies. To the best of my
knowledge and understanding the two forms are identical. With the
original being _slightly_ annoying especially if your editor
high-lights the double-space.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agoRemove double-space in Copyright boilerplate
Emil Velikov [Sat, 18 Jul 2026 17:35:02 +0000 (18:35 +0100)] 
Remove double-space in Copyright boilerplate

The amount of double space (and variation) in the Copyright statements
is... Interesting.

As always, the typical IANAL disclaimer applies. To the best of my
knowledge and understanding the two forms are identical. With the
original being _slightly_ annoying especially if your editor
high-lights the double-space.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: add respective Copyright year
Emil Velikov [Sat, 18 Jul 2026 17:28:03 +0000 (18:28 +0100)] 
testsuite: add respective Copyright year

The Copyright header was pulled props to the weakdep test, which was
written/merged in 2024. Add the respective year, so the copyright
statement is valid.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: rename test-list -> test-libkmod-list
Emil Velikov [Sat, 18 Jul 2026 17:10:12 +0000 (18:10 +0100)] 
testsuite: rename test-list -> test-libkmod-list

Unlike the other libkmod tests, this one explicitly covers internal-only
API. As such keep it separate, to avoid pulling (again) the internal
headers and potentially leaking implementation details where they should
not be found.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-weakdep into test-libkmod
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-weakdep into test-libkmod

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-multi-softdep into test-libkmod
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-multi-softdep into test-libkmod

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-dependencies into test-libkmod
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-dependencies into test-libkmod

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-loaded into test-libkmod
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-loaded into test-libkmod

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-blacklist into test-libkmod
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-blacklist into test-libkmod

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-initstate into test-libkmod
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-initstate into test-libkmod

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-new-module into test-libkmod
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-new-module into test-libkmod

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: rename test-{init,remove} -> test-libkmod
Emil Velikov [Sat, 18 Jul 2026 14:01:32 +0000 (15:01 +0100)] 
testsuite: rename test-{init,remove} -> test-libkmod

We're starting to consolidate/fold the dozen+ tests into a few top-level
ones. This is the first step, renaming the first shared (utility) into
the final unified location.

We're moving both test-init and test-remove at the same time, while
renaming the latter, to workaround a meson complaint as below:

  rootfs ... is dirty, please run 'meson compile testsuite/create-...

Suspecting some form of bug in the test and/or setup, but unwrapping
that's for another day.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: move modprobe test into test-modprobe.c
Emil Velikov [Sat, 18 Jul 2026 13:14:50 +0000 (14:14 +0100)] 
testsuite: move modprobe test into test-modprobe.c

... alongside all the other modprobe tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-util into test-shared
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-util into test-shared

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-strbuf into test-shared
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-strbuf into test-shared

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: fold test-hash into test-shared
Emil Velikov [Sat, 18 Jul 2026 14:06:14 +0000 (15:06 +0100)] 
testsuite: fold test-hash into test-shared

Arguably improves things by providing some grouping and clarity on the
origin, structure and coverage of the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: rename test-array -> test-shared
Emil Velikov [Sat, 18 Jul 2026 14:01:32 +0000 (15:01 +0100)] 
testsuite: rename test-array -> test-shared

We're starting to consolidate/fold the dozen+ tests into a few top-level
ones. This is the first step, renaming the first shared (utility) into
the final unified location.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agoshared: rename tmpfile-util -> tmpfile
Emil Velikov [Sat, 18 Jul 2026 09:19:12 +0000 (10:19 +0100)] 
shared: rename tmpfile-util -> tmpfile

None of the exiting files have similar suffixes, so let's drop the odd
one out.

While in there, properly sort the meson source listing.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: remove UNIQ(testname)
Emil Velikov [Sat, 18 Jul 2026 09:11:13 +0000 (10:11 +0100)] 
testsuite: remove UNIQ(testname)

Stop making the test name variable (section entry) unique. This is no
longer needed, plus we'll reshuffle some of the remaining names shortly.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: flip testsuite iteration order
Emil Velikov [Sat, 18 Jul 2026 12:59:38 +0000 (13:59 +0100)] 
testsuite: flip testsuite iteration order

The way the tests are added to the section is implementation specific.
Altohough in practise both gcc and clang to so in revert order. Thus if
we have tests defined as:

  DEFINE_TEST(first, ...);
  DEFINE_TEST(second, ...);
  ...
  DEFINE_TEST(last, ...);

A simple list/walk will be:

  last,
  ...
  second,
  first,

Reverse the order, so the output of `--list` and the execution is a
little more human friendly.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: tweak __{start,stop}_kmod_tests declaration
Emil Velikov [Sat, 18 Jul 2026 12:53:50 +0000 (13:53 +0100)] 
testsuite: tweak __{start,stop}_kmod_tests declaration

Const annotate the struct (we don't/cannot modify them) and drop the no
longer needed hidden attribute.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: add FIXME note about libkmod-internal.h include
Emil Velikov [Sat, 18 Jul 2026 15:23:18 +0000 (16:23 +0100)] 
testsuite: add FIXME note about libkmod-internal.h include

We really do not want to have dependency on an internal header(s), since
it opens the possibility of leaking implementation details into what
should be API level tests.

Although, it could be that we should remove kmod_list from the public
API all together... Something for another day either way.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: remove no longer needed undef hacks
Emil Velikov [Sat, 18 Jul 2026 15:21:58 +0000 (16:21 +0100)] 
testsuite: remove no longer needed undef hacks

As of last commit there are no conflicting ERR macros.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: add TS_ prefix to logging macros
Emil Velikov [Sat, 18 Jul 2026 14:54:05 +0000 (15:54 +0100)] 
testsuite: add TS_ prefix to logging macros

The tests have their own namespace (mostly at least), move the logging
macros to it accordingly. Thus we can remove the undef hacks that we
have in-tree.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: convert a should-be-unreachable LOG to an ERR
Emil Velikov [Sat, 18 Jul 2026 14:25:32 +0000 (15:25 +0100)] 
testsuite: convert a should-be-unreachable LOG to an ERR

Of the two call-sites to remove_directory() we have:
 - we explicitly stat/S_ISDIR check prior, and
 - the folder must exist, or out init_module.c implementation is broken

Thus is seems very unlikely to trigger the LOG and in practice, it
indicates a bug/race condition. Convert it to an ERR and return -1 to
indicate that.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
32 hours agotestsuite: remove overly verbose logging
Emil Velikov [Sat, 18 Jul 2026 14:20:56 +0000 (15:20 +0100)] 
testsuite: remove overly verbose logging

The delete_module.c (LD_PRELOAD module) prints the result of the
TC_DELETE_MODULE_RETCODES parsing. At the same time the init_module.c
(and it's variant) don't bother.

Glancing throughout, no other test uses LOG so let's drop the logging
allowing us to garbage collect (hide really) the potentially conflicting
macros.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/450
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
13 days agotestsuite: s/return EXIT_SUCCESS/return 0/
Emil Velikov [Fri, 3 Jul 2026 12:05:03 +0000 (13:05 +0100)] 
testsuite: s/return EXIT_SUCCESS/return 0/

With all the EXIT_FAILURE instances done from the tests (only ones in
tools and the test runner remain), lets drop the EXIT_SUCCESS ones.

Functionally identical and arguably slightly neater.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/375
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
13 days agotestsuite: convert all tests to TS_ASSERT()
Emil Velikov [Fri, 3 Jul 2026 11:45:56 +0000 (12:45 +0100)] 
testsuite: convert all tests to TS_ASSERT()

Currently we have some inconsistencies across the tests:
 - using TS_ASSERT vs not
 - (non TS_ASSERT tests) leaking on error vs not

In practical terms, we are not too worried about the leaks, since the
test failure comes first. As such, convert all the tests to TS_ASSERT().

This means we loose the useful error messages in a few instances, which
could be re-introduced at a later point alongside a TS_ASSERT_MSG()
macro.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/375
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
13 days agotestsuite: replace assert_return with TS_ASSERT
Emil Velikov [Fri, 3 Jul 2026 10:35:53 +0000 (11:35 +0100)] 
testsuite: replace assert_return with TS_ASSERT

Mechanical change, done with:

sed -i  "s/assert_return/TS_ASSERT/;s/, EXIT_FAILURE//" testsuite/*.c

In addition, manually fixup the two multiline instances (test-strbuf.c
and test-util.c) and remove the no longer used macro.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/375
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
13 days agotestsuite: introduce TS_ASSERT reimplementing assert_return
Emil Velikov [Fri, 3 Jul 2026 10:20:42 +0000 (11:20 +0100)] 
testsuite: introduce TS_ASSERT reimplementing assert_return

The existing macro has a few shortcomings:
 - lowercase, non-prefixed so it can be confused with assert(3), which
   has varying behaviour depending on -DNDEBUG
 - the return value is constant across the project

Introduce TS_ASSERT which is modelled after KUNIT_ASSERT, addressing the
above and tweaking the output format.

Existing instances of assert_return will be updated with a follow-up
commit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/375
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
13 days agotestsuite: don't use assert_return() for empty testsuite
Emil Velikov [Fri, 3 Jul 2026 10:50:04 +0000 (11:50 +0100)] 
testsuite: don't use assert_return() for empty testsuite

With follow-up commit we'll rework/remove the macro, where the new
version does not allow for providing the return value.

Swap it for a manual ERR, printing a more useful error message.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/375
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
3 weeks agoci: specify/run only the gcov pluin
Emil Velikov [Fri, 3 Jul 2026 21:46:17 +0000 (22:46 +0100)] 
ci: specify/run only the gcov pluin

The default has changed with codecov v5, where all existing plugins are
attempted. In practise we only need gcov, which seems to work file.

Specify it, saving us the following warning:

  coverage.py is not installed or can't be found.

Initially I tried adding it to the Ubuntu image, only to notice they
lack the looked for `coverage.py` executable and instead have
`python{version.minor}-coverage.py`.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/448
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
3 weeks agoci: use the correct argument for codecov
Emil Velikov [Fri, 3 Jul 2026 21:21:38 +0000 (22:21 +0100)] 
ci: use the correct argument for codecov

With codecov v5, their release note states (et al):

  The following arguments have been changed
    - `file` (this has been deprecated in favor of `files`)

Where they actually meant _removed_... Oopsie :-)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/448
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
3 weeks agoci: add ubuntu-26.04, update runners
Emil Velikov [Fri, 3 Jul 2026 20:43:11 +0000 (21:43 +0100)] 
ci: add ubuntu-26.04, update runners

Ubuntu 26.04 is the first version to include mbedtls v3. Add it to the
build and update the runners to it.

Getting us a step closer to having a) formal code coverage for that path
and b) knowing what fixes we'll need once the runner is out of
"preview".

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/448
Signed-off-by: Lucas De Marchi <ldemarchi@kernel.org>
5 weeks agoci: enable mbedtls by default for most instances
Emil Velikov [Sun, 31 May 2026 20:07:03 +0000 (21:07 +0100)] 
ci: enable mbedtls by default for most instances

As the mbedtls introduction commit says, mbedtls v3 is not available in
Debian 12 and Ubuntu 22.04/24.04.

Although to ensure we have sufficient build coverage, let's enable it
everywhere else. While also adding a permutation where it's the only
crypto implementation built-in.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/426
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 weeks agombedlts: add as alternative to openssl
Emil Velikov [Sun, 15 Feb 2026 21:11:58 +0000 (21:11 +0000)] 
mbedlts: add as alternative to openssl

In a recent conversation improving the depmod runtime, we noticed that
kmod_module_signature_info() normally takes 20-25% of the total runtime
for uncompressed modules.

The related attempts at using threads, also indicated that OpenSSL may
not be thread-safe... At least, not the way we use it.

Enter Mbed TLS (formerly known as polarssl), self described as:

Mbed TLS is a C library that implements X.509 certificate manipulation ...
... Its small code footprint makes it suitable for embedded systems. ...

There are 3 major/LTS versions in the wild,
 - v2 released in 2015 - Debian 12- and Ubuntu 24.04-
 - v3 released in 2021 - Debian 13+, Ubuntu 25.04+ and everywhere*
 - v4 released in 2025 - close to non-existing adoption

In practical terms, using MbedTLS has proven to be a much shorter and
simpler implementation. Effectively eliminating the time spent in
kmod_module_signature_info() to practically zero. With the overall
execution time dropping respectively - 0.43s -> 0.35s on my machine.

From instructions/memory statistics POV, we have (per module):
 - ~50k fewer instructions
 - ~55 fewer memory allocations
 - ~2KB less memory is allocated

Also, Helgrind seems quite happy.

Availability aside, there are a few IMHO minor downsides:
 - MD4 support was removed with v3
 - SM3 support is not available - neither in v3 nor v4
 - No algo to string API

I wasn't able to find any distribution/builds that use MD4 or SM3 so
this aspect shouldn't be too critical.

Whereas for the algo-to-string API - it's a trivial mapping, that we can
(should?) copy from the kernel alongside the enum itself... But that's
an exercise for another day - alongside fixing the no openssl/mbedtls
code path.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/426
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 weeks agolibkmod: move openssl-related functions to separate file
Emil Velikov [Mon, 1 Jun 2026 14:45:57 +0000 (15:45 +0100)] 
libkmod: move openssl-related functions to separate file

Move openssl-related function to a separate file so it's easier to
isolate the dependency on each crypto library.

This will allow multiple implementations to co-exist in the same build.

As a nice side effect we fallback to the "dummy" implementation in the
(very likely) case that the openssl one fails.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/426
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 weeks agomeson: use arrays to manage module compressions/signatures
Emil Velikov [Mon, 1 Jun 2026 14:45:40 +0000 (15:45 +0100)] 
meson: use arrays to manage module compressions/signatures

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/426
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 weeks agolibkmod: Add build-id item to kmod_module_get_info()
Lucas De Marchi [Wed, 25 Mar 2026 05:28:46 +0000 (00:28 -0500)] 
libkmod: Add build-id item to kmod_module_get_info()

If available, add the build-id to the info list returned by
kmod_module_get_info(). This allows us to compare the build-id of a
loaded module versus the build-id of the file. It's rather cumbersome
command, but it works:

$ ./build/modinfo -F build-id hid
AE:7A:2E:37:E0:2B:31:D5:72:7C:87:87:15:8C:05:FA:77:7A:4F:57
$ xxd -p -u -s16  /sys/module/hid/notes/.note.gnu.build-id  | sed 's/../&:/g;s/:$//'
AE:7A:2E:37:E0:2B:31:D5:72:7C:87:87:15:8C:05:FA:77:7A:4F:57

An option to modinfo to really to just dump the raw value can be added
in future.

Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/432
5 weeks agolibkmod: Add helper to read .note.gnu.build-id section
Lucas De Marchi [Wed, 25 Mar 2026 04:34:28 +0000 (23:34 -0500)] 
libkmod: Add helper to read .note.gnu.build-id section

Read the .note.gnu.build-id section so it can be displayed by modinfo in
a future change. For now this is only added to pretty-print the id, but
later can be refactored to easily compare with the section dump from
/sys/module/<module-name>/.note.gnu.build-id

The section in the elf is potentially available since kernel 4.10 (if
toolchain supports it) and became unconditional since commit
89ff7131f78a ("kbuild: add --hash-style= and --build-id unconditionally")
since minimum toolchain versions got raised.

Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/432
5 weeks agolibkmod: Add elf_get_u32() helper
Lucas De Marchi [Thu, 23 Apr 2026 19:43:10 +0000 (14:43 -0500)] 
libkmod: Add elf_get_u32() helper

Shortcut to the size.

Keep this wrapper inline even after the previous de-inlining change:
it is a tiny typed helper around elf_get_uint() that avoids repeating
the uint32_t size at call sites, while the larger helpers can still be
left to the compiler.

Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/432
5 weeks agolibkmod: Drop too much inlining
Lucas De Marchi [Wed, 25 Mar 2026 04:21:57 +0000 (23:21 -0500)] 
libkmod: Drop too much inlining

Let the compiler decide depending on the optimization level.

Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/432
2 months agoci: bump the all-actions group with 3 updates
dependabot[bot] [Fri, 1 May 2026 01:41:12 +0000 (01:41 +0000)] 
ci: bump the all-actions group with 3 updates

Bumps the all-actions group with 3 updates: [github/codeql-action](https://github.com/github/codeql-action), [advanced-security/filter-sarif](https://github.com/advanced-security/filter-sarif) and [codecov/codecov-action](https://github.com/codecov/codecov-action).

Updates `github/codeql-action` from 4.32.0 to 4.35.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/b20883b0cd1f46c72ae0ba6d1090936928f9fa30...95e58e9a2cdfd71adc6e0353d5c52f41a045d225)

Updates `advanced-security/filter-sarif` from 1.0.1 to 1.1
- [Release notes](https://github.com/advanced-security/filter-sarif/releases)
- [Commits](https://github.com/advanced-security/filter-sarif/compare/f3b8118a9349d88f7b1c0c488476411145b6270d...2da736ff05ef065cb2894ac6892e47b5eac2c3c0)

Updates `codecov/codecov-action` from 5.5.2 to 6.0.0
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/671740ac38dd9b0130fbe1cec585b89eea48d3de...57e3a136b779b570ffcdbf80b3bdc90e7fab3de2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: advanced-security/filter-sarif
  dependency-version: '1.1'
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Link: https://github.com/kmod-project/kmod/pull/435
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2 months agoAdd and install valgrind suppression file
Emil Velikov [Sun, 8 Feb 2026 16:04:38 +0000 (16:04 +0000)] 
Add and install valgrind suppression file

We're leaking some dlopen handles, by design. It is cleaned up when the
process is closed and there is no reason to be concerned/alarmed.

To indicate that, let's ship a valgrind suppression file.

Admittedly these are not 100% enough since depending on the c runtime
and/or version it can leak some global state, which gets caught.

The newer the glibc version, the more likely it is to exbibit such
behaviour.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/420
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2 months agomeson: Make dlopen=all the default
Lucas De Marchi [Fri, 24 Apr 2026 14:55:51 +0000 (09:55 -0500)] 
meson: Make dlopen=all the default

As of earlier commit, all dependencies can be dlopen'd on demand. Do
that for all optional libraries by default, but still allow it to be
overridden during build.

Example numbers/benefits taken from `modprobe --show-depends nouveau`:

 - fewer instr - 50% reduction, 1.2M -> 0.5M
 - less memory use - Rss by ~33%, 3M -> 2M
 - reduced attack surface

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/420
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2 months agolibkmod: Add ELF note for openssl library
Emil Velikov [Sun, 8 Feb 2026 12:21:23 +0000 (12:21 +0000)] 
libkmod: Add ELF note for openssl library

Follow the new spec for ELF notes as detailed in
https://systemd.io/ELF_PACKAGE_METADATA/.

We can copy mostly verbatim the macros from systemd codebase.

Example output:

$ meson setup --native-file build-dev.ini -Ddlopen=openssl build
...
    dlopen           : openssl

    features         : +ZSTD +XZ +ZLIB +OPENSSL

$ dlopen-notes.py build/libkmod.so.2
# build/libkmod.so.2
[
  {
    "feature": "openssl",
    "description": "Support for reading module signatures",
    "priority": "suggested",
    "soname": [
      "libcrypto.so.3"
    ]
  }
]

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/420
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2 months agolibkmod: Allow to load libcrypto.so on demand
Emil Velikov [Sun, 8 Feb 2026 12:13:42 +0000 (12:13 +0000)] 
libkmod: Allow to load libcrypto.so on demand

Use dlfcn helpers to load libcrypto once it's needed.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/420
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2 months agomeson: bump minimal openssl/libcrypto to 3.0.0
Emil Velikov [Fri, 6 Feb 2026 20:38:18 +0000 (20:38 +0000)] 
meson: bump minimal openssl/libcrypto to 3.0.0

OpenSSL 3.0 introduces semantic versioning, thus one can reason about
the supported (and/or broken) API/ABI by glancing at the number.

Version 3.0 was released in late 2021 and is adopted by, at least:
 - CentOS Stream 9
 - Debian 11 aka oldoldstable
 - Fedora 38
 - openSUSE Leap 15.5
 - Ubuntu 22.04

This means that some older, yet maintained, enterprise-y linuxes will be
left in the dark. Namely:
 - RHEL 6,7
 - SLES 11,12,15?
 - Ubuntu {14,16,18,20}.04

To the best of my knowledge, all of them are in deep maintenance mode
and do not target latest kmod releases.

Bumping the requirement, allows us to focus on a single DSO and its API,
as we move to dlopen(libcrypto.so) with the next commit(s).

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/420
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agoshared: util.c: fix buffer overflow in alias_normalize()
Anton Moryakov [Tue, 10 Mar 2026 16:07:15 +0000 (19:07 +0300)] 
shared: util.c: fix buffer overflow in alias_normalize()

The while-loop inside the '[' case of alias_normalize() increments the
index 'i' without checking against PATH_MAX bounds. If the input string
contains an opening '[' followed by many characters without a closing ']',
the index can exceed PATH_MAX-1, causing a buffer overflow when writing
to buf[i].

Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/431
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod/libkmod-signature: rework struct kmod_signature_info
Emil Velikov [Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)] 
libkmod/libkmod-signature: rework struct kmod_signature_info

Currently, we use a stack allocated instance which bolts of misc private
data via a void *, while also having an optional free callback.

In kmod we opt to pre-calculate the total size, do a one-off allocation,
copy the data as needed, adjusting the pointers.

Doing the same here, gives us a mixed bag of benefits:
 - shorter and simpler code
 - smaller binary - ~100 bytes off
 - fewer instructions - ~40 per module
 - few allocations - ~2 per module
 - extra bytes are allocated - ~180 per module

The updated code seems far more natural and consistent with the
code-base. Although, if we really want to squeeze more cycles we could
use a reasonably large stack buffer and fallback to heap.

v2:
 - don't leak on d2i_PKCS7_bio failure
 - use +1 (instead of sizeof('\0')) for the null terminator

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod/libkmod-signature: const annotate some stack vars
Emil Velikov [Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)] 
libkmod/libkmod-signature: const annotate some stack vars

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod/libkmod-signature: remove a few local variables
Emil Velikov [Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)] 
libkmod/libkmod-signature: remove a few local variables

Drop a couple of the local variables, which are used only once. They
make the, arguably convoluted, code even harder to follow.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod/libkmod-signature: fold a few NULL checks
Emil Velikov [Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)] 
libkmod/libkmod-signature: fold a few NULL checks

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod/libkmod-signature: remove set but unused sig_alg
Emil Velikov [Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)] 
libkmod/libkmod-signature: remove set but unused sig_alg

The function PKCS7_SIGNER_INFO_get0_algs takes three output arguments,
all of which are optional. Remove the set but unused sig_alg.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod/libkmod-signature: drop pkcs7_private::key_id sign-ness
Emil Velikov [Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)] 
libkmod/libkmod-signature: drop pkcs7_private::key_id sign-ness

There is no signed/unsigned declaration in kmod_signature_info, so let's
do the same for the private declaration.

Silence BN_bn2bin(), by applying the cast locally.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod/libkmod-signature: remove kmod_signature_info::algo
Emil Velikov [Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)] 
libkmod/libkmod-signature: remove kmod_signature_info::algo

Allegedly it has been hard-coded to RSA for ages and thus, it was
never printed by modinfo.

Furthermore out of the 3 code-paths only a single one parses it...

Just drop the dead code adding a somewhat helpful comment for future
code explorers.

Thus shaves ~150 bytes off the binary and allows us to shrink the
struct.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod/libkmod-signature: move sig_info->id_type assignment further up
Emil Velikov [Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)] 
libkmod/libkmod-signature: move sig_info->id_type assignment further up

It is identical across all the (3) code paths. So move it to the caller,
thus we no longer need to pass the struct module_signature in the PKCS7
case.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod/libkmod-signature: remove ENABLE OPENSSL comments
Emil Velikov [Sun, 15 Feb 2026 21:34:01 +0000 (21:34 +0000)] 
libkmod/libkmod-signature: remove ENABLE OPENSSL comments

Having the guard repeated in the else/endif lines is generally a good
idea. Although in this case a) it has a typo (missing _) and b) no other
part of the code-base does it.

Just remove the instances for consistency sake.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/427
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agotestsuite: reshuffle preload env. variable handling
Emil Velikov [Fri, 13 Feb 2026 19:52:35 +0000 (19:52 +0000)] 
testsuite: reshuffle preload env. variable handling

Get the existing LD_PRELOAD early and do a two pass on the rest.

Effectively calculate the total length, allocate and copy... Instead of
the existing recalc, realloc, copy.

Fewer allocations (failure points), while also being a bit simpler and
shorter code.

v2:
 - append existing ldpreload

v3:
 - revert to prepending, do so only as needed

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/429
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agotestsuite: fold setenv() in single block(ish)
Emil Velikov [Fri, 13 Feb 2026 19:52:35 +0000 (19:52 +0000)] 
testsuite: fold setenv() in single block(ish)

... to make it stand out from all the realloc/copying.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/429
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod: fold kmod_file_{load_content,get_{content,size}}
Emil Velikov [Fri, 6 Feb 2026 19:35:15 +0000 (19:35 +0000)] 
libkmod: fold kmod_file_{load_content,get_{content,size}}

Currently, the kmod_file data fits in two groups:
 - populated on initialization (aka kmod_file_open)- fd, compression
 - populated on kmod_file_load_contents - contents, size

Currently, the caller has to track/remember kmod_file_load_contents
prior to calling the contents/size getters...

At the same time, we don't need the fine grained API since all call
sites need both contents and size. So let's just fold the three
together.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
Not a huge fan of the casts, although we already use similar approach in
kmod_module_load_elf and others.

Don't mind going either way - keep the casts or drop the const.

Link: https://github.com/kmod-project/kmod/pull/418
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod: tweak kmod_module_get_elf()
Emil Velikov [Wed, 4 Feb 2026 15:12:48 +0000 (15:12 +0000)] 
libkmod: tweak kmod_module_get_elf()

As of last commit, the kmod_elf is stored in the kmod_module instance.
Thus we no longer need the getter and the stack kmod_elf pointer.

Rename the function to kmod_module_load_elf() to align with rest of the
codebase, dropping the elf output pointer - callers can access it
directly via the kmod_module struct.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/418
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod: inline kmod_file_get_elf() as applicable
Emil Velikov [Thu, 29 Jan 2026 12:07:53 +0000 (12:07 +0000)] 
libkmod: inline kmod_file_get_elf() as applicable

Move the kmod_elf instance from the kmod_file into the kmod_module
struct. Thus reducing the module->file->elf nesting, simplifying
kmod_module_get_elf() call sites and making the former
kmod_file_get_elf() callers tad easier to follow.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/418
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
3 months agolibkmod: remove kmod_elf_get_memory()
Emil Velikov [Thu, 29 Jan 2026 11:39:52 +0000 (11:39 +0000)] 
libkmod: remove kmod_elf_get_memory()

The API is used solely in the tests, where the pointer returned is
identical to the one passed to kmod_elf_new().

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/418
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agolibkmod: Fix open file which some char device
Wentao Guan [Thu, 19 Feb 2026 15:45:10 +0000 (23:45 +0800)] 
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 883d931d1bd04b089b85b554d1df6f41dcf5fbf5 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 8d03b6c7d990af301950d3ecdc4b5c69fa525928 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: 883d931d1bd04 ("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>
5 months agotestsuite: Prefer _cleanup_free_ to free temp storage
Lucas De Marchi [Thu, 12 Feb 2026 16:36:35 +0000 (10:36 -0600)] 
testsuite: Prefer _cleanup_free_ to free temp storage

`preload` is freed in all exit paths, just use _cleanup_free_ to avoid
bugs like the one fixed in commit e1d21ab27277 ("testsuite: Fix memory
leak in test_export_environ error paths").

As noted by Emil, there's one place where the free() can't be removed:
when we are replacing what preload points to. Keep that one, zap the
rest.

Link: https://github.com/kmod-project/kmod/pull/423
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agotestsuite: Fix memory leak in test_export_environ error paths
jared mauch [Thu, 12 Feb 2026 13:54:14 +0000 (13:54 +0000)] 
testsuite: Fix memory leak in test_export_environ error paths

[emil: split from larger patch, commit message]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/423
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agotools/depmod: Fix memory leak in depmod_module_add error path
jared mauch [Thu, 22 Jan 2026 04:25:31 +0000 (23:25 -0500)] 
tools/depmod: Fix memory leak in depmod_module_add error path

[emil: split from larger patch, commit message]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/423
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoshared/util.h: Protect custom overflow checks
Tobias Stoeckmann [Fri, 23 Jan 2026 11:20:14 +0000 (12:20 +0100)] 
shared/util.h: Protect custom overflow checks

Make sure that division by zero is never possible.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
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/415
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoshared/util.h: Use generic for size_t arithmetic
Tobias Stoeckmann [Thu, 22 Jan 2026 19:20:41 +0000 (20:20 +0100)] 
shared/util.h: Use generic for size_t arithmetic

This improves support for rare systems like s390 in 31 bit mode, where
the size of size_t is equals uint32_t, yet types still differ.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
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/415
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoci: bump the all-actions group across 1 directory with 2 updates
dependabot[bot] [Sun, 1 Feb 2026 01:24:24 +0000 (01:24 +0000)] 
ci: bump the all-actions group across 1 directory with 2 updates

Bumps the all-actions group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [github/codeql-action](https://github.com/github/codeql-action).

Updates `actions/checkout` from 6.0.1 to 6.0.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/8e8c483db84b4bee98b60c0593521ed34d9990e8...de0fac2e4500dabe0009e67214ff5f5447ce83dd)

Updates `github/codeql-action` from 4.31.9 to 4.32.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/5d4e8d1aca955e8d8589aabd499c5cae939e33c7...b20883b0cd1f46c72ae0ba6d1090936928f9fa30)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action
  dependency-version: 4.32.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Link: https://github.com/kmod-project/kmod/pull/419
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoConsistently use endian.h swapping API
Emil Velikov [Sun, 8 Feb 2026 14:43:31 +0000 (14:43 +0000)] 
Consistently use endian.h swapping API

A handful of places are still using the old "networking" API. Swap that
with the usual (no longer GNU/glibc specific) ntobe*/be*toh.

Be that to stay consistent, to improve clarity or to celebrate that the
later is part of POSIX (2024) - take your pick.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/421
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoutil: Use const variable type in mkdir_parents
Rudi Heitbaum [Sun, 8 Feb 2026 14:49:49 +0000 (01:49 +1100)] 
util: Use const variable type in mkdir_parents

For ISO C23, the function strchr that return pointers into their input
arrays now have definitions as macros that return a pointer to a
const-qualified type when the in put argument is a pointer to a
const-qualified type.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/pull/422
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoUse $(uname -r) throughout
Emil Velikov [Wed, 28 Jan 2026 15:21:10 +0000 (15:21 +0000)] 
Use $(uname -r) throughout

The backtick notation is considered deprecated, I believe. We already
have a handful of $(...) instances, so if nothing else it's better to
stay consistent.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/pull/416
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoman/modprobe.8: use MODULE_DIRECTORY as applicable
Emil Velikov [Wed, 28 Jan 2026 15:08:37 +0000 (15:08 +0000)] 
man/modprobe.8: use MODULE_DIRECTORY as applicable

The original XML based documentation was referencing MODULE_DIRECTORY
which got erroneously swapped to DISTCONFDIR during the scdoc
conversion.

Closes: https://github.com/kmod-project/kmod/issues/410
Fixes: f3a423b6 ("man: add scdoc based man pages")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/pull/416
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agolibkmod/README.md: convert to markdown
Emil Velikov [Wed, 28 Jan 2026 21:05:51 +0000 (21:05 +0000)] 
libkmod/README.md: convert to markdown

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agotestsuite/README.md: convert to markdown
Emil Velikov [Wed, 28 Jan 2026 21:04:03 +0000 (21:04 +0000)] 
testsuite/README.md: convert to markdown

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoCODING-STYLE.md: mention clang-format
Emil Velikov [Wed, 28 Jan 2026 20:09:17 +0000 (20:09 +0000)] 
CODING-STYLE.md: mention clang-format

Copy/paste the section from CONTRIBUTING.md, completing the circle.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoCODING-STYLE.md: update line wrapping section
Emil Velikov [Wed, 28 Jan 2026 20:04:42 +0000 (20:04 +0000)] 
CODING-STYLE.md: update line wrapping section

We follow the tab + spaces, alongside a 90 col (soft) limit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoCODING-STYLE.md: trim down the inspiration section
Emil Velikov [Wed, 28 Jan 2026 19:56:10 +0000 (19:56 +0000)] 
CODING-STYLE.md: trim down the inspiration section

Omit nearly everything but the projects which serve as inspiration and
the associated (updated) Linux kernel style guide link.

The checkpatch references are not particularly useful - the tool
exists in another (massive) git repo, plus we're using clang-format.

Plus the line wrapping details are already listed a few lines below.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoCODING-STYLE.md: convert to markdown
Emil Velikov [Wed, 28 Jan 2026 19:50:20 +0000 (19:50 +0000)] 
CODING-STYLE.md: convert to markdown

Convert to markdown adding respective sections, heading and TOC.
Contents will be updated separately.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoCONTRIBUTING.md: less "you", use calmer style
Emil Velikov [Wed, 28 Jan 2026 19:17:07 +0000 (19:17 +0000)] 
CONTRIBUTING.md: less "you", use calmer style

While initially writing this file, I didn't quite realise how much it
was trying to reach out and point back at the reader.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoCONTRIBUTING.md: mellow down bugs/regressions section
Emil Velikov [Wed, 28 Jan 2026 19:16:21 +0000 (19:16 +0000)] 
CONTRIBUTING.md: mellow down bugs/regressions section

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoCONTRIBUTING.md: some shell completions have landed
Emil Velikov [Wed, 28 Jan 2026 19:14:05 +0000 (19:14 +0000)] 
CONTRIBUTING.md: some shell completions have landed

... update the document to reflect that.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoCONTRIBUTING.md: embed the DCO
Emil Velikov [Wed, 28 Jan 2026 18:57:26 +0000 (18:57 +0000)] 
CONTRIBUTING.md: embed the DCO

In the future, we might want to use the "reuse" tool to check/track
licensing information of the repo. For better or worse it will complain
that the in-tree DCO.txt is missing SPDX copyright/licensing
information.

It can be worked around, by adding it into a separate file. Although a
much simpler solution is to just inline it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoUse the SPDX `-or-later` license throughout
Emil Velikov [Wed, 28 Jan 2026 18:49:42 +0000 (18:49 +0000)] 
Use the SPDX `-or-later` license throughout

The shorthand `GPLv2+` and `LGPLv2.1+` got me as I was writing the meson
build, even though I was fully aware of the correct license.

Use the full SPDX identifier throughout the project - aka update the two
documents to align with the rest of the project.

Reference: ca9a7f4c ("build: Fix license specification")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/417
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoman: remove outdated COPYRIGHT section
Emil Velikov [Mon, 10 Nov 2025 00:05:02 +0000 (00:05 +0000)] 
man: remove outdated COPYRIGHT section

While the section is fairly common (11.9k instances of 27.5k man pages
in my Arch install) it is not as ubiquitous as the rest.

Furthermore, the information is severely outdated.

Just remove it all together, instead of trying to devise some clever way
of managing it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoman: de-duplicate AUTHOR/BUGS sections
Emil Velikov [Sun, 9 Nov 2025 23:30:08 +0000 (23:30 +0000)] 
man: de-duplicate AUTHOR/BUGS sections

Move the sections into a dedicated trailer.scd file, which gets added
during manpage generation.

Note, that this removes the following text from kmod.8, which is
intentional:

*kmod* project was started by Lucas De Marchi as a drop-in replacement to
module-init-tools that was maintained by Jon Masters, adding a library (libkmod)
and additional features.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoscripts/build-scdoc.sh: stop using cat
Emil Velikov [Sun, 9 Nov 2025 23:20:44 +0000 (23:20 +0000)] 
scripts/build-scdoc.sh: stop using cat

We don't need the cat + extra pipe - sed can take the input filename as
an argument.

This change is meant to ease de-duplication of the man pages - coming
with a later commit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months ago.gitignore: remove majority of listings
Emil Velikov [Sun, 9 Nov 2025 21:47:09 +0000 (21:47 +0000)] 
.gitignore: remove majority of listings

With the move to meson. only out-of-tree builds are allowed. As such, we
can remove ~90% of the contents of our .gitignore file(s).

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agotestsuite: swap empty .gitignore for .gitkeep
Emil Velikov [Wed, 28 Jan 2026 16:59:01 +0000 (16:59 +0000)] 
testsuite: swap empty .gitignore for .gitkeep

Later commit will be removing some no longer needed .gitignore files
and/or contents.

In a few instances, we want the empty folder to be preserved so swap the
empty .gitignore for the more widely used and obvious (IMHO) .gitkeep.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agomeson: reuse f strings where possible
Emil Velikov [Sun, 9 Nov 2025 22:21:44 +0000 (22:21 +0000)] 
meson: reuse f strings where possible

With meson 0.61 we can use f strings, over the explicit .format().
Multi-line f-strings are introduced with meson 0.63, which we don't
require yet, plus it's not like we have many instances.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoman: remove manual .so links
Emil Velikov [Sun, 9 Nov 2025 21:41:20 +0000 (21:41 +0000)] 
man: remove manual .so links

These are left overs from the autotools-side of the build system.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agomeson: use identical ln arguments internally
Emil Velikov [Thu, 29 Jan 2026 11:18:53 +0000 (11:18 +0000)] 
meson: use identical ln arguments internally

Update the internal symlinks to also use -r/--relative, just like the
installed ones.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agomeson: wrap the whole tools section inside an if block
Emil Velikov [Thu, 29 Jan 2026 11:13:16 +0000 (11:13 +0000)] 
meson: wrap the whole tools section inside an if block

At the moment, we leave random bits out of the `if get_option('tools')`
block (internal/static libkmod, kmod.pc and internal symlinks).

The latter of which, is annotated as build_by_default:true, which means
it always pulls the executable - kmod - and ultimatelly, we build all
tools related artefacts even with -Dtools=false.

Just wrap the whole section and simplify the executable() a bit. Namely:
use install: true and drop build_by_default.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agomeson: remove default install:false for static libs
Emil Velikov [Thu, 29 Jan 2026 11:08:17 +0000 (11:08 +0000)] 
meson: remove default install:false for static libs

The default for install is false... for static/shared libraries and
executables at least. The documentation for custom_target doesn't
specify.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agomeson: remove build_by_default instances in man/
Emil Velikov [Sun, 9 Nov 2025 23:12:01 +0000 (23:12 +0000)] 
meson: remove build_by_default instances in man/

With earlier meson versions (pre 0.50) build_by_default and install
didn't have great integration. With newer meson versions, as the former
is undefined the latter will control both.

More importantly, the whole meson.build is included only on
get_option('manpages').

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoman: underline the module/file name in modinfo(8)
Emil Velikov [Sun, 9 Nov 2025 21:13:51 +0000 (21:13 +0000)] 
man: underline the module/file name in modinfo(8)

We do so in all other manual pages, so update the outlier.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agoman: remove inconsistent ellipsis
Emil Velikov [Sun, 9 Nov 2025 15:13:19 +0000 (15:13 +0000)] 
man: remove inconsistent ellipsis

In a number of places we are using ellipsis to indicate plural/multiple
instances. It's not fairly consistent plus we can live without them in
my opinion.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
5 months agormmod: s/list of modulenames/modulenames/
Emil Velikov [Sun, 9 Nov 2025 21:11:50 +0000 (21:11 +0000)] 
rmmod: s/list of modulenames/modulenames/

Drop the "list of" part - we are already (somewhat) consistently using
modulenames across the tree.

While in here, also drop the square brackets - the modulename(s) is not
an optional argument.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Link: https://github.com/kmod-project/kmod/pull/pull/400
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>