summaryrefslogtreecommitdiffstats
path: root/src/udev (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* | udevadm: allow to override the default log level by environment variableYu Watanabe2024-01-062-0/+2
|/ | | | | | | Previously, there was no way to override the log level for test and test-builtin commands. Let's re-parse environment after setting the log level to debug. Then, we can control the log level through environment variable.
* udev: add upper bound of 5 hours to SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC=Luca Boccassi2024-01-041-1/+7
| | | | | | Follow-up for b16c6076cb334c9da9602d4bafbf60381d6d630e CID#1533111
* Merge pull request #30532 from yuwata/udev-extend-timeout-kill-workerYu Watanabe2024-01-032-25/+60
|\ | | | | udev: extend timeout to prevent kill worker
| * udev: wait for an extra time before the manager kills workersYu Watanabe2024-01-021-1/+27
| | | | | | | | | | | | | | | | | | | | Otherwise, udev workers cannot detect slow programs invoked by IMPORT{program}=, PROGRAM=, or RUN=, and whole worker process may be killed. Fixes #30436. Co-authored-by: sushmbha <sushmita.bhattacharya@oracle.com>
| * udev-spawn: skip executing RUN= if exec_delay= is too longYu Watanabe2024-01-021-0/+11
| | | | | | | | To prevent the worker process killed by the manager.
| * udev-spawn: refuse to spawn commands if the event already takes too longYu Watanabe2024-01-021-24/+22
| | | | | | | | | | | | | | | | | | | | Also, calculate the timeout for warning based on the remaining time for the timeout of the event, rather than the timeout itself. Currently, udev manager kills the worker if the timeout exceeds. So, this does not change anything except for the timing of the warning. Just refactoring and preparation for later commits.
* | udev/dmi-memory-id: update table with latest SMBIOS specificationYu Watanabe2024-01-031-4/+7
|/ | | | Closes #30699.
* Merge pull request #30591 from yuwata/device-utilLuca Boccassi2024-01-017-92/+48
|\ | | | | device-util: introduce device_in_subsystem() and device_is_devtype() helper functions
| * tree-wide: use device_in_subsystem() and device_is_devtype()Yu Watanabe2023-12-227-92/+48
| |
* | Merge pull request #30614 from yuwata/udev-event-take-workerLuca Boccassi2024-01-0114-130/+78
|\ \ | | | | | | udev: make UdevEvent take UdevWorker object
| * | udev: make UdevEvent take reference to UdevWorkerYu Watanabe2023-12-2413-112/+72
| | | | | | | | | | | | | | | | | | Many functions take timeout_usec and friends, but those are equivalent to the Worker elements. No functional change, just refactoring.
| * | udev: call udev_watch_end() before udev_event_execute_rules()Yu Watanabe2023-12-246-21/+9
| | | | | | | | | | | | No functional change, just refactoring.
* | | udevadm: Propagate return code from verb resultJoakim Nohlgård2023-12-292-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | udevadm lock did not propagate the return code from the child process because all positive values were treated as success. v2: Now 'udevadm test-builtin' ignores all positive return values from the builtin commands. Otherwise, as the hwdb builtin returns an positive value when a matching entry found, 'udevadm test-builtin hwdb' will fail. v3: Initialize partition table before calling 'sfdisk --delete'. Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
* | | Merge pull request #30633 from mrc0mmand/cocci-shenanigansYu Watanabe2023-12-251-1/+1
|\ \ \ | | | | | | | | coccinelle: rework how we run the Coccinelle transformations
| * | | tree-wide: use strndupa_safe() in a couple more casesFrantisek Sumsal2023-12-251-1/+1
| |/ /
* / / tree-wide: insert space after for and switchYu Watanabe2023-12-241-1/+1
|/ /
* | Merge pull request #30594 from yuwata/udev-timeout-cleanupsLuca Boccassi2023-12-246-12/+35
|\ \ | | | | | | udev: several cleanups for timeout settings
| * | udev-spawn: slightly adjust logs about timed out commandsYu Watanabe2023-12-221-4/+3
| | | | | | | | | | | | | | | - Add full stop to the messages. - Do not kill commands before logging "killing", but do after.
| * | udev: refuse too short timeout valueYu Watanabe2023-12-224-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | Setting zero or too short timeout for each uevent is meaningless, and causes the system fails to boot. Let's refuse such values. Also, delaying execution of RUN= commands too long also makes many uevents enter the failed state. So, let's refuse such misconfiguration.
| * | udev: handle event_timeout=infinity correctlyYu Watanabe2023-12-221-0/+3
| | | | | | | | | | | | | | | This is a paranoia, as even USEC_INFINITY / 3 is finite, it is still so large in general.
| * | udev-manager: use ASSERT_PTR()Yu Watanabe2023-12-221-7/+2
| |/
* / udev: use SD_EVENT_SIGNAL_PROCMASKYu Watanabe2023-12-232-9/+8
|/
* test: Skip various tests when /sys is not mountedDaan De Meyer2023-12-192-1/+13
| | | | | When running tests in a container, /sys might not be mounted, so let's make sure we skip tests that depend on /sys in this case.
* udev: allow/denylist for reading sysfs attributes when composing a NIC nameLukas Nykryn2023-12-191-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | Users can currently pick specific versions of NIC naming, but that does not guarantee that NIC names won't change after the kernel adds a new sysfs attribute. This patch allows for an allow/deny list of sysfs attributes that could be used when composing the name. These lists can be supplied as an hwdb entry in the form of /etc/udev/hwdb.d/50-net-naming-allowlist.hwdb net:naming:drvirtio_net ID_NET_NAME_ALLOW=0 ID_NET_NAME_ALLOW_ACPI_INDEX=1 ID_NET_NAME_ALLOW_ADDR_ASSIGN_TYPE=1 ID_NET_NAME_ALLOW_ADDRESS=1 ID_NET_NAME_ALLOW_ARI_ENABLED=1 ID_NET_NAME_ALLOW_DEV_PORT=1 ID_NET_NAME_ALLOW_FUNCTION_ID=1 ID_NET_NAME_ALLOW_IFLINK=1 ID_NET_NAME_ALLOW_INDEX=1 ID_NET_NAME_ALLOW_LABEL=1 ID_NET_NAME_ALLOW_PHYS_PORT_NAME=1 ID_NET_NAME_ALLOW_TYPE=1
* Add $SYSTEMD_HWDB_UPDATE_BYPASS (#30463)Daan De Meyer2023-12-141-1/+1
| | | | | | Same as $KERNEL_INSTALL_BYPASS, but for hwdb. This will speed up cross architecture image builds in mkosi as I can disable package managers from running the costly hwdb update stuff in qemu user mode and run it myself with a native systemd-hwdb with --root=.
* udevadm: exiting udevadm monitor normally under SIGTERM or SIGINThuyubiao2023-11-251-1/+1
| | | | Under SIGTERM or SIGINT, exit event and release resources, and exit udevadm monitor normally.
* fuzz: always call fuzz_setup_logging()Yu Watanabe2023-11-171-0/+2
|
* test: always call test_setup_logging()Yu Watanabe2023-11-171-0/+3
|
* udev-manager: fix log messageDavid Tardon2023-11-161-1/+1
|
* udev: allow global properties in assignmentsDavid Tardon2023-11-134-24/+27
| | | | | | | Before, handling of global properties (set on systemd-udevd by `udevadm control -p FOO=foo`) was inconsistent. They were honored in ENV matches, but not in any assignment. This meant that any use of $env{FOO} (where FOO was a global property) expanded to an empty string.
* udev-rules: use udev_get_property_value()David Tardon2023-11-131-3/+2
|
* udev-util: add generic device_get_{vendor,model}_string() helpersLennart Poettering2023-11-131-8/+5
| | | | | We chck the same props in various places, add a single implementation of a call to inquire this.
* udev-manager: mark old_key as unused tooDavid Tardon2023-11-081-2/+2
|
* udev-manager: actually remove the propertyDavid Tardon2023-11-081-8/+2
| | | | | | | | AFAICT there's no reason to keep removed entries in the Hashmap (although it doesn't break anything either). The only use of this hashmap is in udev_rule_apply_token_to_event(), which just retrieves the value using hashmap_get(), hence there's no difference there between an existing entry with a NULL value and a missing entry.
* udev: ressize -> result_sizeLuca Boccassi2023-11-061-3/+3
| | | | Lintian flags it as a typo of 'resize', so rename it and make it clearer too
* sd-device-monitor: unconditionally increase buffer size by ↵Yu Watanabe2023-11-064-15/+0
| | | | | | | | sd_device_monitor_new() As suggested at https://github.com/systemd/systemd/pull/29872#discussion_r1382932633: > socket memory is these days accounted to the process that owns a socket, > hence we shouldn't be too concerned that this might waste memory.
* udevadm-trigger: extend receive buffer sizeYu Watanabe2023-11-061-0/+2
| | | | | | | We may trigger huge number of devices and will receive many events. Let's extend the buffer size, otherwise the buffer may be filled. Fixes #29863.
* udevadm: actually set the log levelFrantisek Sumsal2023-11-041-1/+1
| | | | Follow-up to e4080a6d97.
* udevadm: make sure we don't reset max children on each invocationFrantisek Sumsal2023-11-041-1/+1
| | | | Follow-up to e4080a6d97.
* udev-ctrl: drop the unused maybe_disconnected stuffDavid Tardon2023-11-031-12/+3
|
* udevadm-control: return early if --exit is usedDavid Tardon2023-11-031-25/+10
| | | | | | All the following commands would just fail with -ENOANO anyway, hence there's no point in sending them. And it allows us to shave off some error handling code.
* udevadm-control: parse all args in advanceDavid Tardon2023-11-031-61/+130
| | | | | | | | | | | | | This is mostly just refactoring to make the code more manageable and extendable. It doesn't introduce any semantic changes, but it "optimizes" the communication with udevd a bit: * If an option is used multiple times, only one command will be sent. If the option takes a value, the value of the final appearance of the option is used. The only exception is --property, which is additive by nature. * Options --start-exec-queue and --stop-exec-queue are handled together. Only one of START_QUEUE/STOP_QUEUE commands will be sent to udevd even if both options appear on the command line.
* udevadm-lock: switch things over to lock_generic_with_timeout()Lennart Poettering2023-11-021-72/+13
| | | | | | | | | | | This replaces the local implementation of a timeout file lock with our new generic one. Note that a comment in the old code claimed we couldn't use alarm()-like timeouts, but htat's not entirely true: we can if we use SIGKILL, and thus know for sure that the process will be dead in case the timer is hit before we actually enter the file lock syscall. But we also know it will be delivered if we hit after.
* process-util: add new FORK_DEATHSIG_SIGKILL flag, rename FORK_DEATHSIG → ↵Lennart Poettering2023-11-023-4/+4
| | | | | | | | | | | | | | | | | | FORK_DEATHSIG_SIGTERM Sometimes it makes sense to hard kill a client if we die. Let's hence add a third FORK_DEATHSIG flag for this purpose: FORK_DEATHSIG_SIGKILL. To make things less confusing this also renames FORK_DEATHSIG to FORK_DEATHSIG_SIGTERM to make clear it sends SIGTERM. We already had FORK_DEATHSIG_SIGINT, hence this makes things nicely symmetric. A bunch of users are switched over for FORK_DEATHSIG_SIGKILL where we know it's safe to abort things abruptly. This should make some kernel cases more robust, since we cannot get confused by signal masks or such. While we are at it, also fix a bunch of bugs where we didn't take FORK_DEATHSIG_SIGINT into account in safe_fork()
* sort-util: make bsearch_safe() actually typesafe, by returning the right typeLennart Poettering2023-11-011-1/+1
|
* udev: add new builtin net_driverLukas Nykryn2023-11-017-7/+50
| | | | | | | | | | Currently the ID_NET_DRIVER is set in net_setup_link builtin. But this is called pretty late in the udev processing chain. Right now in some custom rules it was workarounded by calling ethtool binary directly, which is ugly. So let's split this code to a separate builtin.
* udev: update devlink with the newer device node even when priority is equivalentYu Watanabe2023-11-011-5/+5
| | | | | | | | | | | | | | | Several udev rules depends on the previous behavior, i.e. that udev replaces the devlink with the newer device node when the priority is equivalent. Let's relax the optimization done by 331aa7aa15ee5dd12b369b276f575d521435eb52. Follow-up for 331aa7aa15ee5dd12b369b276f575d521435eb52. Note, the offending commit drops O(N) of file reads per uevent, and this commit does not change the computational order. So, hopefully the performance impact of this change is small enough. Fixes #28141.
* udev: fix device name shown in the log message on failureYu Watanabe2023-10-311-4/+9
| | | | Prompted by #29500.
* udevadm-trigger: mention --type=all in helpYu Watanabe2023-10-311-0/+1
| | | | | | Follow-up for 1baeee5784f1b859d2a1446f6776efe6d7fde7b6. Fixes #29779.
* udev: fix typo for persistent flagjanana2023-10-271-1/+1
| | | The 'parsistent' adjective is misspelt.