summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* udev-builtin-input_id: use heuristics to detect joysticksPeter Hutterer2022-04-121-11/+44
| | | | | | | | | | | | | | | | | | | | | Several keyboard devices are erroneously tagged with ID_INPUT_JOYSTICK because of random buttons they set. For example, the LiteOn Lenovo Calliope USB Keyboard sets BTN_TRIGGER, BTN_TOP2, BTN_PINKIE and BTN_BASE, see libinput issue 745 for details. ID_INPUT_JOYSTICK triggers the uaccess rules, making those keyboards easily accessible. That's not a problem in the LiteOn example since that event node doesn't contain the normal keys and eavesdropping on volume keys is probably not very interesting. Improve the joystick detection by adding heuristics similar to what libinput 1.20 uses: check for some specific set of keys that are common on keyboards but very unlikely on joysticks. If enough of those are present (or the device has less than 2 axes or joysticks), don't tag it as joystick. libinput also checks for > 10 keyboard keys, but this is not done here to be more conservative.
* Merge pull request #23051 from poettering/udev-tweaklets-2Yu Watanabe2022-04-122-19/+21
|\ | | | | udev: three minor tweaks
| * sd-device: validate devnum parameters in device_set_devnum()Lennart Poettering2022-04-111-0/+4
| |
| * sd-device: make device_set_syspath() more defensiveLennart Poettering2022-04-111-2/+3
| | | | | | | | | | | | | | Simplify generated sysfs paths, since we might get data passed that includes extra // in the middle. Also, let's not assume /sys/ prefix without verification.
| * sd-device: simplify device_enumerator_scan_devices_and_subsystems() a bitLennart Poettering2022-04-111-17/+14
| | | | | | | | | | We can use enumerator_scan_devices_all() to shorten the code, and drop some of the error handling complexities.
* | Merge pull request #23048 from keszybz/Add-more-tests-for-specifiersYu Watanabe2022-04-128-92/+176
|\ \ | | | | | | Add more tests for specifiers
| * | tree-wide: host_name → hostnameZbigniew Jędrzejewski-Szmek2022-04-116-43/+43
| | | | | | | | | | | | | | | We use "hostname" exclusively in docs, and also in a big majority of the code. Let's use the same spelling in remaining places.
| * | test-unit-name: add missing tests for specifiers, fix existing testsZbigniew Jędrzejewski-Szmek2022-04-111-42/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that in fa3cd7394c227ad38c5c09b2bc2d035e7fb14a76 back in 2013 I got the test reversed: assert_se(strncmp()) should be assert_se(strncmp==0). So the tests that were using "*" were not entirely useful ;) The function was refactored a bunch of times since then, and it seems nobody noticed. So let's replace this fragile construct by a simple fnmatch, which also has the advantage that the glob can be inserted in arbitrary places. Following up for d0aba07f1ac8d6df2ccfa033fe1e195b1b9e5272: we should have at least basic tests for all interfaces, even the deprecated ones, so that we catch obvious errors. This sorts the specifiers the same way that they are declared in the unit-printf.c, and adds tests for all the specifiers. We even were setting 'shell', but not using it in a test. Also, we shouldn't initialize variables in tests. This catches the error fixed in previous commit.
| * | shared/specifier: make sure we set the output variable even for void answersZbigniew Jędrzejewski-Szmek2022-04-111-1/+7
| | | | | | | | | | | | | | | | | | | | | This doesn't change anything for real uses, because we'd initialize the variable to NULL for _cleanup_ anyway, but let's follow our general pattern of always setting the output on "success". (Even if that success is an empty answer here.)
| * | Add comments about deprecated specifiersZbigniew Jędrzejewski-Szmek2022-04-112-8/+11
| | | | | | | | | | | | | | | Inspired by 9fe20c3234. When the specifier is undocumented, it is really easy to add a duplicate definition in a different place.
* | | core: update to use new-style sd-bus macrosamarjargal2022-04-113-687/+444
| |/ |/| | | | | | | Replace old SD_BUS_METHOD_WITH_NAMES and SD_BUS_SIGNAL_WITH_NAMES macros to the new SD_BUS_METHOD_WITH_ARGS and SD_BUS_SIGNAL_WITH_ARGS macros.
* | timedate: update to use new-style sd-bus macrosSonali Srivastava2022-04-111-36/+25
| |
* | Merge pull request #22992 from poettering/loop-dissect-tweaksYu Watanabe2022-04-1112-550/+241
|\ \ | | | | | | loop-util/image dissect fixes
| * | repart: use sd_device_open()Yu Watanabe2022-04-101-39/+46
| | | | | | | | | | | | Then, we can safely open devices even if symlinks are not yet created by udevd.
| * | tree-wide: take BSD lock on loopback devices we dissect/mount/operate onLennart Poettering2022-04-109-0/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So here's something we should always keep in mind: systemd-udevd actually does *two* things with BSD file locks on block devices: 1. While it probes a device it takes a LOCK_SH lock. Thus everyone else taking a LOCK_EX lock will temporarily block udev from probing devices, which is good when making changes to it. 2. Whenever a device is closed after write (detected via inotify), udevd will issue BLKRRPART (requesting the kernel to reread the partition table). It does this while holding a LOCK_EX lock on the block device. Thus anyone else taking LOCK_SH or LOCK_EX will temporarily block udevd from issuing that ioctl. And that's quite relevant, since the kernel will temporarily flush out all partitions while re-reading the partition table and then create them anew. Thus it is smart to take LOCK_SH when dissecting a block device to ensure that no BLKRRPART is issued in the background, until we mounted the devices.
| * | test-loop-block: reenable test on CILennart Poettering2022-04-101-6/+0
| | |
| * | update TODOLennart Poettering2022-04-101-6/+0
| | |
| * | dissect: rework how we wait for partition block devicesLennart Poettering2022-04-103-499/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This revisits the mess around waiting for partition block devices in the image dissection code. It implements a nice little trick: Instead of waiting for the kernel to probe the partition table for us and generate the block devices from it, we'll just do that ourselves. How can we do it? Via the BLKPG_ADD_PARTITION ioctl, that the kernel has supported for a while. This ioctl allows creating partition block devices off "whole" block devices from userspace, without the partitions necessarily being present in the partition table at all. So, whenever we want a partition to be there, we'll just issue BLKPG_ADD_PARTITION. This can either work, in which case we know the partition is there, and can use it. Yay. Or it can fail with EBUSY, which the kernel returns if a partition by the selected partition index already exists (or if an existing partition overlaps with the new one). But if that's the case, then that's also OK, because the partition will already exist. So, regardless if we win or the kernel wins, for us the outcome is the same: the partition block device will exist after invoking the ioctl. Yay. Net effect: we are not dependent on asynchronous uevent messages to wait for the devices. Instead we synchronously get what we need. This makes us independent of the (apparently less than reliable) netlink transport, and should almost always be quicker. Hopefully addresses #17469 even on older kernels. Fixes: #17469
* | | Merge pull request #23037 from yuwata/sd-device-validateYu Watanabe2022-04-111-89/+93
|\ \ \ | | | | | | | | sd-device: validate input parameter after creating sd-device object
| * | | sd-device: shorten code a bitYu Watanabe2022-04-111-58/+26
| | | |
| * | | sd-device: minor may be NULLYu Watanabe2022-04-111-1/+1
| | | |
| * | | sd-device: validate input parameter after creating sd-device objectYu Watanabe2022-04-111-30/+66
| |/ /
* | | Merge pull request #23038 from yuwata/udev-log-onceZbigniew Jędrzejewski-Szmek2022-04-114-31/+36
|\ \ \ | | | | | | | | udev: log once
| * | | udev: inline loop variableYu Watanabe2022-04-112-15/+6
| | | |
| * | | udev: suppress multiple log message about interface naming scheme from workersYu Watanabe2022-04-111-0/+7
| | | |
| * | | udev/net: cache parsed result of net.ifnames=Yu Watanabe2022-04-111-16/+23
| |/ / | | | | | | | | | To make the log message shown only once.
* | | namespace-util: Fix typoDaan De Meyer2022-04-111-1/+1
| | |
* | | timesync: update to use new-style sd-bus macrosSonali Srivastava2022-04-111-6/+5
| | |
* | | fix typoYu Watanabe2022-04-101-1/+1
| | |
* | | fix typoYu Watanabe2022-04-103-3/+3
|/ /
* | Ensure dns_search_domain_unlink_marked removes all marked domainsBen Efros2022-04-101-1/+1
| |
* | test: always invoke systemd-repart with --no-pagerYu Watanabe2022-04-091-6/+6
| | | | | | | | Follow-up for 31cf58864d3f437c7e3f0497df0fef85130f159d.
* | udev: add parens for function names in the logsYu Watanabe2022-04-091-8/+8
| |
* | Merge pull request #22614 from zonque/timesync/runtimeYu Watanabe2022-04-098-24/+170
|\ \ | | | | | | timesyncd: add runtime servers
| * | timesync: be explicit in the integer check of poll_interval_usecDaniel Mack2022-04-091-1/+1
| | |
| * | timesyncd: clean up server_name_new()Daniel Mack2022-04-091-14/+16
| | | | | | | | | | | | | | | Use `LIST_APPEND()` in favour of `LIST_FIND_TAIL()` + `LIST_INSERT_AFTER()`. Also use a switch/case statement instead of if/else if.
| * | timesyncd: add address type information to debug logDaniel Mack2022-04-092-1/+13
| | | | | | | | | | | | | | | | | | | | | When looking at debug logs, it's helpful to know what type of server address has been added. For that, introduce a string lookup table for the ServerType type.
| * | timesyncd: add RUNTIME serversDaniel Mack2022-04-098-10/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new server type can only be set at runtime through a D-Bus method and is exposed for reading through a D-Bus property. `CAP_NET_ADMIN` and a PolKit acknowledge is required for setting runtime servers. Entries submitted that way are used before system and link servers are being looked at.
| * | timesync: export manager_is_connected()Daniel Mack2022-04-092-1/+4
| | | | | | | | | | | | This function use useful from other files, so let's export it.
* | | networkd-test: lazy umount tmp directoriesLuca Boccassi2022-04-091-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Semaphore CI, for some reason, /run/systemd/resolve is busy so the umount fails at the end of the test run: Verify link states with Unmanaged= settings, cold-plug. ... umount: /run/systemd/resolve: target is busy.14:57 ok14:57 ERROR14:57 ======================================================================14:57 ERROR: tearDownModule (__main__)14:57 ----------------------------------------------------------------------14:57 Traceback (most recent call last):14:57 File /tmp/autopkgtest-lxc.6islza9t/downtmp/build.A9b/src/test/networkd-test.py, line 94, in tearDownModule14:57 subprocess.check_call([umount, d])14:57 File /usr/lib/python3.9/subprocess.py, line 373, in check_call14:57 raise CalledProcessError(retcode, cmd)14:57 subprocess.CalledProcessError: Command '['umount', '/run/systemd/resolve']' returned non-zero exit status 32.14:57 ----------------------------------------------------------------------14:58 Ran 35 tests in 138.868s14:58 FAILED (errors=1, skipped=2) Use lazy umount to avoid erroring out.
* | machine: update to use new-style sd-bus macros (#23012)Amarjargal2022-04-082-383/+243
| | | | | | | | | | | | | | | | | | | | * machine: update to use new-style sd-bus macros Replace old SD_BUS_METHOD_WITH_NAMES and SD_BUS_SIGNAL_WITH_NAMES macros to the new SD_BUS_METHOD_WITH_ARGS and SD_BUS_SIGNAL_WITH_ARGS macros. Meson test, mkosi test image and running machinectl after build returned no error. But since I don't have any virtual machines or containers, I'm not sure how to test the changes thoroughly.
* | update TODOLennart Poettering2022-04-081-4/+7
|/
* specifier: use %q for pretty hostnameLennart Poettering2022-04-085-9/+10
| | | | | | | %R is already used in service manager specifier expansion (cgroup root), hence use a different char, that was so far not used. Follow-up for: 6ceb0a4094908dd213a78b9f6d0c59a684831ab0
* systemd-creds: fix name of env varLennart Poettering2022-04-081-1/+1
| | | | | The env var is called $CREDENTIALS_DIRECTORY, not $CREDENTIALS_PATH. Fix message about it accordingly.
* update TODOLennart Poettering2022-04-081-6/+14
|
* update TODOLennart Poettering2022-04-081-4/+19
|
* update TODOLennart Poettering2022-04-081-1/+13
|
* meson: explicitly include coverage tweaks when built w/ --coverageFrantisek Sumsal2022-04-083-16/+26
| | | | | | | | | To make sure we don't miss any _exit() calls let's move the coverage-related tweaks into a separate header file and include it explicitly on the compiler command line using -include when a coverage build is requested. Follow-up to c6552ad381003a23cde7c3228e7071f30465df35.
* Merge pull request #23009 from ↵Lennart Poettering2022-04-0848-174/+218
|\ | | | | | | | | keszybz/fix-detection-of-libsystemd-shared-with-suffix Fix detection of libsystemd-shared with suffix
| * syscalls: update syscall definitionsZbigniew Jędrzejewski-Szmek2022-04-0720-0/+20
| |