summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-07-08Add /lib/modules/modprobe.d to configuration search pathHEADtizen_6.5.m2_releasesubmit/tizen_base/20210825.024442submit/tizen_6.5_base/20211028.134101submit/tizen/20210709.005540accepted/tizen/unified/20210712.025003accepted/tizen/base/20210825.055301accepted/tizen/6.5/base/20211028.060105tizen_6.5_basetizenaccepted/tizen_unifiedaccepted/tizen_6.5_baseKarol Lewandowski2-0/+2
This commit adds additional tizen-specific /lib/modules/modprobe.d to kmod search path to allow for packages providing modules to also provide its configuration. In Tizen kernel and modules images are build separately from "platform" image, meaning only limited paths can be used (/lib/modules, /hal) for its files to be accessible from the system. Change-Id: I6985339abd1234aecfb5802484bd57f36a64bab2 Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
2021-05-26Revert "packaging: add zstd compress support"submit/tizen/20210526.055457accepted/tizen/unified/20210528.134723Seung-Woo Kim1-2/+0
This reverts commit a62b5b70983225a86e7cd3c1f4280409683e1b72. The zstd compress module support is not required at this point, and it increases modprobe time a little bit. To reduce increased time, do not use ztd compress support. Change-Id: I18f35545c3ec7bfa52325266a5883cdd64ff7896 Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2021-05-20libkmod: fix possible double free with wrong modules.builtin.modinfoSeung-Woo Kim1-1/+1
Fix double free for *modinfo with non '\0' terminated wrong modules.builtin.modinfo, which is because EOF is minus value. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> [sw0312.kim: cherry-pick mainline commit 675410c3b3b1] Change-Id: I9899505ff12d1444013b92007bb0474115047104
2021-05-20libkmod: fix an overflow with wrong modules.builtin.modinfoSeung-Woo Kim1-1/+1
Fix a possbile overflow with exact PATH_MAX length modname in wrong modules.builtin.modinfo. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> [sw0312.kim: cherry-pick mainline commit 1cab02ecf6ee] Change-Id: I609585cc97d8abb30541b37d3dee0eda66029162
2021-04-12libkmod-config: fix a memory leak when kmod_list_append() failssubmit/tizen/20210412.054957accepted/tizen/unified/20210413.021236Seung-Woo Kim1-1/+3
From kmod_config_new(), when kmod_list_append() fails, fix not list-appended kmod_config_path leak. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> [sw0312.kim: cherry-pick mainline commit 39dd17162374] Change-Id: Ic1d1e77ecc9b81fdd4f0eb771cce1d7b42d0024e
2021-02-17packaging: add zstd compress supportsubmit/tizen/20210218.040335accepted/tizen/unified/20210219.041140Seung-Woo Kim1-0/+2
Add to support zstd compression with libzstd. Change-Id: I74aff3e95b47682f33dff36536e773fb75a27fcc Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2021-02-17add packaging for kmodsubmit/tizen/20210217.041642accepted/tizen/unified/20210218.042141Seung-Woo Kim4-0/+151
Add kmod v28 package to Tizen for supporting program to manage Linux Kernel modules. Note: Change history for previous Tizen package release is below: kmod is packaged into Tizen with manifest domain of floor. v15 is a required dependency for systemd v208 (see TIVI-2197). Bump to v18 using upstream git repo instead of pristin-tar. Bug-Tizen: TC-1921 Signed-off-by: Anas Nashif <anas.nashif@intel.com> Signed-off-by: Alexandru Cornea <alexandru.cornea@intel.com> Signed-off-by: Patrick McCarty <patrick.mccarty@linux.intel.com> Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org> Applied ASLR (CFLAG=-fPIE LDFLAG=-pie) and license file wsa added to /usr/share/licenses/kmod-compat and /usr/share/licneses/libkmod. All packaging modifications are squashed into one commit and bump to v24. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> [yj99.shin@samsung.com: packaging : disable %check section Currently, all tizen OBS projects don't run the %check section. I think the %check section is very good for reinforcing unit tests. But, there are some hurdles because of the qemu. For starting of enabling the %check section, I disable the %check section in the failed packages.] Change-Id: Icdbea83b1625446abe492625ee424f25e377c476 Signed-off-by: Youngjae Shin <yj99.shin@samsung.com> [sw0312.kim: bump version to v27 for Tizen 6.5 packaging: remove not really necessary kmod own includedir bump version to v27 for Tizen 6.0 packaging: add -Wno-maybe-uninitialized to cflags and bump to v26 The GCC has false positive warning about maybe-uninitialized with -O2 and -fexeceptions. Add -Wno-maybe-uninitialized to cflags to remove the false positive warnings. ] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2021-01-07kmod 28v28Lucas De Marchi3-2/+15
2021-01-07build: add comment with rules for libtool version updateLucas De Marchi1-0/+13
2020-12-27build: fix distcheck due to missing zstdLucas De Marchi1-1/+1
Enable zstd since it's used in the testsuite.
2020-12-27testsuite: add test for empty modules.builtin.aliases.binLucas De Marchi12-1/+13
2020-12-27shared: fix UNIQ definitionLucas De Marchi2-3/+6
We need a macro indirection for UNIQ to work. Otherwise it won't be unique at all since it will just append "UNIQ" to the name: In file included from testsuite/test-init.c:30: testsuite/testsuite.h:142:27: error: redefinition of ‘stest_load_resourcesUNIQ’
2020-12-27depmod: unconditionally write builtin.alias.binLucas De Marchi1-4/+6
The file is always created and unless we return an error, the temporary file is renamed to its final destination. All other places write the index without checking if the index is empty, so just do the same. Reported-by: Joe Buehler <aspam@cox.net>
2020-12-03ci: remove semaphoreciLucas De Marchi1-46/+0
It's currently failing and we are already covered by travis-ci.
2020-12-03ci: update travis distroLucas De Marchi1-11/+5
Don't bother with gcc 4.8 vs 4.9, just use the latest one for the distro. Update travis to ubuntu 20.04 so we can get current dependencies.
2020-12-03NEWS: fix typoShuo Wang1-1/+1
2020-12-01libkmod: kmod_log_null: qualify ctx argument as constYauheni Kaliuta1-1/+1
kmod_log_null() does not change ctx (does nothing). Fix warnings In file included from libkmod/libkmod-index.c:33: libkmod/libkmod-index.c: In function ‘index_mm_open’: libkmod/libkmod-index.c:757:6: warning: passing argument 1 of ‘kmod_log_null’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 757 | DBG(ctx, "file=%s\n", filename); Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
2020-12-01depmod: output_builtin_alias_bin: free idx on error pathYauheni Kaliuta1-7/+4
idx is allocated in the beginning but it's not freed if there is a failure after the allocation. Change the error path: return immediately if idx allocation fails and then free it in both success and error path at the end. Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
2020-12-01libkmod: kmod_builtin_get_modinfo: free modinfo on errorYauheni Kaliuta1-0/+1
The function allocates array but on building it if get_string() fails it returns the error leaving the array allocated. The caller does not care about it in error case either. Free it to fix memory leak. Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
2020-10-19man: fix typoSamanta Navarro1-1/+1
2020-09-10testsuite: add test for zstd-compressed moduleTorge Matthies1-1/+9
I took away one module from the gzip-compressed modules for this purpose. Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
2020-09-10add Zstandard compression supportTorge Matthies10-6/+178
I changed the style of the hackargs variable in autogen.sh to multiline because said line was becoming a bit long with the new --with-zstd arg added. A previous version of this patch has been running on my two Arch Linux installations (with an accompanying mkinitcpio patch) for several months over many kernel updates without any issues. Any additional testing and/or patch review would of course be appreciated. Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
2020-03-23testsuite: add check for kmod_load_resourcesLucas De Marchi11-0/+36
Make sure we can call kmod_load_resources when we do have all the mandatory indexes in place.
2020-03-23libkmod: allow modules.alias.builtin to be optionalLucas De Marchi1-3/+12
2020-03-23libkmod: fix return error when opening indexLucas De Marchi3-22/+29
When calling kmod_load_resources() we could end up getting a bogus return value -ENOMEM due to several other reasons, like the index not existing. Change index_mm_open() to propagate the failure reason so we can take actions on it or return to the caller.
2020-03-23libkmod: simplify lookup when builtin.modinfo.bin file is missingLucas De Marchi2-18/+15
When we try to lookup a module and builtin.modinfo.bin is missing, we would do the right thing because the caller was replacing the return code with 0 (and the list was not modified). Make it simpler by allowing the caller to check and differentiate the errors between module not found and index not found.
2020-03-13depmod: do not output .bin to stdoutLucas De Marchi1-1/+5
index_write() relies on fseek/ftell to manage the position to which we are write and thus needs the file stream to support it. Right now when trying to write the index to stdout we fail with: depmod: tools/depmod.c:416: index_write: Assertion `initial_offset >= 0' failed. Aborted (core dumped) We have no interest in outputting our index to stdout, so just skip it like is done with other indexes. While at it, add/remove some newlines to improve readability. Reported-by: Yanko Kaneti <yaneti@declera.com> Fix: b866b2165ae6 ("Lookup aliases in the modules.builtin.modinfo")
2020-03-13testsuite: check for ill-formed kcmdlineLucas De Marchi3-0/+32
Commit ca3bf5d47cec ("iommu/amd: Introduces ivrs_acpihid kernel parameter") in the kernel introduced an ill-formed kernel parameter, ivrs_acpihid. The problem is that it may have a dot on the key side: "ivrs_acpihid[00:14.5]=AMD0020:0". This could potentially trip our parser of module options, but right now it's working as intended: the only thing that happens is that after deciding "ivrs_acpihid[00:14" is a module name, it will fail the underscores() routine and the option will be ignored from the kmod pov (not kernel's pov since that driver parsers the kernel command line by itself).
2020-03-13libkmod: ignore kcmdline option if we fail to parse modnameLucas De Marchi1-1/+2
The error message is saying we are ignoring the option on the kernel command line, so just do it.
2020-03-09gitignore: ignore .cache.mk when building modulesLucas De Marchi1-0/+1
2020-02-28gitignore: ignore release filesLucas De Marchi1-1/+2
2020-02-18kmod 27v27Lucas De Marchi3-2/+51
2020-01-20libkmod: reset was_space on second passLucas De Marchi1-0/+1
The softdep config parser uses a 2-pass approach to use a single allocation for all the softdep struct. However "was_space" variable isn't reset between them. This can lead to a buffer overflow. Reported-by: Jorge Lucangeli Obes <jorgelo@google.com> Link: https://lore.kernel.org/linux-modules/CAKYuF5QhGCPCazHQjN-=kFc5kHs7Ok8WqmmGLo31CiOEN8TYdA@mail.gmail.com
2019-12-29libkmod-module: convert return value from system() to errnoTopi Miettinen1-6/+11
Don't use exit status of a command directly as errno code, callers will be confused. Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2019-12-18modinfo: Show information about built-in modulesAlexey Gladkov3-26/+38
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
2019-12-18Lookup aliases in the modules.builtin.modinfoAlexey Gladkov5-2/+98
New modules.builtin.modinfo duplicates modules.builtin in the built-in module name search. If it exists, then we can use this file, but if not, then we need to fallback to the old file. Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
2019-12-18libkmod: Add function to get list of built-in modulesAlexey Gladkov2-0/+41
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
2019-12-18libkmod: Add parser for modules.builtin.modinfoAlexey Gladkov3-0/+338
The kernel since version v5.2-rc1 exports information about built-in modules in the modules.builtin.modinfo. Information is stored in the same format as in the separate modules (null-terminated string array). The module name is a prefix for each line. $ tr '\0' '\n' < modules.builtin.modinfo ext4.softdep=pre: crc32c ext4.license=GPL ext4.description=Fourth Extended Filesystem ext4.author=Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others ext4.alias=fs-ext4 ext4.alias=ext3 ext4.alias=fs-ext3 ext4.alias=ext2 ext4.alias=fs-ext2 md_mod.alias=block-major-9-* md_mod.alias=md md_mod.description=MD RAID framework md_mod.license=GPL md_mod.parmtype=create_on_open:bool md_mod.parmtype=start_dirty_degraded:int ... Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
2019-11-18Makefile.am: filter -Wl,--no-undefinedFabrice Fontaine1-1/+4
Commit 1d14ef82f4a3be741bcdf6b1c6d51ce9dce43567 does not completely fix the build with python 3.8 as we still get link failure due to '-z undefs' being ignored by some versions of ld. Indeed, -z undefs was added by commit 97a232d7335f3bd0231fd9cd39455bde1d563922 in upstream binutils, and this commit was first present in binutils 2.30. So any toolchain using binutils version older than that won't have -z undefs and will build fail on: /home/buildroot/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/mips-linux-gnu/5.3.0/../../../../mips-linux-gnu/bin/ld: warning: -z undefs ignored. /home/naourr/work/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/aarch64_be-linux-gnu/7.3.1/../../../../aarch64_be-linux-gnu/bin/ld: warning: -z undefs ignored. So filter -Wl,--no-undefined to fix the issue Fixes: - http://autobuild.buildroot.org/results/e9645d9969481b09f507f6e0d0b35faaa283eb60 - http://autobuild.buildroot.org/results/06a6d865b6b7d8ebd793bde214f4a4c40e0962e1 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-11-07modprobe: use flags rather than bool argsLucas De Marchi1-8/+8
It's easier to know what the caller is doing when we pass a named flag rather than a list of bools.
2019-11-07travis: remove old compiler failing to build kernel moduleLucas De Marchi1-11/+18
This is when building the kernel modules for testsuite: Makefile:718: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler gcc: error: unrecognized command line option ‘-fstack-protector-strong’ Just drop gcc 4.8 from running tests. Failure not really related to kmod.
2019-11-06testsuite: update gitignoreLucas De Marchi1-1/+4
2019-11-06modprobe: ignore builtin module on recursive removingYauheni Kaliuta1-6/+12
If there are built-in dependencies and any of them is built-in in the kernel, modprobe -r fails with modprobe: FATAL: Module module_name is builtin. It makes sense to ignore such dependencies for the case when removing is called for non-top level module. Example: cifs module, it declares bunch of softdeps and the first one fails on some kernel configs: modprobe: FATAL: Module gcm is builtin. Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
2019-10-25Do not check for undefined symbols when building the Python modulesThomas Petazzoni1-1/+1
kmod's configure.ac uses the -Wl,--no-undefined linker flag to verify at link time that all symbols of shared libraries are available, and that there are no undefined symbols. This make perfect sense for regular shared libraries. However, for Python extensions, which will be dlopen()ed inside the Python interpreter, it makes less sense. Since Python 3.8, there is a change in python-config script and Python's pkg-config file: it no longer links Python extensions with the libpython library. See https://docs.python.org/dev/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build which states: On the other hand, pkg-config python3.8 --libs no longer contains -lpython3.8. C extensions must not be linked to libpython (except on Android and Cygwin, whose cases are handled by the script); this change is backward incompatible on purpose. (Contributed by Victor Stinner in bpo-36721.) So, when linking the kmod Python extensions, it currently fails with numerous unresolved symbols, that were previously provided by libpython: /home/test/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64-buildroot-linux-gnu/7.4.0/../../../../powerpc64-buildroot-linux-gnu/bin/ld: libkmod/python/kmod/.libs/list_la-list.o: in function `__Pyx_PyObject_GetAttrStr': list.c:(.text.__Pyx_PyObject_GetAttrStr+0x48): undefined reference to `PyObject_GetAttr' /home/test/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64-buildroot-linux-gnu/7.4.0/../../../../powerpc64-buildroot-linux-gnu/bin/ld: libkmod/python/kmod/.libs/list_la-list.o: in function `__pyx_tp_dealloc_4kmod_4list_ModListItem': list.c:(.text.__pyx_tp_dealloc_4kmod_4list_ModListItem+0x78): undefined reference to `PyObject_CallFinalizerFromDealloc' /home/test/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64-buildroot-linux-gnu/7.4.0/../../../../powerpc64-buildroot-linux-gnu/bin/ld: libkmod/python/kmod/.libs/list_la-list.o: in function `__pyx_tp_dealloc_4kmod_4list_ModList': list.c:(.text.__pyx_tp_dealloc_4kmod_4list_ModList+0x30): undefined reference to `PyErr_Fetch' [Complete log at http://autobuild.buildroot.net/results/79a/79a5a0398723e8cfea0d0aa3dec5f7649aee4c63/build-end.log] Linking with libpython is no longer recommended: those symbols should remain unresolved in the Python extensions, as they wil be properly resolved when the Python extension gets loaded into the Python interpreter. Since we want to keep -Wl,--no-undefined globally in kmod, we leave the configure.ac file unchanged, and instead, specifically in the LDFLAGS used to build the Python extensions, we override -Wl,--no-undefined with -Wl,-z,undefs. Ideally, -Wl,--no-undefined is the same as -Wl,-z,defs, and the effect of these options can be canceled on the linker command line by a following -Wl,-z,undefs (see the ld man page for details). Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Victor Stinner <victor.stinner@gmail.com>
2019-05-28libkmod-signature: use PKCS#7 instead of CMSStefan Strogin1-18/+19
Linux uses either PKCS #7 or CMS for signing modules (see scripts/sign-file.c). CMS is not supported by LibreSSL or older OpenSSL, so PKCS #7 is used on systems with these libcrypto providers. CMS and PKCS #7 formats are very similar. CMS is newer but is as much as possible backward compatible with PKCS #7 [1]. PKCS #7 is supported in the latest OpenSSL as well as CMS. The fields used for signing kernel modules are supported both in PKCS #7 and CMS. For now modinfo uses CMS with no alternative requiring OpenSSL 1.1.0 or newer. Use PKCS #7 for parsing module signature information, so that modinfo could be used both with OpenSSL and LibreSSL. [1] https://tools.ietf.org/html/rfc5652#section-1.1 Changes v1->v2: - Don't use ifdefs for keeping redundant CMS code, just use PKCS #7 both with OpenSSL and LibreSSL. Signed-off-by: Stefan Strogin <steils@gentoo.org>
2019-03-08tools: Print a message if refcnt attribute is missingEzequiel Garcia2-6/+12
Currently, check_module_inuse returns a wrong user message if the kernel is built without module unloading support. Fix it by returning a more specific error, in case 'refcnt' attribute is missing.
2019-02-20build: Stop using doltAdrian Bunk4-186/+0
This does regress "make -12" from 0.7s to 0.9s on my Coffee Lake machine, but even on slower hardware this will not amount to a noticable slowdown. On the other hand using dolt can create problems for people doing cross-compilation, e.g. Yocto has two hacks just for dolt in kmod: https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/kmod/kmod.inc?id=a17abae00785c76cfffe5381a22fb2c86b982e82 (Lucas: remove leftover entry in Makefile and reformat commit message)
2019-02-13Link against libcrypto, not all of opensslDave Reisner2-5/+5
In the previous build setup, libkmod.so would link to not just libcrypto.so, but also libssl.so: $ readelf -d /lib/libkmod.so | grep NEEDED 0x0000000000000001 (NEEDED) Shared library: [liblzma.so.5] 0x0000000000000001 (NEEDED) Shared library: [libz.so.1] 0x0000000000000001 (NEEDED) Shared library: [libssl.so.1.1] 0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.1.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] We don't need any symbols from libssl, though. This patch ensures that we pass 'libcrypto' to pkgconfig rather than 'openssl', getting only the library that we need: $ readelf -d ./libkmod/.libs/libkmod.so.2.3.4 | grep NEEDED 0x0000000000000001 (NEEDED) Shared library: [liblzma.so.5] 0x0000000000000001 (NEEDED) Shared library: [libz.so.1] 0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.1.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
2019-02-07kmod 26v26Lucas De Marchi3-2/+49
2019-02-07build: fix make distcheckLucas De Marchi1-1/+2
Make sure to add the dummy.pkcs7 file to the dist files. While at it, also change the distcheck flags to include --with-openssl.