Commit Graph

1376 Commits

Author SHA1 Message Date
Yauheni Kaliuta d242703211 testsuite: fix test_array_sort pointers inderection
The array elements in the tests are strings, what means "char *"
in С. The comparation funtion takes pointers to the elements, so
the arguments become "char **". It means, that strcmp() cannot be
used directrly.

The patch creates a wrapper on strcmp() which perfoms
dereferencing of the "char **" to supply the actual strings to
strcmp(), and uses the wrapper as a comparation function for the
qsort() call.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
2016-11-08 22:21:13 -02:00
Lucas De Marchi cb51a641d6 depmod: fix string overflow
Use scratchbuf to fix issue with strcpy that may overflow the buffer we
declared in the stack.
2016-08-15 10:26:42 -03:00
Lucas De Marchi 780a4e97e2 Add scratchbuf implementation
This should fill the requirements for "we need to loop over a lot of
strings that usually are small enough to remain on stack, but we want to
protect ourselves against huge strings not fitting in the static
buffer we estimated as sufficient"
2016-08-15 10:26:42 -03:00
Lucas De Marchi a6421a04e0 testsuite: include stdio.h
It's used in the log macros so include it.
2016-08-15 10:26:42 -03:00
Lucas De Marchi a6ede6c7ad util: fix warning of equal values on logical OR
shared/util.c: In function ‘read_str_safe’:
shared/util.c:211:24: warning: logical ‘or’ of equal expressions [-Wlogical-op]
    if (errno == EAGAIN || errno == EWOULDBLOCK ||
                        ^~
shared/util.c: In function ‘write_str_safe’:
shared/util.c:237:24: warning: logical ‘or’ of equal expressions [-Wlogical-op]
    if (errno == EAGAIN || errno == EWOULDBLOCK ||
                        ^~

This is because EAGAIN and EWOULDBLOCK have the same value. Prefer
EAGAIN, but add a static assert to catch if it's not the same in another
architecture.
2016-08-10 12:45:36 -03:00
Lucas De Marchi 53d3a99ccc libkmod: fix use of strcpy
We were not checking if there was sufficient space in the buffer.
2016-08-08 11:42:52 -03:00
Lucas De Marchi 65a885df5f kmod 23 2016-07-20 01:38:42 -03:00
Lucas De Marchi a29268d00e NEWS: add items for kmod 23 2016-06-28 15:28:47 -03:00
Lucas De Marchi a0f6726e66 libkmod: fix integration with gtk-doc
It was failing to generate doc with recent version of gtk-doc

[kmod]$ ./bootstrap
libkmod/docs/gtk-doc.make:33: error: EXTRA_DIST must be set with '=' before using '+='
libkmod/docs/Makefile.am:29:   'libkmod/docs/gtk-doc.make' included from here
autoreconf: automake failed with exit status: 1

Just add an empty EXTRA_DIST so it works.
2016-06-28 12:15:38 -03:00
Lucas De Marchi e78fe15f0a libkmod-module: modinfo: print signature id
This way it's possible to give at least the signature type for PKCS#7.
2016-06-27 08:17:55 -03:00
Lucas De Marchi 75f45d9bfa libkmod-signature: handle PKCS#7 2016-06-27 08:17:55 -03:00
Lucas De Marchi dcdb17715e libkmod-module: do not crash modinfo on 0 key id len 2016-06-27 08:17:55 -03:00
Michal Marek 2206d7f763 libkmod: Handle long lines in /proc/modules
kmod_module_new_from_loaded() calls fgets with a 4k buffer. When a
module such as usbcore is used by too many modules, the rest of the line
is considered a beginning of another lines and we eventually get errors
like these from lsmod:

libkmod: kmod_module_get_holders: could not open '/sys/module/100,/holders': No such file or directory

together with bogus entries in the output. In kmod_module_get_size, the
problem does not affect functionality, but the line numbers in error
messages will be wrong.

Signed-off-by: Michal Marek <mmarek@suse.com>
2016-06-21 18:00:20 -03:00
Anton Blanchard d46136bb59 depmod: Ignore PowerPC64 ABIv2 .TOC. symbol
The .TOC. symbol on the PowerPC64 ABIv2 identifies the GOT
pointer, similar to how other architectures use _GLOBAL_OFFSET_TABLE_.

This is not a symbol that needs relocation, and should be ignored
by depmod.
2016-06-11 00:27:39 -03:00
Lucas De Marchi f7ed430a53 README: add link to patchwork 2016-05-24 11:45:25 -03:00
Héctor Orón Martínez 90a6e7983f kmod: compiling with old sed version (!ERE support)
Makefile.am uses `sed -E', which it is found on BSD sed; however a
  replacement on GNU sed would be `sed -r'. Both intend to use extended
  regular expressions (ERE). However I have a system that does not support
  those, in benefit for portability could you consider replacing ERE by BRE.

Signed-off-by: Héctor Orón Martínez <hector.oron@gmail.com>
2016-05-21 15:07:27 -03:00
Peter Wu 1930899aae kmod_module_get_refcnt: fix documentation 2016-05-21 14:27:53 -03:00
Lucas De Marchi 9132c59ebc travis: workaround bug in environment setup
Travis is poluting the environment, particularly PYTHON_CFLAGS which
makes the build to fail. Just unset the variable since we don't want to
override these cflags.
2016-01-11 11:19:36 -02:00
Josh Triplett 4c30a11d5f depmod: Don't insert comment in modules.devname if otherwise empty
This allows tools to detect the file as empty, such as via systemd's
ConditionFileNotEmpty.
2016-01-11 10:25:31 -02:00
Marc-Antoine Perennou d64b286a9a insmod: fix wron fallthrough of -f
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2015-11-20 19:26:33 -02:00
Lucas De Marchi 42f32b8ae4 kmod 22 2015-11-17 22:12:07 -02:00
Philippe De Swert 2b2a503e4f insmod: do support -f
The -f switch is accepted by insmod, but silently ignored. This
causes the user to wonder why things don't work. As insmod is
most often used with "evil" modules, -f is almost default and
thus needs to work.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
2015-10-25 13:57:17 -02:00
Lucas De Marchi f7f2851024 libkmod: export new kmod_get_dirname() function
Make sure it gets exported and add documentation.
2015-09-30 15:28:24 -03:00
Laura Abbott f3f62f5ec3 depmod: Don't fall back to uname on bad version
Currently, if a value that doesn't match a kernel version
("%u.%u") is passed in, depmod silently falls back to
using uname. Rather than try and work around the caller passing
bad data, just exit out instead.
2015-09-30 15:17:05 -03:00
Laura Abbott 50f43ce2f6 depmod: Remove unprinted debug messages
In between the start of the program and the call to log_setup_kmod_log,
the only messages that will be printed are the ones at or above the
global default level. Debug messages in this range will never be printed
so remove them.
2015-09-30 15:17:03 -03:00
Laura Abbott 16d863c317 Change default log level
The default log level is currently LOG_ERR. Tools can override this
default but there is a non-trivial amount of setup that needs to
happen before the log level can be changed. Since tools may want to
use the warn level for things such as deprecated flags, change the
default to LOG_WARNING to ensure messages get printed.
2015-09-30 15:17:01 -03:00
Laura Abbott b87d01d6ef modprobe: Update error message when path is missing
Currently, modprobe fails with no output by default if the
search paths it tries are missing:

$ modprobe -S notakernel dm-crypt
$
$ modprobe -S notakernel lkjjweiojo
$

This is fairly cryptic and not at all obvious there is a problem
unless the error code is checked or verbose flags are used.
Update the error message to indicate a problem and print out the
directory that failed.
2015-09-30 15:16:59 -03:00
Laura Abbott 4cce76eb45 README: Indicate cython requirements
The recommended flags require cython be installed to compile
successfully. Note this in the documentation.
2015-09-30 15:16:57 -03:00
Natanael Copa e414d087d9 build: let sed use posix ERE instead of GNU extension
Use POSIX Extended Regular Expression (ERE) instead of the GNU extension
\| in the install-exec-hook. This makes it create the symlink properly
with busybox sed built with musl libc. It will silently create a broken
symlink otherwise.

Lucas De Marchi:  fix up added newline.
2015-06-22 11:23:57 -03:00
Lucas De Marchi 114ec87c85 libkmod-module: fix return code in error path
ENOSYS is the wrong errno to return when we don't find a module in
kmod_module_insert_module(). Why is it there in the first place?  This
goes back to kmod v1 when we couldn't load modules by names, but we
should give a path instead.

708624a ("ELF: initial support for modinfo and strip of modversions and
vermagic.") changed that so we do a lazy-search by the module path in
this function. Later  f304afe ("Change error message to reflect
reality") fixed the log message but the return coded remained the same.
2015-06-13 18:29:47 -03:00
Lucas De Marchi 0d833715ea Add README.md file with build details
Add the badges from semaphoreci and coverity and point people to the
README file with more information.
2015-06-11 14:45:50 -03:00
Lucas De Marchi 2bfcd7ef80 kmod 21 2015-06-09 02:36:14 -03:00
Lucas De Marchi fc1bc8155f build: add cache to distributed files
We were missing the cache directory on the distributed files.
2015-06-09 02:03:36 -03:00
Lucas De Marchi 681c623e71 build: silence stderr on coverity rules
We try to execute git in order to get the dependencies for the coverity
rules. And it gets executed even when we are not calling that specific
rule.  Later we may want to improve it, but for now let's just silence
the errors of not being a git repository when executing this on a
packaged version.
2015-06-09 02:01:11 -03:00
Santiago Vila 8feffdfa2e kmod: fix small typo in rmmod(8)
This is how rmmod(8) looks like:

SEE ALSO
       modprobe(8), insmod(8), lsmod(8)modinfo(8)

The attached trivial patch fixes it:

SEE ALSO
       modprobe(8), insmod(8), lsmod(8), modinfo(8)
2015-06-08 22:46:42 -03:00
Lucas De Marchi 655de2751d tools: display features in --version
Reviewed-by: Andreas Mohr <andim2@users.sf.net>
2015-06-08 22:38:02 -03:00
Lucas De Marchi 4671e03e1d build: add relevant features to KMOD_FEATURES in config.h
Not all the features (i.e. those available in --enable-* or --with-*)
are really relevant to the final user. Create a KMOD_FEATURES definition
in config.h containing these features.

Reviewed-by: Andreas Mohr <andim2@users.sf.net>
2015-06-08 22:37:58 -03:00
Lucas De Marchi a968aa64dd build: add function to build string of features
Add a CC_FEATURE_APPEND function that we can use to append the features
that are enabled/disabled. This will generate a single string in the
form "+FEATURE1 +FEATURE2 -FEATURE3".

Reviewed-by: Andreas Mohr <andim2@users.sf.net>
2015-06-08 22:37:10 -03:00
Lucas De Marchi b1499094c6 tools: add PACKAGE definition in message
Reported-by: Andreas Mohr <andim2@users.sf.net>
2015-06-08 21:33:06 -03:00
Lucas De Marchi 013e855043 tools: Hide new commands behind experimental flag
Hide the commands behind a flag so we can continue doing releases while
the commands aren't ready.
2015-06-06 23:26:31 -03:00
Lucas De Marchi 23603f1f83 build: cache modules from playground
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.
2015-05-31 15:38:47 -03:00
Santiago Vila 7266ec4337 Fix spurious spaces in lsmod output
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.
2015-04-16 08:46:43 -03:00
Lucas De Marchi a8c73b8609 util: use UINT64_MAX
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.
2015-03-23 23:47:23 -03:00
Lucas De Marchi 9cc8a20d34 build: sync dolt with upstream 2015-03-10 15:17:03 -03:00
Caio Marcelo de Oliveira Filho 037618816c tools: add basic versions of insert and remove 2015-03-07 12:09:51 -03:00
Caio Marcelo de Oliveira Filho f4f408f9f3 testsuite: update README 2015-03-05 23:56:44 -03:00
Caio Marcelo de Oliveira Filho 0f079cba76 testsuite: remove .gitignore files when populating rootfs
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.
2015-03-05 23:56:36 -03:00
Lucas De Marchi da6c0d2f52 build: use dolt
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
2015-03-05 13:14:36 -03:00
Lucas De Marchi d9c7175859 kmod 20 2015-03-01 14:43:09 -03:00
Lucas De Marchi f7c243ac59 Update TODO 2015-03-01 14:16:59 -03:00