summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-04-04libkmod: Use secure_getenv if availableCristian Rodríguez3-1/+11
"The secure_getenv() function is intended for use in general-purpose libraries to avoid vulnerabilities that could occur if set-user-ID or set-group-ID programs accidentally trusted the environment."
2013-03-21modprobe: Fix assertion on --show-depends with bogus config fileLucas De Marchi2-3/+6
Putting something like "alias psmouse deadbeef" is a hackish way to blacklist a module. While I don't encourage doing so, let's not explode if we fiund such config files. A small difference from the behavior of module-init-tools: we exit with 0 instead of 1.
2013-03-21testsuite: Add test to check if modprobe explodes on bogus configLucas De Marchi14-0/+36
Put this one /etc/modprobe.d/bougs.conf: alias psmouse deaddood `modprobe --show-depends --quiet psmouse` explodes in an assertion (unless you have a module named deaddood). Some people and initrd's use "alias psmouse off" to disable a module instead of blacklisting it or adding a install rule. Add a test with expected_fail == true before fixing this.
2013-03-21testsuite: Exit with success on signal if test has expected_fail=trueLucas De Marchi1-1/+1
2013-03-19libkmod-util: Add missing include fileLucas De Marchi1-0/+1
Fix compilation issue with musl-libc: CC libkmod/libkmod-list.lo In file included from libkmod/libkmod-private.h:183:0, from libkmod/libkmod-list.c:24: libkmod/libkmod-util.h:33:45: warning: 'struct stat' declared inside parameter list [enabled by default] libkmod/libkmod-util.h:33:45: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
2013-03-18rmmod: Teach rmmod about builtin modulesJosh Boyer1-1/+7
Currently modprobe -r will fail if a module is built in and report that it is built in. rmmod calls the same function to determine state but doesn't handle the KMOD_MODULE_BUILTIN return code. This leads to confusing errors like this: libkmod: kmod_module_get_holders: could not open '/sys/module/loop/holders': No such file or directory Error: Module loop is in use Fix this so that it actually reports the correct problem to the user.
2013-02-19libkmod: fix address argument to mmap callsKees Cook2-3/+4
The first argument to mmap should be "NULL" instead of "0".
2013-02-19testsuite: handle finit_moduleKees Cook1-0/+24
This adds the finit_module logic to the testsuite.
2013-02-19libkmod: add finit_module logicKees Cook4-0/+47
When a module is being loaded directly from disk (no compression, etc), pass the file descriptor to the new finit_module() syscall. If the finit_module syscall is exported by the kernel syscall headers, use it. Additionally, if the kernel's module.h file is available, map kmod flags to finit_module flags.
2013-01-17testsuite: Add modinfo test for module signaturesMichal Marek4-1/+26
2013-01-17libkmod: Return module signature information in kmod_module_get_info()Michal Marek4-2/+196
If the module is built with CONFIG_MODULE_SIG, add the the signer's name, hexadecimal key id and hash algorithm to the list returned in kmod_module_get_info(). The modinfo output then looks like this: filename: /home/mmarek/kmod/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64-sha256.ko license: GPL description: Fourth Extended Filesystem author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others alias: ext3 alias: ext2 depends: mbcache,jbd2 intree: Y vermagic: 3.7.0 SMP mod_unload signer: Magrathea: Glacier signing key sig_key: E3:C8:FC:A7:3F:B3:1D:DE:84:81:EF:38:E3:4C:DE:4B:0C:FD:1B:F9 sig_hashalgo: sha256 The signature algorithm (RSA) and key identifier type (X509) are not displayed, because they are constant information for every signed module. But it would be trivial to add this. Note: No attempt is made at verifying the signature, I don't think that modinfo is the right tool for this.
2013-01-17libkmod-module: Do not free the list in kmod_module_info_appendMichal Marek1-7/+8
In error case, just return NULL and let the caller free the list.
2013-01-16Update copyright noticesLucas De Marchi39-39/+39
2013-01-16libkmod-module: Add helper for building the module info listMichal Marek1-19/+22
2013-01-15gitignore: ignore files generated by Automake's testsuiteLucas De Marchi2-0/+21
These files are generated by Automake 1.13 when running the testsuite.
2013-01-07man: fix lib dir in which we look for configLucas De Marchi1-1/+1
Thanks to William Hubbs <w.d.hubbs@gmail.com> for spotting the bug.
2012-12-31depmod: fix builtin symbols resolution when the prefix symbol is setAndrey Mazo1-7/+12
When the prefix symbol is set, take it into account while adding symbols from System.map file by skipping it before "__ksymtab_" comparison. Also, prevent inserted fake symbols (like "__this_module") from being wrongly truncated from beginning.
2012-12-13depmod: --symbol-prefix actually requires an argumentAndrey Mazo1-1/+1
-P requires and uses an argument but its long counterpart --symbol-prefix does not: depmod: option '--symbol-prefix' doesn't allow an argument
2012-12-05kmod 12v12Lucas De Marchi3-2/+12
2012-11-28depmod: fix checking file extensionLucas De Marchi1-2/+3
In depfile_up_to_date_dir() we need to check if name has a kmod extension. "path" variable there will be the directory name, which doesn't contain an extension. Without this, "depmod -A" returns that the modules.dep is up to date, even if it isn't. In depmod_modules_search_file() it's pointless to compare the basename, so pass only the name to be checked.
2012-11-28Use bool instead of intLucas De Marchi2-3/+3
Also change the last field initializer in array to be empty.
2012-11-28fix is_module_filename()Aleksey Makarov4-46/+37
modinfo fails if there is a ".ko" substring in the path to the module
2012-11-21libkmod-module: mangle the section header, not the sectionLucas De Marchi1-13/+41
When we are told to remove the "__versions" section we were mangling that section instead of tweaking the SHF_ALLOC flag in its header.
2012-11-21libkmod-module: Remove key+value vermagic from .modinfo sectionLucas De Marchi1-1/+0
When told to force load a module, we were removing only the value of vermagic instead of the complete entry. Philippe De Swert (philippe.deswert@jollamobile.com) sent a patch that was additionally mangling also the last two chars of the key ("vermagic="). Instead of creating an invalid entry in .modinfo section like this, this patch removes the complete entry, key + value, by zeroing the entire string. Much thanks to Philippe who found the issue and pointed to the fix.
2012-11-16depmod: fix asserting mod->kmod == NULLLucas De Marchi1-1/+1
If we are replacing a lower priority module (due to its location), we already created a kmod_module, but didn't open the file for reading its symbols. This means mod->kmod won't be NULL, and this is just ok. Since all the functions freeing stuff below the previous assert already takes NULL into consideration, it's safe to just unref mod->kmod and let the right thing happens.
2012-11-16depmod: fix hash lookup by relpath instead of uncrelpathLucas De Marchi1-3/+3
We index modules in depmod by it's uncompressed relative path, not relative path. We didn't notice this bug before since this function is only triggered if we release a module to be replaced by one of higher priority. Also fix a leftover log message referring to relpath instead of uncrelpath.
2012-11-08kmod 11v11Lucas De Marchi3-2/+30
2012-11-08TODO: remove completed actionLucas De Marchi1-2/+0
2012-11-06tools: use program_invocation_short_name provided by libcLucas De Marchi8-19/+17
Thanks to Dave Reisner for pointing this out.
2012-11-06tools: staticize functions that are now only used in log.cLucas De Marchi2-51/+43
2012-11-06tools: share function for loggingLucas De Marchi7-122/+36
2012-11-06tools: share setting up libkmod logLucas De Marchi5-5/+17
This also fixes a bug in "e6996c5 rmmod: route all messages to syslog if told to" in which "+ verbose" was removed. Instead of letting verbose add to kmod_get_log_priority(), let it be similar to the other programs instead.
2012-11-06tools: use a single function for logging libkmod outputLucas De Marchi5-75/+86
2012-11-06tools: make usage() messages go to stdout rather than stderrLucas De Marchi5-10/+5
When user supplied --help/-h, program should output to stdout the usage, not to stderr. It's the expected behavior, what the user asked for, not something to log or an error.
2012-11-06tools: share function to convert prio to stringLucas De Marchi6-66/+61
No change is expected in the final binary since right now only an inline function is shared. Later we expect to share more code.
2012-11-06tools: share getting program name from argv for all toolsLucas De Marchi8-28/+34
2012-11-05rmmod: route all messages to syslog if told toLucas De Marchi1-20/+73
2012-11-05rmmod: prefer ERR over plain fprintfLucas De Marchi1-16/+13
2012-11-05modinfo: prefer ERR over plain fprintfLucas De Marchi1-16/+14
2012-11-05insmod: prefer ERR over plain fprintfLucas De Marchi1-11/+11
2012-11-05depmod: add depmod prefix to log messagesLucas De Marchi1-1/+1
2012-11-05depmod: remove inline from _logLucas De Marchi1-1/+1
2012-11-05TODO: update file with tasksLucas De Marchi1-10/+3
2012-11-05depmod: prefer ERR and WRN over plain fprintfLucas De Marchi1-11/+7
2012-11-01modprobe: use ERR() instead of fprintf(stderr, ...)Lucas De Marchi1-30/+32
2012-11-01modprobe: prefix log messages to stderr with modprobeLucas De Marchi1-3/+3
2012-11-01modprobe: move log functionLucas De Marchi1-29/+29
2012-11-01modprobe: prefix libkmod messages to stderr with modprobe:Lucas De Marchi1-7/+18
When we are logging to stderr we are previously relying on libkmod sending it to the default location in case we are not asked to log to syslog. The problem is that modprobe may be used in scripts that don't want to log to syslog (since they are not daemons, like scripts to generate initrd) and then it's difficult to know where the message comes from. This patch treats only the messages coming from libkmod.
2012-10-31modprobe: use prio_to_str() helperLucas De Marchi1-39/+25
2012-10-31modprobe: exit in one placeLucas De Marchi1-8/+5