summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* build: cache modules from playgroundcached-modulesLucas De Marchi2015-05-3117-0/+21
| | | | | | | | | | Now that we are able to build our own test modules, also allow to use cached modules so a) kernel headers are not required and b) distro maintainers are happy. It's still need a "--disable-test-modules" in the configure since the default is enabled. There's no license problems anymore since all modules come from our own repository, we ship the sources and the modules can be easily rebuilt.
* Fix spurious spaces in lsmod outputSantiago Vila2015-04-161-3/+5
| | | | | | | | | While using "localyesconfig" to build a custom kernel I noticed that lsmod output now has trailing spaces when the list of "Used by" modules is empty. The following patch just delays the space to the point where we are sure that there are more things to print.
* util: use UINT64_MAXLucas De Marchi2015-03-231-1/+1
| | | | | Since we are checking the size of long and long long, use UINT64_MAX in the fallback to be sure thre right size is being used.
* build: sync dolt with upstreamLucas De Marchi2015-03-102-26/+32
|
* tools: add basic versions of insert and removeCaio Marcelo de Oliveira Filho2015-03-0733-1/+376
|
* testsuite: update READMECaio Marcelo de Oliveira Filho2015-03-051-3/+5
|
* testsuite: remove .gitignore files when populating rootfsCaio Marcelo de Oliveira Filho2015-03-051-0/+1
| | | | | | | | | | | | Usually this file is added to keep a directory existing in the repository but without any real content. In rootfs this can be problematic if a directory will have all its files inspected. This happens for kmod_module_get_holders(). Side-note: the 'test-loaded.c' is hit by this problem but doesn't "notice" because the invalid module returned by get_holders() is not checked. The modules in its loop are only used to get the name and generate an output, and NULL was a valid value to generate the name.
* build: use doltLucas De Marchi2015-03-053-0/+181
| | | | | | | | | | | | | | | | | | | | | Drop-in replacement to libtool: http://dolt.freedesktop.org/. More details: http://marc.info/?l=freedesktop-xorg&m=120791871615872&w=3 kmod is relatively fast to compile, so it doesn't matter much. Nonetheless, less forks the better. Compilation time using ./bootstrap-configure --disable-manpages and make -j4 libtool real 0m6.453s user 0m21.067s sys 0m0.773s dolt real 0m4.792s user 0m15.920s sys 0m0.637s
* kmod 20v20Lucas De Marchi2015-03-013-2/+42
|
* Update TODOLucas De Marchi2015-03-011-3/+0
|
* Check return of fseek while reading indexLucas De Marchi2015-02-281-1/+2
|
* Avoid sign-extension error on multiplicationLucas De Marchi2015-02-281-1/+1
| | | | | Do not promote "idx * elf->header.section.entry_size" to int. Explicitly cast the result to uint64_t so it's zero-extended.
* depmod: add asserts to ensure positive return from ftell()Lucas De Marchi2015-02-281-2/+4
| | | | Also ignore some errors that will later be returned by ferror().
* testsuite: add test for modprobe -R <builtin-module>Lucas De Marchi2015-02-282-0/+23
|
* modprobe: stop checking initstate for builtin modulesLucas De Marchi2015-02-281-30/+4
| | | | | | builtin modules are handled in libkmod by looking at the modules.builtin index. There's no need to check again for the module's initstate to decide if it's builtin.
* testsuite: test builtin stateLucas De Marchi2015-02-2813-1/+139
| | | | | | | | The second test, that creates the module by name and then retrieves the initstate was broken before b95fa91 ('Fix race while loading modules'). We would check /sys and return either builtin (if the module has parameters) or give an error because we don't find the module (even if it's in the modules.builtin index)
* Fix race while loading modulesHarish Jenny K N2015-02-283-19/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | usecase: two sd cards are being mounted in parallel at same time on dual core. example modules which are getting loaded is nls_cp437. While one module is being loaded , it starts creating sysfs files. meanwhile on other core, modprobe might return saying the module is KMOD_MODULE_BUILTIN, which might result in not mounting sd card. Experiments done to prove the issue in kmod. Added sleep in kernel module.c at the place of creation of sysfs files. Then tried `modprobe nls_cp437` from two different shells. While the first was still waiting for its completion , the second one returned saying the module is built-in. [ Lucas: The problem is that the creation of /sys/module/<name> and /sys/module/<name>/initstate are not atomic. There's a small window in which the directory exists but the initstate file was still not created. Built-in modules can be handled by searching the modules.builtin file. We actually lose some "modules" that create entries in /sys/modules (e.g. vt) and are not in modules.builtin file: only those that can be compiled as module are present in this file. We enforce mod->builtin to always be up-to-date when kmod_module_get_initstate() is called. This way if the directory exists but the initstate doesn't, we can be sure this is because the module is in the "coming" state, i.e. kernel didn't create the file yet, but since builtin modules were already handled by checking our index the only reason for that to happen is that we hit the race condition. I also added some tweaks to the patch, so we don't repeat the code for builtin lookup. ]
* build: we are kmod, not systemdLucas De Marchi2015-02-271-2/+2
| | | | Fix copy and paste mistake.
* shared: avoid checking for __STDC_VERSION__Lucas De Marchi2015-02-262-1/+9
| | | | | | | | | | Since we pass -std=gnu99 to the compiler __STDC_VERSION__ is defined to 199901. Even in this case we can use _Noreturn. Delegate the testing to the configure phase with a compile test. In future we want to stop using AC_PROG_CC_99 and start using the new AC_PROG_CC from autoconf 2.70, which tries to choose the most recent standard.
* build: simplify and organize configureLucas De Marchi2015-02-261-18/+11
| | | | | | | | | | | - There's no need for the various AC_PROG_CC* macros - No need for AC_C_BIGENDIAN: the only place we care about endianness, we use __BYTE_ORDER - Organize calls to be in similar order as systemd - Disable --disable-largefile. We already had possible bugs in the index implementation if this were passed. It's now fixed, but it's never tested. Disable it. - Bump autoconf requirement to 2.64
* depmod: fix leak in case of malloc(0)Lucas De Marchi2015-02-261-1/+2
| | | | | | malloc(0) can return != NULL. We need to pass the pointer to free(). This happens if index__haschildren(node) returned true, but child_count is set to 0.
* build: add helpers to upload coverity tarballLucas De Marchi2015-02-252-0/+26
|
* depmod: use cleanup attribute to simplify free on exitLucas De Marchi2015-02-251-12/+5
| | | | | | | | | Reusing the root variable was a bad idea. Doing so we could call free() on a variable that was not allocated. For example: "depmod -b / -h". Since we would jump to cmdline_failed, root would not be duplicated. Instead of fighting the order in the options, just used the cleanup attribute and remove the calls to free() on "config_paths" and "root".
* depmod: Fix crash in previous commit if root is not setColin Walters2015-02-251-1/+1
| | | | | | | [This fixes http://build.gnome.org/continuous/buildmaster/builds/2015/02/25/31/build/output.txt ] The variable we're reading here is "root", not "optarg" which is only valid inside the getopt call.
* depmod: fix leaking root on exitLucas De Marchi2015-02-251-1/+5
|
* from systemd: build: make sure to test for -Wflag instead of -Wno-flagDavid Herrmann2015-02-241-2/+3
| | | | | | | | gcc does not support testing for negated warnings. See here for details: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63499 This patch changes CC_CHECK_FLAG_APPEND to always test for the non-negated warnings.
* from systemd: build-sys: fix conftest.c to work on armZbigniew Jędrzejewski-Szmek2015-02-241-1/+1
| | | | | | All tests for compiler support were failing with: /usr/bin/ld: /tmp/ccwnVc2A.o: relocation R_ARM_MOVW_ABS_NC against `a' can not be used when making a shared object; recompile with -fPIC
* from systemd: build: check for build/link flags harderDavid Herrmann2015-02-241-3/+3
| | | | | | | | Use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE to test for flags that might succeed during compilation but not during linking. An example is gcc compiled with libssp support but gnu-ld without it. In this case -fstack-protector works fine during compilation but fails during linking as several internal helpers are missing.
* from systemd: build: merge trivial changes backLucas De Marchi2015-02-241-12/+15
| | | | | | | | | These were trivial changes applied to systemd tree since the files were synchronized: - change some comments - replace tab with space - fix typo
* build: add missing files to EXTRA_DISTLucas De Marchi2015-02-241-7/+23
| | | | Fix make distcheck.
* module-playground: don clean all .ko filesLucas De Marchi2015-02-241-4/+6
| | | | | Rather than calling kernel's make for clean target, do it by ourselves. This way we can preserve some prebuilt modules.
* testsuite: move test-blacklist to DEFINE_TESTMarcus Meissner2015-02-221-4/+3
| | | | | | otherwise the test will not be executed. Signed-Off-By: Marcus Meissner <meissner@suse.de>
* testsuite: port signature-check modules to module-playgroundLucas De Marchi2015-02-219-11/+53
| | | | | | | | | | | We use a "fake signature" to sign the modules. As far as kmod is concerned the signature fields are informational only. It's the kernel the responsible for checking it's valid. So what we are doing here is: pick the signatures of the ext4-x86_64.ko module and save as dummy.{hashalgo}. This signature is appended to the mod-simple.ko module so the ext4-x86_64.ko module can be removed from tree.
* testsuite: port arch-specific tests to module-playgroundLucas De Marchi2015-02-2113-34/+48
| | | | | | | | | Rename modinfo_jonsmodules() to test_modinfo_signature(): now this test is responsible only for the signed modules. The other tests use specific flags to modinfo in order to print only one field, so we can filter out those fields that are expect to change if the module is recompiled.
* fixup! module-playground: allow to cross-compile modulesLucas De Marchi2015-02-211-3/+0
|
* testsuite: leave arch-specific modules in treeLucas De Marchi2015-02-215-0/+27
| | | | | | | | | This is for convenience for development and testing since we don't want to needlessly cross-compile the modules. There's a README file explaining the building process for those who want to update them. These files are compiled from their respective .c and thus have LPGL license.
* testsuite: add option to copy output from testLucas De Marchi2015-02-212-0/+7
| | | | | This is helpful while debugging the tests: copy the output from test (both stdout and stderr) to the stdout of the parent process.
* testsuite: fix exiting with success on no output activityLucas De Marchi2015-02-211-4/+28
| | | | | | | | If we were expecting output on stdout or stderr but the test didn't produce any, we were incorrectly assuming the test was successful. Now test on exit if there was activity on the monitored fd. If there was, check also if the file size to check for output is > 0 for the cases in which we want to assert there was no activity on certain fd.
* module-playground: allow to cross-compile modulesLucas De Marchi2015-02-214-1/+45
| | | | | | | | | | | This adds the needed infra to cross-compile modules so we can test them in our testsuite. Right now we are only compiling mod-simple.ko for x86, x86_64 and sparc64. The makefiles are organized in a way it's easy to force a rebuild of a module by calling the Makefile.arch directly and that allows the rule in Makefile to not trigger in case we want to ship the modules pre-compiled.
* testsuite: port modules-order-compressed to module-playgroundLucas De Marchi2015-02-1912-1/+117
|
* Update TODOLucas De Marchi2015-02-191-0/+3
|
* libkmod: better explain a signed module layoutLucas De Marchi2015-02-181-7/+11
|
* libkmod: consider empty signature key as invalidLucas De Marchi2015-02-181-1/+2
| | | | | | | | | | | | | A segmentation fault occurs if a module has an empty key attached to its signature. This is mostly likely due to a corrupted module. The crash happens because kmod_module_get_info() assumes that kmod_module_signature_info() returns a signature of at least 1 byte. The fix is based on a patch from Tobias Stoeckmann <tobias@stoeckmann.org>, but rather than changing kmod_module_get_info() to fix the crash, this changes kmod_module_signature_info() to consider the signature as invalid.
* Fix out of bounds signature access with 32 bit off_tTobias Stoeckmann2015-02-181-1/+1
| | | | | | | | | | If kmod has been configured with --disable-largefile on a 32 bit system, off_t will be 32 bit. In that case, the parsed sig_len can bypass a validation check (it's _unsigned_ 32 bit). Due to the unlikeliness of people using --disable-largefile, this is a mere validation fix. With an explicit signed 64 bit cast, there is no binary change for 99.9% of Linux systems out there. ;)
* libkmod: properly validate file sizeTobias Stoeckmann2015-02-171-5/+5
| | | | | | | | | | | | | | | | | | | In function kmod_elf_new, the file size has to be properly validated against section offset. Currently, the file size is considered valid based on ELF header size + section header size * section count. That is not sufficient. In fact, ELF specifies a section header offset, which doesn't have to be the size of the ELF header. The supplied test cases even cover this. The correct test is: section offset + section header size * section count This patch also verifies that this value won't overflow. I don't know a way to crash a tool due to this bug, because later on the offset check would prevent out-of-bounds access. An overflow would just mean to access a wrong part in elf->memory. Yet it's a validation error. Please note: The file size does not have to be validated against the size of the ELF header again, elf_identify did this already.
* testsuite: port kcmdline test to module-playgroundLucas De Marchi2015-02-1110-7/+5
|
* testsuite: port install-cmd-loop test to module-playgroundLucas De Marchi2015-02-1112-138/+9
|
* testsuite: port alias-to-none test to module-playgroundLucas De Marchi2015-02-1010-7/+5
|
* testsuite: port tests without finit_module() to module-playgroundLucas De Marchi2015-02-1014-14/+10
|
* testsuite: port modprobe --force test to module-playgroundLucas De Marchi2015-02-108-6/+4
|