aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* resolved: mention which RRs we query when requesting them to authenticate ↵Lennart Poettering2018-12-181-6/+6
| | | | some other RR
* resolved: only attempt non-answer SOA RRs if they are parents of our queryLennart Poettering2018-12-181-0/+8
| | | | | | | | | | | | | There's no value in authenticating SOA RRs that are neither answer to our question nor parent of our question (the latter being relevant so that we have a TTL from the SOA field for negative caching of the actual query). By being to eager here, and trying to authenticate too much we run the risk of creating cyclic deps between our transactions which then causes the over-all authentication to fail. Fixes: #9771
* timesync: fix serialization of IP addressLennart Poettering2018-12-181-1/+5
| | | | Fixes: #11169
* Merge pull request #11144 from keszybz/dissect-image-fixLennart Poettering2018-12-179-407/+286
|\ | | | | Fix for dissect-image use in nspawn
| * dissect-image: wait for the main device and all partitions to be known by udevZbigniew Jędrzejewski-Szmek2018-12-171-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #10526. Even if we waited for the root device to appear, the mount could still fail if we didn't wait for udev to initalize the device. In particular, the /dev/block/n:m path used to mount the device is created by udev, and nspawn would sometimes win the race and the mount would fail with -ENOENT. The same wait is done for partitions, since if we try to mount them, the same considerations apply. Note: I first implemented a version which just does a loop (with a short wait). In that approach, udev takes on average ~800 µs to initialize the loopback device. The approach where we set up a monitor and avoid the loop is a bit nicer. There doesn't seem to be a significant difference in speed. With 1000 invocations of 'systemd-nspawn -i image.squashfs echo': loop (previous approach): real 4m52.625s user 0m37.094s sys 2m14.705s monitor (this patch): real 4m50.791s user 0m36.619s sys 2m14.039s
| * dissect-image: wait for the root to appearZbigniew Jędrzejewski-Szmek2018-12-171-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dissect-image would wait for the root device and paritions to appear. But if we had an image with no partitions, we'd not wait at all. If the kernel or udev were slow in creating device nodes or symlinks, subsequent mount attempt might fail if nspawn won the race. Calling wait_for_partitions_to_appear() in case of no partitions means that we verify that the kernel agrees that there are no partitions. We verify that the kernel sees the same number of partitions as blkid, so let's that also in this case. This makes the failure in #10526 much less likely, but doesn't eliminate it completely. Stay tuned.
| * dissect-image: split out a chunk of dissect_image() outZbigniew Jędrzejewski-Szmek2018-12-171-85/+119
| | | | | | | | No functional change, just moving code around.
| * rfkill: move wait_for_initialized() to shared/Zbigniew Jędrzejewski-Szmek2018-12-173-84/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function interface is the same, except that the output pointer may be NULL. The implementation is slightly simplified by taking advantage of changes in ancestor commit 'sd-device: attempt to read db again if it wasn't found', by not creating a new sd_device object before re-checking the is_initialized status. v2: - In v1, the old object was always used and the device received back from the sd_device_monitor_start callback was ignored. I *think* the result will be equivalent in both cases, because by the time we the callback gets called, the db entry in the filesystem will also exist, and any subsequent access to properties of the object would trigger a read of the database from disk. But I'm not certain, and anyway, using the device object received in the callback seems cleaner.
| * sd-device: remove holes in struct sd_deviceZbigniew Jędrzejewski-Szmek2018-12-171-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally, we don't care too much about what pahole reports. But this structure could potentially be allocated for every device on the system, i.e. in a large number of copies. 5 vs 7 cache lines is nice. /* size: 400, cachelines: 7, members: 53 */ /* sum members: 330, holes: 12, sum holes: 70 */ /* last cacheline: 16 bytes */ /* size: 320, cachelines: 5, members: 53 */ /* bit holes: 1, sum bit holes: 6 bits */ /* bit_padding: 5 bits */
| * sd-device: pass timestamp internally as usec_t not char*Zbigniew Jędrzejewski-Szmek2018-12-163-27/+28
| |
| * sd-device: reduce the number of implementations of device_read_db() we keep ↵Zbigniew Jędrzejewski-Szmek2018-12-165-182/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | around We had two very similar functions: device_read_db_aux and device_read_db, and a number of wrappers for them: device_read_db_aux ← device_read_db (in sd-device.c) ← all functions in sd-device.c, including sd_device_is_initialized ← device_read_db_force ← event_execute_rules_on_remove (in udev-event.c) device_read_db (in device-private.c) ← functions in device_private.c (but not device_read_db_force): device_get_devnode_{mode,uid,gid} device_get_devlink_priority device_get_watch_handle device_clone_with_db ← called from udevadm, udev-{node,event,watch}.c Before 7141e4f62c3f220872df3114c42d9e4b9525e43e (sd-device: don't retry loading uevent/db files more than once), the two implementations were the same. In that commit, device_read_db_aux was changed. Those changes were reverted in the parent commit, so the two implementations are now again the same except for superficial differences. This commit removes device_read_db (in sd-device.c), and renames device_read_db_aux to device_read_db_internal and makes everyone use this one implementation. There should be no functional change.
| * sd-device: attempt to read db again if it wasn't foundZbigniew Jędrzejewski-Szmek2018-12-161-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This mostly reverts "sd-device: don't retry loading uevent/db files more than once", 7141e4f62c3f220872df3114c42d9e4b9525e43e. We will retry if we couldn't access the file, but not if parsing failed. Not re-reading the database at all just doesn't seem like a good idea. We have two implementations of device_read_db, and one does that, and the other retries to read the db. Re-reading seems more useful, since we can create the object and then access properties as some later time when we know that the device has been initialized and we can get useful results. Otherwise, we force the user to destroy this object and create a new one. This changes device_read_uevent_file() and device_read_db_aux(). See next commit for description of where those functions are used.
* | core: do cgroup migration first and only then connect to journaldMichal Sekletar2018-12-171-16/+18
| | | | | | | | Fixes #11162
* | Merge pull request #11167 from yuwata/sd-resolve-typesafeLennart Poettering2018-12-176-52/+111
|\ \ | | | | | | sd-resolve: introduce typesafe macros
| * | timesync: use typesafe resolve_getaddrinfo()Yu Watanabe2018-12-171-3/+3
| | |
| * | socket-proxyd: use typesafe resolve_getaddrinfo()Yu Watanabe2018-12-171-4/+3
| | |
| * | netdev: use typesafe resolve_getaddrinfo() in wireguard.cYu Watanabe2018-12-171-27/+15
| | |
| * | netdev: sort headersYu Watanabe2018-12-171-5/+5
| | |
| * | sd-resolve: add sd_resolve_get{addr,info}_with_destroy_callback() and ↵Yu Watanabe2018-12-173-13/+85
| | | | | | | | | | | | typesafe macros
* | | core: fix KeyringMode for user servicesAlexey Bogdanenko2018-12-173-16/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KeyringMode option is useful for user services. Also, documentation for the option suggests that the option applies to user services. However, setting the option to any of its allowed values has no effect. This commit fixes that and removes EXEC_NEW_KEYRING flag. The flag is no longer necessary: instead of checking if the flag is set we can check if keyring_mode is not equal to EXEC_KEYRING_INHERIT.
* | | Merge pull request #11159 from keszybz/udev-typedefLennart Poettering2018-12-177-90/+89
|\ \ \ | | | | | | | | Udev typedef and normal error reporting
| * | | udev: use typedef for struct udev_eventZbigniew Jędrzejewski-Szmek2018-12-176-29/+29
| | | |
| * | | udev: use typedef for struct udev_rulesZbigniew Jędrzejewski-Szmek2018-12-177-38/+39
| | | |
| * | | udev: make udev_rules_new() return a proper error codeZbigniew Jędrzejewski-Szmek2018-12-146-28/+26
| | | |
* | | | journald: correctly attribute log messages also with cgroupsv1Michal Sekletar2018-12-171-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With cgroupsv1 a zombie process is migrated to root cgroup in all hierarchies. This was changed for unified hierarchy and /proc/PID/cgroup reports cgroup to which process belonged before it exited. Be more suspicious about cgroup path reported by the kernel and use unit_id provided by the log client if the kernel reports that process is running in the root cgroup. Users tend to care the most about 'log->unit_id' mapping so systemctl status can correctly report last log lines. Also we wouldn't be able to infer anything useful from "/" path anyway. See: https://github.com/torvalds/linux/commit/2e91fa7f6d451e3ea9fec999065d2fd199691f9d
* | | | Merge pull request #11184 from poettering/resolved-search-domains-maxLennart Poettering2018-12-172-4/+4
|\ \ \ \ | | | | | | | | | | resolve: bump max of dns servers/search domains
| * | | | resolve: bump max of dns servers/search domainsLennart Poettering2018-12-172-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently people want more of these (as #11175 shows). Since this is merely a safety limit for us, let's just bump all values substantially. Fixes: #11175
* | | | | resolve: enable EDNS0 towards the 127.0.0.53 stub resolverTore Anderson2018-12-172-1/+3
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This appears to be necessary for client software to ensure the reponse data is validated with DNSSEC. For example, `ssh -v -o VerifyHostKeyDNS=yes -o StrictHostKeyChecking=yes redpilllinpro01.ring.nlnog.net` fails if EDNS0 is not enabled. The debugging output reveals that the `SSHFP` records were found in DNS, but were considered insecure. Note that the patch intentionally does *not* enable EDNS0 in the `/run/systemd/resolve/resolv.conf` file (the one that contains `nameserver` entries for the upstream DNS servers), as it is impossible to know for certain that all the upstream DNS servers handles EDNS0 correctly.
* | | | Merge pull request #11077 from yuwata/udev-issue-better-fixZbigniew Jędrzejewski-Szmek2018-12-172-16/+19
|\ \ \ \ | | | | | | | | | | sd-device: do not change buffer size if the socket is already bound
| * | | | sd-device: do not change buffer size if the socket is already boundYu Watanabe2018-12-142-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the results of CIs in #11076, changing buffer size may cause issue #10754. So, let's prohibit to change the size if it is already bound. This also reverts commit 986ab0d2dc161dfa026e8fc7a609f9efb8cb4397.
| * | | | sd-device: do not modify socket option(s) if socket is passed by PID1Yu Watanabe2018-12-141-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the socket fd is passed by PID1, then it is created by .socket unit and we have already set sufficient option(s) for the socket. So, let's not touch the passed socket.
| * | | | Revert "sd-device: do not call device_monitor_enable_receiving() for passed ↵Yu Watanabe2018-12-141-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fd from pid1" This reverts commit 916707cca56ac73c81d10c41b6d7f0800663fc29. As the CI results on #11076, #10754 is not fixed by the commit, but by 986ab0d2dc161dfa026e8fc7a609f9efb8cb4397. So, let's revert the commit.
* | | | | Merge pull request #11086 from poettering/nscd-cache-flushZbigniew Jędrzejewski-Szmek2018-12-1712-7/+254
|\ \ \ \ \ | | | | | | | | | | | | flush nscd's caches when we register user/groups/hostnames
| * | | | | core: flush nscd's caches whenever we allocate/release a dynamic userLennart Poettering2018-12-151-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should make dynamic users and nscd work together better. Fixes: #10740
| * | | | | hostnamed: always flush nscd cache when changing hostnameLennart Poettering2018-12-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | This way we know that nss-myhostname always serves the correct answer.
| * | | | | machined: flush nscd caches whenever a machine comes/goesLennart Poettering2018-12-155-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | This way, nss-mymachines should always serve authoritative data.
| * | | | | machined: fix memory corruptionLennart Poettering2018-12-151-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's make sure the first hashmap we destroy also frees all machines, because otherwise when freeing the other hashmaps we'll try to deregister the contained machines from the hashmaps already destroyed.
| * | | | | shared: add helper for flushing nscd cachesLennart Poettering2018-12-155-2/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently, people do use nscd, hence play somewhat nice with it, and let's explicitly flush nscd caches whenever we register a new user/group. This patch only adds the actual refresh request invocation. Later commits then issue this call at appropriate moments. Note that the nscd protocol is not officially documented though very simple. This code is written very defensively so that incompatibilities don't affect us much. Given that glibc really has a duty to maintain compat between differently compiled programs and their system nscd they can't break API and thus it should be safe for us to implement an alternative, minimalistic client. Ideally this kind of explicit, global cache flushing would not be necessary. However nscd currently has no cache coherency protocol, hence we can't really implement this better. The only concept it knows is a TTL for positive hosts lookups. Hoewver for negative lookups or any of the other tables nothing is available.
* | | | | | Merge pull request #11179 from kraj/kraj/puZbigniew Jędrzejewski-Szmek2018-12-172-2/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix issues found with gcc trunk
| * | | | | | core: Fix use after free case in load_from_path()Khem Raj2018-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ensure that mfree() on filename is called after the logging function which uses the string pointed by filename Signed-off-by: Khem Raj <raj.khem@gmail.com>
| * | | | | | sysctl: Don't pass null directive argument to '%s'Khem Raj2018-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | value pointer here is always NULL but subsequent use of that pointer with a %s format will always be NULL, printing p instead would be a valid string Signed-off-by: Khem Raj <raj.khem@gmail.com>
* | | | | | | fileio: when reading a full file into memory, refuse inner NUL bytesLennart Poettering2018-12-173-12/+25
|/ / / / / / | | | | | | | | | | | | | | | | | | Just some extra care to avoid any ambiguities in what we read.
* | | | | | Merge pull request #11142 from ssahani/bond-dynamic-tlbYu Watanabe2018-12-174-1/+12
|\ \ \ \ \ \ | |_|_|_|/ / |/| | | | | netdev bond: add support to configure tlb_dynamic_lb
| * | | | | networkd: Bond - AllSlavesActive fix parserSusant Sahani2018-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Bond.AllSlavesActive use parser type bool
| * | | | | netdev bond: add support to configure tlb_dynamic_lbSusant Sahani2018-12-154-0/+11
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | Closes https://github.com/systemd/systemd/issues/11135 Add test for bond : tlb_dynamic_lb
* | | | | core/mount: minimize impact on mount storm.NeilBrown2018-12-162-7/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we create 2000 mounts (on a 1-CPU qemu VM) with mkdir -p /MNT/{1..2000} time for i in {1..2000}; do mount --bind /etc /MNT/$i ; done it takes around 20 seconds to complete. Much of this time is taken up by systemd repeatedly processing /proc/self/mountinfo. If I disable the processing, the time drops to about 4 seconds. I have reports that on a larger system with multiple active user sessions, each with it's own systemd, the impact can be higher. One particular use-case where a large number of mounts can be expected in quick succession is when the "clearcase" SCM starts up. This patch modifies the handling up events from /proc/self/mountinfo so that systemd backs off when a storm is detected. Specifically the time to process mountinfo is measured, and the process will not be repeated until 10 times that duration has passed. This ensures systemd won't use more than 10% of real time processing mountinfo. With this patch, my test above takes about 5 seconds.
* | | | | Merge pull request #11143 from keszybz/enable-symlinkLennart Poettering2018-12-1612-96/+110
|\ \ \ \ \ | | | | | | | | | | | | Runtime mask symlink confusion fix
| * | | | | shared/install: ignore symlinks which have lower priority than the unit fileZbigniew Jędrzejewski-Szmek2018-12-131-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #10583, a unit file lives in ~/.config/systemd/user, and 'systemctl --runtime --user mask' is used to create a symlink in /run. This symlink has lower priority than the config file, so 'systemctl --user' will happily load the unit file, and does't care about the symlink at all. But when asked if the unit is enabled, we'd look for all symlinks, find the symlink in the runtime directory, and report that the unit is runtime-enabled. In this particular case the fact that the symlink points at /dev/null, creates additional confusion, but it doesn't really matter: *any* symlink (or regular file) that is lower in the priority order is "covered" by the unit fragment, and should be ignored. Fixes #10583.
| * | | | | shared/install: add some more debugging infoZbigniew Jędrzejewski-Szmek2018-12-131-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Just to make it easier to understand what is going on.
| * | | | | shared/install: remove two conditionals which are always falseZbigniew Jędrzejewski-Szmek2018-12-131-14/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The name argument in UnitFileInstallInfo (i->name) should always be a unit file name, so the conditional always takes the 'else' branch. The only call chain that links to find_symlinks_fd() is unit_file_lookup_state → find_symlinks_in_scope → find_symlinks → find_symlinks_fd. But unit_file_lookup_state calls unit_name_is_valid(name), and then name is used to construct the UnitFileInstallInfo object in install_info_discover, which just uses the name it was given.