Commit Graph

102 Commits

Author SHA1 Message Date
Harald Hoyer 3f85ef0f05 s/commandline/command line/g 2014-11-06 15:34:18 +01:00
David Herrmann cfe2061add udev: avoid magic constants in kernel-cmdline parsers
Lets recognize the fact that startswith() returns a pointer to the tail on
success. Use it instead of hard-coding string-lengths as magic constants.
2014-11-05 12:58:10 +01:00
Richard W.M. Jones f671774f52 udev: Fix parsing of udev.event-timeout kernel parameter. 2014-11-05 12:58:10 +01:00
WaLyong Cho cc56fafeeb mac: rename apis with mac_{selinux/smack}_ prefix 2014-10-23 17:13:15 +02:00
Tom Gundersen 25773e7fc5 udevd: don't fail if /run/udev exists 2014-09-18 21:57:49 +02:00
Tom Gundersen 65fea570f0 udev: fix typos
Spotted by Andreas Henriksson.
2014-09-18 20:25:33 +02:00
Tom Gundersen d457ff8319 udevd: check return of various functions
One reported by Coverity. Fixes CID #996252.
2014-09-18 19:10:23 +02:00
Tom Gundersen 6f5cf8a8b1 udevd: parse_argv - warn if argumens are invalid
Found by Coverity. Fixes CID #1238780.
2014-09-18 19:02:42 +02:00
Tom Gundersen f1e8664e4a udevd: use safe_ato*() in place of strto*() 2014-09-16 12:12:56 +02:00
Tom Gundersen 4d6dac13ad udev: apply permissions to static nodes before signallying READY
Processes expecting static nodes to have the right permissions may order themselves after systemd-udevd.service,
make sure that actually guarantees what is expected.
2014-09-16 12:12:56 +02:00
Tom Gundersen ebc164ef40 udev: only print after final log level has been determined
This delays label_init(), and drops the (duplicate) printing of version
information.
2014-09-16 12:12:56 +02:00
Tom Gundersen 3f56f784b9 udevd: initialize epoll_event structs on allocation
Also move the rest of event initialization next to the event loop (no functional change).
2014-09-16 12:12:56 +02:00
Tom Gundersen 5c67cf2774 udev: don't close std{in,out,err}
Rather than printing debug output to stderr and redirecting this to /dev/null when not wanted,
use the correct log_*() function in the first place.
2014-09-16 12:12:56 +02:00
Tom Gundersen 959d654105 udev: drop duplicate logging
Once upon a time logging during early boot was unreliable, so extra logging messages were
sent by udev to stderr. That is no longer a concern, so drop all fprintf() calls from udved.
2014-09-16 12:12:56 +02:00
Tom Gundersen bba7a48439 udev: split out parse_argv()
Also rename some global variables to arg_* to make it clearer where they come from.
2014-09-16 12:12:55 +02:00
Tom Gundersen ed216e1ff0 udev: split out help and modernise a bit 2014-09-16 12:12:55 +02:00
Tom Gundersen 6711741365 udev: timeout - warn after a third of the timeout before killing 2014-09-11 23:45:01 +02:00
Tom Gundersen b5338a1986 udev: timeout - increase timeout
Some kernel modules still take more than one minute to insmod, we no longer rely on the timeout
killing insmod within a given period of time, so just bump this to a much higher value. Its only
purpose is to make sure that nothing stays aronud forever.
2014-09-10 18:10:06 +02:00
Tom Gundersen 9d19a679f2 udev - drop print_kmsg
The only remaining user was 'starting version XXX', which is now logged using log_info().
2014-09-09 22:48:57 +02:00
Tom Gundersen 4c83d99456 udev: event - keep one rtnl per worker, rather than per event
Creating the rtnl context is cheap, but freeing it may not be, due to
synchronous close().

Also drop some excessive logging. We now log about the changing ifname
exactly once.
2014-09-09 15:30:10 +02:00
Kay Sievers 2e92633dba udev: bump event timeout to 60 seconds 2014-08-30 11:36:32 +02:00
Kay Sievers be2ea723b1 udev: remove userspace firmware loading support 2014-08-30 11:34:20 +02:00
Zbigniew Jędrzejewski-Szmek a2a5291b3f Reject invalid quoted strings
String which ended in an unfinished quote were accepted, potentially
with bad memory accesses.

Reject anything which ends in a unfished quote, or contains
non-whitespace characters right after the closing quote.

_FOREACH_WORD now returns the invalid character in *state. But this return
value is not checked anywhere yet.

Also, make 'word' and 'state' variables const pointers, and rename 'w'
to 'word' in various places. Things are easier to read if the same name
is used consistently.

