Age | Commit message (Collapse) | Author | Files | Lines |
|
Don't mix spaces and tabs in the help output so things always line up.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Work is in progress to replace this existing code base with a new one.
Updated the README file with details.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Conflicts:
ChangeLog
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Fix another build problem encountered in Fedora build system.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
This was breaking some builds when the stale file was detected.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
master.kernel.org:/pub/scm/utils/kernel/module-init-tools/module-init-tools into dev
Conflicts:
ChangeLog
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
master.kernel.org:/pub/scm/utils/kernel/module-init-tools/module-init-tools
Conflicts:
ChangeLog
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
A brown paper bag fix for 3.14 to correct man page output handling.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The docbook2man package does not allow output to be written to standard out,
nor does the SGML allow for more than one file to be created. A previous
hack was to use symlinks and hope for the best. Rather than doing this,
retain the symlinks, but explicitly match on them during build and
create symlinks to the output files. Furthermore, clean up the
documentation source files to remove invalid multiple outputs.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Fix the changelog.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Quick edit to the 3.14 release to include an updated changelog.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
This pi release includes various fixes, an updated build release
system, and improved code documentation.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The legacy release process was outdated. Fix it to use modern tools,
and create additional make targets, such as "push" to kernel.org.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Some more todos, this time for modprobe
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Add proper function documentation and clean up
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The FSF GPLv2 boilerplate has needed updating for a long, long time.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The FSF GPLv2 boilerplate has needed updating for a long, long time.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Some cleanup activities for depmod, and more generally.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Document various functions within depmod.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
There are too many different functions basically managing lists in depmod.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
These options are incompatible. Make sure that is clear.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The -m depmod parameter forces generation of legacy map files.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The -w parameter can be used to instruct depmod to detect duplicates
when generating its index tables.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The -P argument can be supplied to specify a prefix character to strip
from all symbols.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Depmod has an ability to output a file named modules.devname containing
a list of all "devname" aliases provided by modules. This file is read by
a utility such as udev, which can create necessary devices in /dev.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
A previous patch added support for verifying the list of symbols
supplied by modules matches with the kernel list.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Add an additional space character to fix formatting in SYNOPSIS.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
These files were a little out of date. There's always the git history,
but it's nice to have a record of various relevant changes here too.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
This latest release includes multiple modprobe configuration directories
(allowing for runtime preference /run/modprobe.d, /etc/modprobe.d,
/usr/local/lib/modprobe.d, /lib/modprobe.d). There is also support for
kernel versions other than 2.6.x since a 3.x release is forthcoming.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
A previous patch for multiple modprobe configuration directories added a call
to info() for each configuration file loaded. This breaks various existing
behavior (for example --show-depends output) and so is reverted for now.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
What a stupid check.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Configuration files are parsed in alphabetic order, regardles of what
directory they reside in. Furthermore, if several files by the same name
exist in different directories only the one in the directory with highest
precedence is loaded.
The order of precedence is /run, /etc, /usr/local/lib, /lib.
Cc: Jon Masters <jcm@jonmasters.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Aaron Griffin <aaron@archlinux.org>
Cc: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Read config files from the following directories:
/run/modprobe.d
config files generated at runtime, useful e.g. for compatibility
with non-standard config files (such as /etc/rc.conf in Arch)
/etc/modprobe.d
config files manually created by the administrator
/lib/modprobe.d
config files installed by third-party packages
/usr/local/lib/modprobe.d
config files during development of third-party packages
This scheme is the same as the one employed by udev, systemd and possibly
others.
A follow-up patch lets files in one directory override files in others, as
done elsewhere.
Cc: Jon Masters <jcm@jonmasters.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Aaron Griffin <aaron@archlinux.org>
Cc: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Modules mod1, mod2 and mod3 can now be blacklisted by passing
modprobe.blacklist=mod1,mod2,mod3
on the kernel command line.
This is useful in case a module prevents the system from booting.
Cc: Jon Masters <jcm@jonmasters.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Aaron Griffin <aaron@archlinux.org>
Cc: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Signed-off-by: Keegan McAllister <keegan@ksplice.com>
|
|
Support for this feature was removed in 30df3f6e.
Signed-off-by: Keegan McAllister <keegan@ksplice.com>
|
|
depmod -e without -E or -F will print a warning and have no effect.
Signed-off-by: Keegan McAllister <keegan@ksplice.com>
|
|
Needed by depmod.
Signed-off-by: Keegan McAllister <keegan@ksplice.com>
|
|
These environment variables were introduced in f2668710 but were not exported
by tests/runtests. As a result, a lot of tests were silently failing to run.
Signed-off-by: Keegan McAllister <keegan@ksplice.com>
|
|
Constify a bunch of data structures that need not be writable.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
No reason for these guys to be exported, so mark them all static.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Some ports (like the Blackfin architecture) prefix all their symbols with
an underscore. So add a new --symbol-prefix option to support this.
In the past, I've always used depmod.pl from busybox, so the limitation
in m-i-t's depmod wasn't a blocker for me.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The latest version of module-init-tools contains new features such
as "devname" and "softdep" alias support, as well as various bug
fixes and other miscellaneous enhancements. A detailed list of
changes is also available on modules.wiki.kernel.org:
https://modules.wiki.kernel.org/index.php/Module_init_tools_3_12
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
To be able to let udev support kernel module on-demand loading, the next
kernel will export:
alias: devname:<name>
for some well-defined common kernel modules. This will let the kernel call
modprobe when the device node is accessed, the subsystem/driver will be
initialized and the open() of the device node will magically succeed.
The static device node aliases will be carried in the module itself. depmod
extracts this information:
$ cat /lib/modules/2.6.34-00650-g537b60d-dirty/modules.devname
# Device nodes to trigger on-demand module loading.
microcode cpu/microcode c10:184
fuse fuse c10:229
ppp_generic ppp c108:0
tun net/tun c10:200
dm_mod mapper/control c10:235
Udev will pick up the depmod created file on startup and create all the
static device nodes which the kernel modules specify, so that these modules
get automatically loaded when the device node is accessed:
$ /sbin/udevd --debug
...
static_dev_create_from_modules: mknod '/dev/cpu/microcode' c10:184
static_dev_create_from_modules: mknod '/dev/fuse' c10:229
static_dev_create_from_modules: mknod '/dev/ppp' c108:0
static_dev_create_from_modules: mknod '/dev/net/tun' c10:200
static_dev_create_from_modules: mknod '/dev/mapper/control' c10:235
udev_rules_apply_static_dev_perms: chmod '/dev/net/tun' 0666
udev_rules_apply_static_dev_perms: chmod '/dev/fuse' 0666
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Some comments I was working on recently. More coming later.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
|
|
BUGS contains bugs being worked on/status if they are simple enough
for ease of reference - canonical source is bugzilla.kernel.org
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
A few more misc. fixes. Assuming nothing blows up 3.12 will follow
with a couple more fixes shortly after this one.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
wc -w may output " 0" instead of "0". Handle this using an integer
comparison (instead of a string comparison).
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
This allows e.g. removing all alsa modules with
modprobe -r `lsmod|cut -d " " -f1|grep snd`
or even removing all currently unused modules.
modprobe -r `lsmod|cut -d " " -f1|grep -v Module`
|
|
The softdep parser should probably have done the conversion already.
Both callers (do_softdep() and main()) are able to run underscores()
in-place. So this means we don't need to allocate and free a copy.
It also makes the next commit easier.
|
|
[--all would have worked, but that wasn't documented as a feature]
Fix the documentation. Move the code out of the top-level loop.
This also makes the next commit easier.
|
|
If we can't find a module, we don't need to check for a softdep.
The initial softdep design allowed you to define "fake" modules, in the
same way as with install commands. But we decided this had only bad
effects, so the feature was removed.
|
|
This was prompted by the observation that do_softdep() doesn't implement
module renaming.
Searching for "modprobe -o" and "modprobe --name" turns up two possible
uses: creating multiple instances of the "bonding" or "dummy" network
devices. Modern kernels provide cleaner ways to do this. The old
way using "modprobe --name" doesn't work any more.
<https://bugzilla.redhat.com/show_bug.cgi?id=247718>
"Bonding Module fails to recognise the '-o' parameter on load"
Comment #1 should explain how to resolve this issue.
To create an additional bond on rhel5, please do this:
# echo another_name > /sys/class/net/bonding_masters
rather than using modprobe. The kernel's bonding code now uses
sysfs for configuration of multiple bonds
<http://lkml.org/lkml/2007/6/8/381>
"2.6 kernel: Cannot make multiple dummy network interfaces"
[solution was to use the "numdummies" module option]
|
|
1. When a softdep is present, all the flags e.g.
--use-blacklist are being ignored. Fix that.
2. When processing softdeps, mask out the "first_time"
flag. This brings them into line with both install
commands and normal dependencies. (We don't need to
worry about "ignore_commands", because it would
prevent softdeps from being loaded in the first
place). If we're unloading, we should also mask in
the "quiet_inuse" flag.
|
|
I broke this when refactoring the config handling. --show-config
ended up printing the contents of user config files twice. Also
parse_kcmdline() was always called with dump_only=1, regardless of
whether --show-config was requested.
|
|
|
|
|
|
There's a known bug with docbook2man in some cases (Fedora) not
following multiple names for a manpage and only generating a
single output file. We use links in the source to ensure
those other versions will be built if possible. A better
fix will be to figure out how to make docbook2man behave.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The location for my test builds is in a new directory.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The build scripts calling out to docbook2man need to have entries
in the individual man page sources for each of the output files.
Correct the missing entry for the modules.dep.bin file.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The latest pre-release version including all of the hard work on
softdep support from Andreas and some cleanups from Alan and I.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The softdep docs were great but I cleaned them up slightly, and I also
added a warning to the new COMPATIBILITY section I had added recently.
Also, re-order this file so that everything is in alphabetical order.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
In order to merge in the softdep bits from alan, I wound up resetting
the dev tree and remerging the whole lot. Next time, I'll just review
the patches in another tree and then pull the lot, which is better.
These two trivial differences were in my tree and are ok to keep.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
|
|
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The documentation has been sadly lacking. Fortunately, there is a new
wiki and some great plans for content on module design/implementation.
Until that is all done, at least get these docs in better shape.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Since we have squashed all the leaks (or at least the ones that show up
in the test suite), we can now use valgrind to look out for new ones.
One of the reasons for this exercise is the index code, which mixes
recursion with allocating and freeing memory. Memory leaks may not
cause any problems at run-time - but they're still bugs, and bugs
can make code harder to maintain.
|
|
Conflicts:
modprobe.c
|
|
This avoids having do_softdep() leak the memory allocated for config
data.
|
|
The parser now records all the aliases from the config file, deferring
alias resolution to do_modprobe(). This will allow the config data to
be re-used across multiple invocations of do_modprobe().
|
|
- "struct module"
- use of setenv()
- internal node leak in index_search() and index_searchwild()
- some of the more obscure modprobe options, which were bypassing the
cleanup code in main()
I can see only one more leak (which occurred during the softdep work):
- the contents of "struct modprobe_conf"
|
|
At some point several short options versions (-S, -D, -R) were inadvertently
disabled. The first is used to override the kernel version, the second is used
to dump dependency information, and the third dumps resolved alias information.
The documentation was updated in the manpages in the previous commit and is
now in sync with how modprobe is actually implemented.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The man pages have suffered from a little bitrot over time. Fix that by
updating them with references to recent changes, noting some planned
future behavioral changes (modprobe "install" commands), and improve
readability by re-ordering modprobe options to ensure everything is
documented in the current release.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The various files within the tree documenting who did what and when were
rather sadly out of date. I have begun cleaning this up properly.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
It doesn't care whether we are "removing", and it only parses aliases
(not an entire config).
Enhance readability by splitting it into two functions, for binary
and text files respectively. This matches the way read_depends()
is written.
Fix some sites to use read_aliases() instead of parse_config_file().
|
|
insmod makes a half-successful attempt to clean up on failure. Let's
make it clean up on all failures, and remember to clean up on success
as well.
This leaves modprobe as the only leaky program, at least for the code
paths executed by the test suite.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
We don't use posix file locks anymore, so we don't need to play games
with fds, and we don't need to worry about dropping locks when we close
fds. This allows us to simplify the code a bit and remove the
intentional memory leak.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
If we call release_elf_file() when grab_fd() fails, it will call
release_file() with a NULL pointer and undefined length. This can
cause a crash when zlib support is disabled and release_file() is
implemented using munmap().
This is only theoretical at the moment. However it will allow
grab_elf_file_fd() to be removed straightforwardly, without
creating a more significant bug.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Ensure release_elf_file() is called on a rare failure path.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
There's no need to clobber optstring; we can afford to make a copy.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
handle_module() clears mit_ignore_loaded before calling rmmod(). So we
didn't really want to set it in the first place! Also, rmmod() uses the
flag to mean something which differs both from the name itself, and the
way it is used in insmod().
Replace the mit_ignore_loaded in rmmod() with a new flag mit_quiet_inuse
(it means not to complain if the module cannot be removed because it is
in use).
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Hi Jon,
there is a bug in module-init-tools-3.11 that leads to an error when building the man pages. The patch below fixes it.
Signed-off-by: Jon Masters <jcm@modules.bos.jonmasters.org>
|
|
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: Jon Masters <jcm@modules.bos.jonmasters.org>
|
|
This is the initial release that will become 3.12. It has a few cleanups. I
will next work on the softdep patches.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
|
|
We implement support for matching "override" entries in depmod config
files to determine which module of several alternatives will be used.
The existing implementation is a very poor "wildcard" match that does
not use real regular expressions. This version uses the standard POSIX
extended regular expressions, with backward compatibility to match on
a single "*" kernel version as in the original (broken) design.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
On 2009-09-30 16:49, Alan Jenkins <sourcejedi.lkml@googlemail.com> wrote:
> On 9/29/09, Alan Jenkins <sourcejedi.lkml@googlemail.com> wrote:
> >> When calling modprobe -q with a non-existing module, it returns with
> >> exit code 1. According to the manpage, modprobe "normally" will report
> >> an error, and with -q shouldn't, so I believe the exist code should
> >> always be 0, at least that seems to be the assumption in some init
> >> scripts (e.g. binfmt-support).
> >
> > That part is ambiguous, but I guess "modprobe will simply ignore any
> > bogus names" is pretty clear.
> >
>
> > ... and comments in the git log imply we _used_ to get this right.
> >
> > ""
> >
> > Andreas, at first glance this regression is due to your commit
> > 73bdf4ab. Care to submit a patch to revert the relevant lines?
>
> Sorry, I completely misread both the git log comments and Andreas'
> code. This isn't a regression, it's more of a feature request.
>
> The manpage does say modprobe -q "will simply ignore any bogus names",
> implying that modprobe should return success in this case. But
> test-modprobe/19quiet.sh has always required "modprobe -q crap" to
> return failure.
>
> So this is intentional at some level, we've always done it this way in
> the past, and we need to consider the risk of breaking scripts which
> expect the current behaviour.
>
> The binfmt-support initscript seems a bad example to me. It does this
>
> # comments added by me
>
> set -e # abort if any command fails
> ...
> modprobe -q binfmt_misc # this will cause an abort if
> binfmt_misc.ko doesn't exist...
> mount -t binfmt_misc ... # but so will this
>
> It's only a problem if binfmt_misc is built into the kernel. However,
> this will be solved by the modules.builtin work.
>
> So I think we would need a better justification to change this.
Ok, but then the manpage should be fixed. How about the attached
patch?
Philipp
--
Philipp Weis
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The top-level Makefile is generated by mangling rules, "a: b". We
already avoid mangling "a := b". But we should also exclude "a = :".
Apparently this was causing unbalanced parenthesis errors on some
systems.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Bump the release to 3.11.1 since the previous tarballs didn't have the
correct generated documentation files present.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
No major issues reported with the -rc1 so bump to v3.11 final and move on.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
"--" is modified by underscores(). This would have made the
future implementation of softdep in .modinfo more complicated.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Commit 528db92ab1dd0d75dba415b9f3dc81f5a34773ce added an errfn_t
parameter to elfops_core.c:load_strings. This was for the purpose
of detecting missing terminators at the end of ELF-sections with
strings in them, such as .modinfo.
However, the committer (that'd be me) forgot to add any actual code to
load_strings() and now the errfn_t parameter complicates the error
handling when softdep is used.
This commit removes that parameter and adds a non-fatal warning message.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Imlementation notes
-------------------
* find_softdep()/do_softdep() mirrors find_command()/do_command()
precisely. (And if they don't, that's a bug.)
* Failures in the indirect modprobes, ie. those run by the softdep
command, are ignored. This seems correct for removing, but I'm
unsure what the proper action is when installing.
An example - or how it's supposed to work
-----------------------------------------
Configuration:
softdep foo --pre pre1 pre2 --post post1 post2
Installing a module:
$modprobe foo <CMDLINE_OPTS>
yields
modprobe pre1
modprobe pre2
modprobe --ignore-install foo <CMDLINE_OPTS>
modprobe post1
modprobe post2
Likewiese, removing a module:
$modprobe -r foo
yields
modprobe -r post2
modprobe -r post1
modprobe --ignore-remove -r foo
modprobe -r pre2
modprobe -r pre1
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
The function will work on a copy instead.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
A new function, do_softdep(), will be invoked from the same locations
as do_command() as it eventually will replace it. do_softdep() in turn
needs to call do_modprobe().
This commit adds some parameters to do_modprobe, handle_module,
insmod and rmmod, needed to make this possible.
The pathnames for "module.symbols" and "modules.alias" are now
generated wherever they're needed, rather than in main().
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
It is now possible to add or remove conf commands without rewriting
the function declarations of e.g parse_config_*() every time.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Follow up to the previous commit.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Helps readability and will simplify the softdep command parser.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Conflicts:
modprobe.c
|
|
Now we support /proc/modules as a fallback, we can revive the old
02proc.sh to provide testing coverage.
(The setup required alteration to fit with the current test suite,
but the body of the test remains unchanged).
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
install and remove commands for real modules will now refuse to run,
if we don't provide a mockup of /sys/module.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
If we're not sure whether a module is present, we can't be sure that it
is safe to run its remove command.
This patch follows logically from the previous two patches. It provides
the same safeguard which has been added for install commands, in case
/sys/module/<module>/initstate is not available.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
modprobe.d(5) strongly suggests you can use remove commands like this:
remove snd-pcm /sbin/modprobe -r --ignore-remove snd-pcm-oss && \
/sbin/modprobe -r snd-pcm
Unfortunately, given that snd-pcm-oss depends on snd-pcm, this causes
an infinite fork-loop.
The solution is an exact parallel of the approach taken for install
commands. AFAIK no-one uses remove commands, but it's good to make
the insmod() and rmmod() functions consistent.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Apparently /sys/module/<module>/initstate only appeared in 2.6.20,
which is still in use.
Copy the original module_in_kernel() verbatim from the GIT archives,
and use it as a fallback if module_in_sysfs() doesn't work.
The original patch suggestion was shorter, but less obvious, adding
more untested code, and turned out to be harder to test.
References: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524940
Reported-by: Matthew J. Lockner <mlockner@iastate.edu>
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
/sys/module/<module>/initstate only appeared in 2.6.20. If it is not
present, we cannot tell whether the module has finished loading
succesfully. In this case module_in_kernel() should return -1
(undefined).
Take care to to distinguish between "initstate disappeared because the
module was just unloaded" and "initstate is absent but the module is
still present".
"Fork bombing" side effect of this bug is described in [1].
A followup patch will add a fallback to /proc/modules.
1. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524940
Thanks to Modestas Vainius <modestas@vainius.eu> for explaining the
problem.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Custom install commands rely on a working module_in_kernel() to avoid
an infinite fork-loop. This can fail if /sys/module/ is not available
(i.e. before sysfs is mounted). For example:
install snd-pcm /sbin/modprobe --ignore-install snd-pcm && \
{ /sbin/modprobe --quiet snd-pcm-oss ; : ; }
The snd-pcm-oss module depends on snd-pcm. If we can't tell that
snd-pcm is already loaded when we load snd-pcm-oss, we end up
running the entire install command again, ad infinitim.
Thanks go to Modestas Vainius for the idea and original patch.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
An initial round of patches for the 3.11 release, including support for
"builtin" modules (those pre-compiled into the kernel image for which we
have sysfs entries and perform module initcalls just like loadable ones).
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The kernel installs a modules.builtin file listing all builtin
modules. Let depmod generate a modules.builtin.bin file and use
this in modprobe: If a module is not found in modules.dep or
modules.alias, check if the module is builtin and either do nothing,
or print "builtin <module>" if --show-depends was given. Trying to
remove a builtin module returns an error, as does inserting a builtin
module with --first-time.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
If a function returns zero, the file won't be generated
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The --resolve-alias option prints all module names that match the
alias given on the commandline and exits. If no valid alias is specified,
it does nothing.
|
|
This warns about the modinfo segfault which Ozan found. It doesn't
find any other problems, which is good to know. It may also help
avoid future errors.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
modinfo segfaults when called with a module which is just deleted from
the filesystem without re-running depmod.
Pass filename instead of the address of it to the error() function to
fix the problem.
Tested-by: Ozan Çağlayan <ozan@pardus.org.tr>
Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
|
|
|
|
Rebuild all module data files using hornet (ppc64) and tonnant (x86_64).
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
testsuite: stop testing the old style EXPORT_SYMBOL macro
The "new style" macro has been in use long enough (since 2.5.59 or so),
so stop testing the old one. The next patch will remove support for the
old macro.
The modules were rebuilt on a x86 and ppc machine, using gcc 4.3.2.
Signed-off-by: Michal Marek <mmarek@suse.cz>
|
|
I haven't found a Makefile or script in the tree to do this, so I wrote
one.
jcm: Indeed, there was no such Makefile - these are rebuilt infrequently
and I last time just did it by hand, but a Makefile is cleaner.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
To make it easier to test changes to the testsuite without a
cross-compiler, add environment variables TEST_ENDIAN and TEST_BITS
controlling which environment / bitness will be tested. All test run in
all four modes.
jcm: removed bad options handling test since it's no longer in testsuite.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Michal Marek pointed out that (following his previous .gitignore patch) that
we were also not ignoring the output from building the new libmodtools.a.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Add a new option -E Module.symvers to read symbol versions from a
Module.symvers files and modules and warn about mismatches if -e is
given.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The pathname is already in the elf_file struct.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
__ksymtab_strings_gpl must have been a mistake, there has never been such
section. __ksymtab_strings is present since 2.5.59, so get rid of the
compatibility code.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
We created a link previously from depmod.conf to depmod.d (and it has to be
done the way it is for now due to the XML utilities not handling the actual
multiple file names we specify right in the source), so let's do the same
for depmod.d documentation.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
|
|
into modprobe_main
|
|
Changes suggested by Alan:
* Rename ignore_inuse => ignore_loaded
* Put the flags parameter last in handle_module/insmod/rmmod/do_modprobe
function declarations.
(The errfn was moved too, to just before the flags.)
* Don't change more than one flag per statement,
i.e flags |= (foo | bar); => flags |= foo; flags |= bar;
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
depmod no longer handles unknown or malformed options itself. The error
message is now generated by getopt, so we don't need to test for it.
It turns out that different versions of getopt can generate slightly
different error messages, so the test will do more harm than good.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Also simplify how handle_module()'s return code is handled in main():
Before: if (handle_module()) failed = 1;
After: failed |= handle_module();
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
This reverts commit 5a402b77821e76f318beffff3f544ad3c7250c21
dated 5 Sep 2007.
The call to delete_module() is unaffected by the -w option and
delete_module() (in 2.6.29) itself can not be made to block
the way that is intended.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
ignore_proc => ignore_inuse
optstring => cmdline_opts
config => configname
dump_only => dump_config
modulearg => modname
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Did a glibc version change or something cause this?
|
|
Move do_command, insmod and rmmod closer to handle_module.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Backcompat is removed, so we can exit immediately if we don't recognise
an option.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
This makes it consistent with --all.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Fix this:
strace -e trace=file build/modprobe --dirname / --set-version 2.6.99 foo
...
open("///lib/modules/2.6.30-rc7/modules.alias", O_RDONLY) = 5
FATAL: Module foo not found.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Fix this:
$ depmod --warn
depmod: malformed/unrecognized option '--warn'
...
$ depmod --warn dummy-arg
$
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
modprobe -D (short version of --show-deps) doesn't work, remove it from
the manpage. Don't try to pass "-D" to commands either ("--show-deps"
sets dry_run, so we won't run any commands).
modprobe -Q is not valid, remove 'Q' from the getopt string.
In depmod, "r" was listed twice in the getopt string.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
options are listed in three places:
1. getopt (long) option array
2. getopt (short) option string
3. the switch statement which handles the options
It's easier to check these lists for inconsistencies if all three lists
are in the same order.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
|
Rebuild all the test modules to make sure there's no bitrot. We haven't done
this for big endian in a while, but I now have configured my home ppc64 box.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
The previous hack for modprobe.d.5 happens because 'docbook2man' as shipped
in at least one major distribution does not support '--solinks' to create
automatic links for each of the refentrytitle entries. It will actually only
make links for the last one. This is the other piece - for now, link sources.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
We killed elf_core.c. Don't use it any more e.g. during "make dist".
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
|
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Some people expect to be able to do `man modprobe.d` and see the relevant
content. Not surprising considering modprobe.conf(5) already documents
that.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
|
|
getopt_long returns an int and not a char. The existing code will fail a return
test on ppc64 where the -1 comparison will never succeed, so instead garbage
will exist in 'opt' at the end of the main while loop.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Also remove fake placeholder modules in the test suite
e.g "echo Test > foo.ko && modprobe foo".
They don't work anymore.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Changes to load_strings():
* export in struct module_ops
* avoid buffer overruns by looking for a string terminator
at the end of a section.
* new errfn_t parameter selects error message type.
If load_strings fails on a missing string terminator, the module
is probably broken.
Therefore, modprobe and depmod sets errfn_t error = fatal.
Modinfo on the other hand sets errfn_t error = error.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
get_section() returned an undefined section size on failure,
which could cause load_symbols() to crash if kernel symtables
were missing from the module.
get_section() will now return secsize == 0 if it fails.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
- add missing NOFAIL to strtbl_add() in load_dep_syms()
- export strtbl_free()
- free string tables with strtbl_free()
- documentation fix
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Correct a problem with tabulation so the rc doesn't look like it's part
of the "if" statement above it.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
==12690== Conditional jump or move depends on uninitialised value(s)
==12690== at 0x804A095: output_deps_bin (depmod.c:473)
==12690== by 0x804CD85: main (depmod.c:1364)
==12690== Uninitialised value was created by a stack allocation
==12690== at 0x80517D3: add_value (index.c:86)
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
"valgrindme.sh" has been hanging around for a while without doing
anything. The original idea seems to have been to run under valgrind
automatically. But it is very slow, which discourages one from running
the testsuite. Implement it as an option instead.
In particular, this was useful while writing the binary index code.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
|
|
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
strip_section() now finds the section flags with get_section()
and handles files of opposite endianness.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Returning the section header allows invalidate/strip_section() to
use get_section(). get_module() is more robust than strip_section()'s
own section lookup.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
load_section() has replaced get_section() outside elfops.
The new parameter names match the fields in struct elf_file.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
The affected functions are
replace_modname()
rename_module()
invalidate_section()
strip_section()
clear_magic()
dump_modversions()
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
In the old implementation, the loader didn't care about whether
a file is an ELF-file or not, and let init_module() sort it out.
In the new implementation, the loading fails with errno = ENOEXEC
if the file isn't an ELF-file.
However, the new logic does not pass the testing, specifically
test-modprobe/10alias.sh. To work around this, the commit adds a
hack that replicates the old way, when grab_elf_file_fd() does
return errno = ENOEXEC.
Obviously, this needs to be fixed. To replicate the problem,
simply remove the hack.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Also, load module info with ops->get_modinfo() instead of get_section()
This hides struct elf_file fields.
load_strings() was originally planned to replace get_section(),
but the code ended up less clear, so that idea is put on hold.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Also fix slightly broken nofail_asprintf()
Side effects:
Errors are printed with the "ERROR:" prefix.
Testing for oom, quiets asprintf return-value warning.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Reorganize pathname building and use asprintf and strndup instead
of malloc, sprintf and memcpy.
Module file names are now truncated *after* copying.
It wastes a few bytes, but makes the code much easier to read.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
This introduces constructor and destructor for struct elf_file,
following the grab/release naming pattern used elsewhere. Care is
taken to ensure the constructor returns a valid errno on failure.
The first user is grab_module() in depmod.c
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
get_section() and load_section() now return NULL if a section header
is corrupt and points to a block that lies partially or entirely
outside the file data buffer.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
load_strings() was planned to replace get_section() + next_string()
e.g in modinfo. However it turns out there are no advantages in style
and few in function. As it won't be used outside elfops, the export
is removed.
load_section() OTOH, will replace get_section() so we export it now.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
This seems to be the current "standard" (which is probably
not the best word to use and will cause whining), so here's
a patch. Feel free to ignore this one :-)
|
|
FAQ
- removed references to modprobe.conf, as it should not be
needed in that context
- used /etc/modprobe.d/sound.conf for the alsa example (perhaps
this can go away completely now; I think alsa handles this
automatically if needed)
- trivial typo fix
Makefile.am
- removed references to modprobe.devfs (obsolete)
NEWS
- noted release of 3.7 and 3.8, but Jon will need to clarify
their status with respect to maintenance and such
- noted the deprecation of generate-modprobe.conf and the
fact that it is no longer installed by default
README
- clarified note about backwards compatibility (requires a
2.6.x kernel, and no support at all for older modutils)
- updated instructions to remove note about generate-modprobe.conf
modprobe.defvs
- removed completely from the repo; this is obsolete now
|
|
depmod.conf.sgml:
-trivial cleanups
-removed the deprecated "include" mentions
depmod.sgml
-trivial cleanups
-removed the backward-compatibility mentions (will add a global
note to the toplevel README in another commit)
insmod.sgml
-trivial cleanups
-removed the backward-compatibility mentions
lsmod.sgml
-removed the backward-compatibility mentions
modinfo.sgml
-removed the backward-compatibility mentions
-I left the old -{a,d,l,p,n} options untouched, even though they
are documented as being for old modutils compatibility
modprobe.conf.sgml
-trivial cleanups
-noted preference for /etc/modprobe.d/ over /etc/modprobe.conf
(as modprobe.conf is deprecated and will be removed)
-removed the deprecated "include" mentions
-removed the backward-compatibility mentions
modprobe.sgml
-trivial cleanups
-clarified the -C and -c options; perhaps they should go away later
-removed the backward-compatibility mentions
modules.dep.sgml
-trivial cleanups
-bring kernel version used in examples more up to date
rmmod.sgml
-trivial cleanups
-removed the backward-compatibility mentions
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Inline string literals might not have static lifetimes (C99 6.4.5).
This corrects the assumption that they do, that was introduced
in e35f9df6c1aa02a2f7aa0e319af4d0e70181a9ca
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Specifically
depmod.h => elfops.h: struct module_tables and struct elf_file
elfops.c => elfops_core.c: X-macros (eg PERBIT)
elf_core.c => elfops_core.c: get_section()
util.[ch] => elfops.[ch]: elf_ident() and get_section()
Additionally, elf_core.c is deleted, being replaced by elfops_core.c
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
Remove the last remnants of struct module from moduleops*.[ch]
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
load_section():
* Pass struct module rather than module->data and module->conv.
load_dep_syms() and fetch_tables()
* Assign local variable conv = module->conv when used in many places.
fetch_tables():
* Treat handle_register_symbols like the boolean it is.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
This is part of the work separating depmod and moduleops.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
load_string() treats the data in an ELF-file section as a collection
of strings and builds a string table from those. It can be used to
read .modinfo, __ksymtab_strings and similar sections.
load_symbols() is updated to take advantage of the new function.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
The new load_dep_syms() operation in moduleops returns a string table of
symbols on which a module depends. calculate_deps() is moved to depmod.
Remaining depmod callbacks in moduleops are removed.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
load_symbols() in moduleops no longer has to call add_symbol()
in depmod. Data is now returned in a string table.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
load_symbols() and calculate_deps() in moduleops call functions in
depmod as a way of passing multiple symbols back to depmod.
This adds a string table to replace those callbacks.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
|
|
We need this additional inclusion for "make dist" to work correctly.
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Instead of aborting the build, print a warning if neither
docbook2man nor docbook-to-man is found.
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|
|
Add new configure option --enable-zlib-dynamic to allow linking zlib
dynamically (e.g. opensuse installs libz.so.1 in /lib, so it's safe to
do it there).
Signed-off-by: Jon Masters <jcm@jonmasters.org>
|