mbiebl_> am I correct that something like this doesn't work
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"'
mbiebl_> systemd seems to strip of the quotes
mbiebl_> systemctl status shows
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS  $RootDir $MountPoint
mbiebl_> which is pretty weird
2014-07-31 04:00:31 -04:00
Kay Sievers 9ec6e95b04 udev: place opening { at the same line as the function declaration 2014-07-29 15:49:25 +02:00
Kay Sievers dd5eddd28a udev: unify event timeout handling 2014-07-29 15:18:27 +02:00
Hannes Reinecke 9719859c07 udevd: add --event-timeout commandline option
Some events take longer than the default 30 seconds. Killing those
events will leave the machine halfway configured.

Add a commandline option '--event-timeout' to handle these cases.
2014-07-29 13:45:07 +02:00
Kay Sievers 2e5b17d013 udev: exclude MD from block device ownership event locking
MD instantiates devices at open(). This is incomptible with the
locking logic, as the "change" event emitted when stopping a
device will bring it back.
2014-07-24 23:37:35 +02:00
Thomas Hindoe Paaboel Andersen 47a3fa0f76 udev: check the return value from udev_enumerate_scan_devices
The return value from udev_enumerate_scan_devices was stored but
never used. I assume this was meant to be checked.
2014-06-10 19:06:50 +02:00
Christian Hesse 638ca89c53 udev: really exclude device-mapper from block device ownership event locking
Arguments were wrong order, no?
This fixes commits:

e918a1b5a9
3d06f41834
2014-06-10 16:08:25 +02:00
Kay Sievers 02ba8fb335 udev: guard REREADPT by exclusive lock instead of O_EXCL 2014-06-04 16:28:03 +02:00
Kay Sievers e9fc29f4ec udev: make sure we always get "change" for the disk
The kernel will return 0 for REREADPT when no partition table
is found, we have to send out "change" ourselves.
2014-06-04 15:17:15 +02:00
Kay Sievers 10fab50a30 udev: guard REREADP logic with open(O_ECXL) 2014-06-04 14:09:31 +02:00
Kay Sievers ede344452a udev: try first re-reading the partition table
mounted partitions:
  # dd if=/dev/zero of=/dev/sda bs=1 count=1
  UDEV  [4157.369250] change   .../0:0:0:0/block/sda (block)
  UDEV  [4157.375059] change   .../0:0:0:0/block/sda/sda1 (block)
  UDEV  [4157.397088] change   .../0:0:0:0/block/sda/sda2 (block)
  UDEV  [4157.404842] change   .../0:0:0:0/block/sda/sda4 (block)

unmounted partitions:
  # dd if=/dev/zero of=/dev/sdb bs=1 count=1
  UDEV  [4163.450217] remove   .../target6:0:0/6:0:0:0/block/sdb/sdb1 (block)
  UDEV  [4163.593167] change   .../target6:0:0/6:0:0:0/block/sdb (block)
  UDEV  [4163.713982] add      .../target6:0:0/6:0:0:0/block/sdb/sdb1 (block)
2014-06-04 13:35:02 +02:00
Kay Sievers f3a740a5da udev: synthesize "change' events for partitions when tools change the disk
This should make sure that fdisk-like programs will automatically
cause an update of all partitions, just like mkfs-like programs cause
an update of the partition.
2014-06-04 12:21:44 +02:00
Kay Sievers edd32000c8 udevd: inotify - modernizations 2014-06-04 11:16:30 +02:00
Kay Sievers e918a1b5a9 udev: exclude device-mapper from block device ownership event locking 2014-06-03 16:49:38 +02:00
Kay Sievers 3d06f41834 udev: always close lock file descriptor
https://bugs.freedesktop.org/show_bug.cgi?id=79576
2014-06-03 11:06:43 +02:00
Thomas Hindoe Paaboel Andersen bf9bead187 udev: avoid use of uninitialized err
After 1ea972174b err is no longer
set unless we hit a special case. Initialize it to 0 and remove
a check that will never fail.
2014-05-17 08:41:48 +02:00
Kay Sievers 1ea972174b udev: do not skip the execution of RUN when renaming a network device fails 2014-05-15 10:32:26 +02:00
Kay Sievers 3ebdb81ef0 udev: serialize/synchronize block device event handling with file locks 2014-04-13 19:54:27 -07:00
Kay Sievers 9ea28c55a2 udev: remove seqnum API and all assumptions about seqnums
The way the kernel namespaces have been implemented breaks assumptions
udev made regarding uevent sequence numbers. Creating devices in a
namespace "steals" uevents and its sequence numbers from the host. It
confuses the "udevadmin settle" logic, which might block until util a
timeout is reached, even when no uevent is pending.

Remove any assumptions about sequence numbers and deprecate libudev's
API exposing these numbers; none of that can reliably be used anymore
when namespaces are involved.
2014-04-13 17:12:14 -07:00
Lennart Poettering c8a202b7d4 everywhere: always use O_CLOEXEC where it makes sense 2014-02-13 14:59:56 +01:00
Lennart Poettering 955d98c9c1 everywhere: make use of new0() and macro() macros, and stop using perror() 2014-02-13 14:45:51 +01:00
Greg KH 29804cc1e0 use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set).  So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
2014-01-31 11:55:01 +01:00
Kay Sievers ed14edc04f udev: LOG_PRIORITY -> LOG_LEVEL 2013-12-29 18:05:25 +01:00
Lennart Poettering 9f6445e34a log: log_error() and friends add a newline after each line anyway, so avoid including it in the log strings 2013-12-24 16:39:37 +01:00
Kay Sievers e3dc56a219 udev: declare some symbols static 2013-11-12 18:09:08 +01:00
Lennart Poettering 74df0fca09 util: unify reading of /proc/cmdline
Instead of individually checking for containers in each user do this
once in a new call proc_cmdline() that read the file only if we are not
in a container.
2013-11-06 03:15:16 +01:00
Zbigniew Jędrzejewski-Szmek 97fec53e5e udev: use initialization instead of zeroing in one place 2013-10-13 17:56:55 -04:00
Colin Walters 73814ca287 Revert "udevd: simplify sigterm check"
This reverts commit 47e737dc13 - it
introduced a use-after-free.  The only way the code would get simpler
is with a cleanup function, but eh, not worth it for just this one
bit.

Reviewed by kay on IRC.
2013-08-22 17:07:02 -04:00