aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* test-dnssec: Allow builds without libgcrypt (#7850) (#7850)gentoo-236Michal Koutný2018-01-131-0/+2
| | | | | Fixes: #7845 (cherry picked from commit 4848b1f91ab8bc9b44b377c13dc20e69a21bde9a)
* tmpfiles: consider /etc uninitialized also when /etc/machine-id is present ↵Franck Bui2018-01-131-3/+3
| | | | | | but empty (#7849) (cherry picked from commit d8dab75789ec1ffd53fc06f5f370220ae7b31d9d)
* util-lib: save/restore errno in cleanup callsLennart Poettering2018-01-133-1/+8
| | | | | | | | | | | | | | | | We should be careful with errno in cleanup functions, and not alter it under any circumstances. In the safe_close cleanup handlers we are already safe in that regard, but let's add similar protections on other cleanup handlers that invoke system calls. Why bother? Cleanup handlers insert code at function return in non-obvious ways. Hence, code that sets errno and returns should not be confused by us overrding the errno from a cleanup handler. This is a paranoia fix only, I am not aware where this actually mattered in real-life situations. (cherry picked from commit dfd14786b5aa49c3c8e3866c0ecfa6d90c531eb6)
* sd-radv: avoid redefinition of struct in6_addrHans-Christian Noren Egtvedt2018-01-131-1/+0
| | | | | | | | | | | | Both netinet/icmp6.h and linux/in6.h will define struct in6_addr, and in user space we want to use the netinet/icmp6.h variant. Fixes build problem: In file included from src/libsystemd-network/sd-radv.c:23:0: /home/hegtvedt/work/os/product/sunrise/root/_build/v2/include/linux/in6.h:30:8: error: redefinition of 'struct in6_addr' (cherry picked from commit 8a2b193a55284ecb25e726d5563330787b49e89e)
* missing: add bpf() define for ARM definitionHans-Christian Noren Egtvedt2018-01-131-0/+2
| | | | (cherry picked from commit d07ba5d79004c7046c38362a638f961ee16504ec)
* missing: fix bpf() define for TileraHans-Christian Noren Egtvedt2018-01-131-0/+2
| | | | | | __NR_bpf syscall uses the default generic value for Tilera, e.g. 280. (cherry picked from commit 66ffb275faa0656cfc7fd51292357989719b8d5a)
* timesync: fix typoYu Watanabe2018-01-131-1/+1
| | | | (cherry picked from commit f011fcfdec6479e3f434a03956c51992612db2af)
* network: fix invalid memory access in netdev_cancel_callbackZbigniew Jędrzejewski-Szmek2018-01-131-1/+1
| | | | | This is a backport of the fix done in the merge commit 2269954112e4a61b1a66a4771070b37c8a81a748.
* networkd: fix memory corruptionLennart Poettering2018-01-132-6/+17
| | | | | | | | | | | | | | | | When loading .netdev files we parse them twice: first we do one parsing iteration to figure out their "kind", and then we do it again to parse out the kind's parameters. The first iteration is run with a "short" NetDev structure, that only covers the generic NetDev properties. Which should be enough, as we don't parse the per-kind properties. However, before this patch we'd still try to destruct the per-kind properties which resulted in memory corruption. With this change we distuingish the two iterations by the state field, so that the destruction only happens when the state signals we are running with a full NetDev structure. Since this is not obvious, let's add a lot of comments. (cherry picked from commit f3c33b234d9f0256805722f02c7b4c4b59fd6de6)
* network: fix memory leak when an netdev was skippedZbigniew Jędrzejewski-Szmek2018-01-132-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In general we'd leak anything that was allocated in the first parsing of netdev, e.g. netdev name, host name, etc. Use normal netdev_unref to make sure everything is freed. --- command --- /home/zbyszek/src/systemd/build2/test-network --- stderr --- /etc/systemd/network/wg0.netdev:3: Failed to parse netdev kind, ignoring: wireguard /etc/systemd/network/wg0.netdev:5: Unknown section 'WireGuard'. Ignoring. /etc/systemd/network/wg0.netdev:9: Unknown section 'WireGuardPeer'. Ignoring. NetDev has no Kind configured in /etc/systemd/network/wg0.netdev. Ignoring /etc/systemd/network/br0.network:13: Unknown lvalue 'NetDev' in section 'Network' br0: netdev ready ================================================================= ==11666==ERROR: LeakSanitizer: detected memory leaks Direct leak of 4 byte(s) in 1 object(s) allocated from: #0 0x7f3a314cf238 in __interceptor_strdup (/lib64/libasan.so.4+0x77238) #1 0x7f3a30e71ad1 in free_and_strdup ../src/basic/string-util.c:870 #2 0x7f3a30d34fba in config_parse_ifname ../src/shared/conf-parser.c:981 #3 0x7f3a30d2f5b0 in next_assignment ../src/shared/conf-parser.c:155 #4 0x7f3a30d30303 in parse_line ../src/shared/conf-parser.c:273 #5 0x7f3a30d30dee in config_parse ../src/shared/conf-parser.c:390 #6 0x7f3a30d310a5 in config_parse_many_files ../src/shared/conf-parser.c:428 #7 0x7f3a30d3181c in config_parse_many ../src/shared/conf-parser.c:487 #8 0x55b4200f9b00 in netdev_load_one ../src/network/netdev/netdev.c:634 #9 0x55b4200fb562 in netdev_load ../src/network/netdev/netdev.c:778 #10 0x55b4200c607a in manager_load_config ../src/network/networkd-manager.c:1299 #11 0x55b4200818e0 in test_load_config ../src/network/test-network.c:128 #12 0x55b42008343b in main ../src/network/test-network.c:254 #13 0x7f3a305f8889 in __libc_start_main (/lib64/libc.so.6+0x20889) SUMMARY: AddressSanitizer: 4 byte(s) leaked in 1 allocation(s). ------- (cherry picked from commit 281bb5c1102e573accdf665f1ab923e750e09217)
* networkd: call link_set_routing_policy_rule before setting routes (#7815)Susant Sahani2018-01-131-2/+2
| | | | | | | | | | | | | | | | commit 7715629 (networkd: Fix race condition in [RoutingPolicyRule] handling (#7615)). Does not fix race. Still there is a race in case of bride because the bride goes down and up . calling route_configure then link_set_routing_policy_rule and the link_check_ready makes a race between routing_policy_rule_messages and route_messages. While bride comes up and we call the call again route_configure if finds it self in the callback function LINK_STATE_CONFIGURED networkd dies. Let's handle first routing policy rules then route_configure. This fixes the crash. Closes #7797 (cherry picked from commit 27c34f732e7767b5cdc90fe7ad03ae0ea625671c)
* sd-device: support the case that /sys is a symlinkYu Watanabe2018-01-131-0/+23
| | | | | | | | | | When /sys is a symlink to the sysfs mountpoint, e.g. /path/to/sysfs. Then, device->syspath was set to like /path/to/sysfs/devices/foo/baz. This converts the path to /sys/devices/foo/baz. Fixes #7676. (cherry picked from commit 2e1ec12ec3329dddaa74d3ae1e819505166fe9ad)
* sd-device: use chase_symlinks()Yu Watanabe2018-01-131-12/+2
| | | | (cherry picked from commit 5bbe8eab3443169a496d6b287e7c2291d63cd115)
* rules: Mark the kvm device as static_node (for s390x and ppc64) (#7795)Thomas Huth2018-01-131-1/+2
| | | | | | | | | | | | | | | | | | | | On s390x and ppc64, the permissions of the /dev/kvm device are currently not right as long as the kvm kernel module has not been loaded yet. The kernel module is using MODULE_ALIAS("devname:kvm") there, so the module will be loaded on the first access to /dev/kvm. In that case, udev needs to apply the permission to the static node already (which was created via devtmpfs), i.e. we have to specify the option "static_node=kvm" in the udev rule. Note that on x86, the kvm kernel modules are loaded early instead (via the MODULE_DEVICE_TABLE(x86cpu, ...) feature checking), so that the right module is loaded for the Intel or AMD hypervisor extensions right from the start. Thus the "static_node=kvm" is not required on x86 - but it also should not hurt here (and using it here even might be more future proof in case the module loading is also done delayed there one day), so we just add the new option to the rule here unconditionally. (cherry picked from commit d35d6249d5a7ed3228b94fc0e36a36bc3fe84482)
* logind: fix user_object_find()Lennart Poettering2018-01-131-6/+6
| | | | | | | | | The logic was completely borked since e4d2984bf8514ab576a66d5ac1f1cde746bb32a3, correct that. CID #1384234 (cherry picked from commit 2ac0ab5921a3153e0334b4342554fc0c87ab01c3)
* core: Fix edge case when processing /proc/self/mountinfo (#7811)rkolchmeyer2018-01-131-1/+1
| | | | | | | | | | | | | | Currently, if there are two /proc/self/mountinfo entries with the same mount point path, the mount setup flags computed for the second of these two entries will overwrite the mount setup flags computed for the first of these two entries. This is the root cause of issue #7798. This patch changes mount_setup_existing_unit to prevent the just_mounted mount setup flag from being overwritten if it is set to true. This will allow all mount units created from /proc/self/mountinfo entries to be initialized properly. Fixes: #7798 (cherry picked from commit 65d36b49508a53e56bae9609ff00fdc3de340608)
* install: search preset files in /run (#7715)John Lin2018-01-131-0/+2
| | | | | | | | According to systemd.preset(5), presets files in /run should take effect. However, before this patch, preset files in /run were ignored. (cherry picked from commit 7c59ab4ba11f7ac2afc3dc4f3ba9c97b72c34750)
* core: RuntimeDirectory= does not request new mount namespaceYu Watanabe2018-01-131-2/+1
| | | | | | | | | Now RuntimeDirectory= does not create 'private' directory. Thus, it is not neccessary to request new mount namespace. Follow-up for 8092a48cc1d1fb20b66371576754df831d30a43b. (cherry picked from commit b43ee82fc1366489963b319dd5f1f22d2833883c)
* Revert "core/execute: RuntimeDirectory= or friends requires mount namespace"Yu Watanabe2018-01-131-6/+8
| | | | | | | | This reverts commit 652bb2637aee54e3503a22d2928a929ecd7a84b3. Fixes #7761. (cherry picked from commit 42b1d8e0f5c025d3c85a4a60fda73d98bf725da5)
* systemd-udevd: fix speed/duplex processing with valid .link files (#7808)Bruce A. Johnson2018-01-131-3/+3
| | | | | | | | | Including BitsPerSecond or Duplex values in .link files did not work when set_slinksettings was called because the routine was not copying the base parameters to the structure given to ioctl. As a result, EINVAL was always reported, and no change occurred on the Ethernet device. (cherry picked from commit 94d4acbe4b496c0f0c4e5e2143426751c8c5f9a9)
* NEWS: add in a missing change back from 229 (#7804)Lennart Poettering2018-01-131-0/+7
| | | | | | | | See: https://lists.freedesktop.org/archives/systemd-devel/2017-July/039255.html http://fromthecodefront.blogspot.de/2017/07/systemd-pitfalls.html (cherry picked from commit dd95b381b26369c02a3ca03585184cb2ea17295b)
* ip-address-access: let's exit the loop after invalidating our entry a (#7803)Lennart Poettering2018-01-131-7/+6
| | | | | | CID#1382967 (cherry picked from commit 8ed7742aa2140e7af50e388d8a2769c2c95d90b4)
* meson: don't search PATH for telinit (#7770)Mike Gilbert2018-01-132-3/+5
| | | | | | | | | | | | | | | | | | On a typical system running systemd, the telinit in PATH is very likely to be a symlink to systemctl. Setting TELINIT to this may result in an infinite recursion if telinit is called and sd_booted() == 0. This may commonly occur in a chroot environment. Bug: https://bugs.gentoo.org/642724 [zj: The path was originally hardcoded as "/lib/upstart/telinit", but was made configurable without changing the default in 4ad61fd1806dde23d2c99043b4bed91a196d2c82. Then the default was changed to `/lib/sysvinit/telinit` in abaaabf40a9891014ed4c402d7beb5a67ac256b1. Then it started being autodetected when meson support was added in 5c23128daba7236a6080383b2a5649033cfef85c. This patch restores the behaviour that was implemented in configure.ac at the time of its removal.] (cherry picked from commit 2fa645f1ccbbed95868b0f25017533c8de2bba2b)
* core: double free in bus_timer_set_transient_propertyZbigniew Jędrzejewski-Szmek2018-01-131-3/+1
| | | | | | Introduced in 3e3c5a4571d. CID #1384233. (cherry picked from commit 1330648562c6924f846b869cc40125776fcd4e04)
* run: double freeZbigniew Jędrzejewski-Szmek2018-01-131-3/+1
| | | | | | Introduced in f2b9f2c83e5b4035b22eb2f610531fce275bf55f. CID #1384218. (cherry picked from commit 1893972894c197c1ac5999f8f555749bb673c262)
* dhcp6: Fix DHCPv6 client file descriptor and event handling (#7796)Patrik Flykt2018-01-131-31/+33
| | | | | | | | | | | | | | | | Close DHCPv6 client socket file descriptor when sd_dhcp6_client_stop() is called and not when client_reset() is called. If left in client_reset(), any internal temporary stopping of the DHCPv6 client with client_stop() will call client_reset() after which the DHCPv6 client will not be able to receive any further DHCPv6 messages. Similarly, client_start() needs to enable events for the DHCPv6 socket file descriptor since a call to client_stop() will call client_reset() which will remove it from the main loop. Events should be turned off when no DHCPv6 messages are expected. (cherry picked from commit 7ac6c26a22294b3276953c635ac1e91b5d03db18)
* README: EXT4_POSIX_ACL -> EXT4_FS_POSIX_ACL (#7799)George G2018-01-131-1/+1
| | | | | | EXT4_POSIX_ACL doesn't exist. (cherry picked from commit 0ceced3d9a8150042d8e69a4fa8db4fb63ef175e)
* resolved: skip conflict notifications for DNS-SD PTR RRsDmitry Rozhkov2018-01-131-0/+4
| | | | | | | | | | | Enumerating DNS-SD PTR resource records are a special case and are supposed to have non-unique keys pointing to services of the same type running on different hosts. There's no need for them to be checked for conflicts. Thus don't check for conflicts such RRs. (cherry picked from commit cfcc8dcc86b4c18cc5885031c661c7f9ae32f781)
* resolved: fix refcounting DnsScope's conflict_queueDmitry Rozhkov2018-01-131-2/+7
| | | | | | | | | | | | | | | Refcounting for a RR's key is done separately from refcounting for the RR itself, but in dns_scope_notify_conflict() we don't do that. This may lead to a situation when a RR key put in the conflict_queue hash as a value's key gets freed upon cache reduction when it's still referenced by the hash. Thus increase refcount for the key when putting it into the hash and unreference it upon removing from the hash. Closes #6456 (cherry picked from commit 432d108c25a9705f1564d7620c38cdf890df40ba)
* fix systemd-analyze time when default.target is not reached (#7764)Boucman2018-01-131-2/+9
| | | | | | Also, better error messages. (cherry picked from commit da933f7dcfab1cc891ae0c8acd4f382935dc5e98)
* basic: detect_vm_cpuid: fix hypervisor detectionMike Gilbert2018-01-131-2/+1
| | | | | | | | | | | | | | The __get_cpuid() function only calls __cpuid() if __get_cpuid_max() returns a value that is less than or equal to the leaf value. In QEMU/KVM, I found that the special hypervisor leaf value (0x40000000U) is always larger than the value retured by __get_cpuid_max(). Avoid this problem by calling the __cpuid() macro directly once we have checked the hypervisor bit from leaf 1. Fixes: d31b0033b7743393562a2e9d3c1e74afea981c13 (cherry picked from commit 8481e3e71e704a10af0b6d53d4b015b2b8e1e16b)
* fileio: write_string_stream_ts: check for file errors immediatelyMike Gilbert2018-01-111-0/+3
| | | | (cherry picked from commit ba8b8c9e402ec9565620c7524f6ce7a70b69a51c)
* fileio: write_string_stream_ts: return errors from fputs and fputcMike Gilbert2018-01-111-2/+5
| | | | | | | | Ignoring errors from these functions may mask errors returned by the kernel. Fixes: https://github.com/systemd/systemd/issues/7744 (cherry picked from commit 94d3b60ff6ac7a29b10f16a0a651b1360627f465)
* sysctl: use raw file descriptor in sysctl_write (#7753)Mike Gilbert2018-01-111-1/+16
| | | | | | | | The kernel returns specific error codes which may be lost if we use the libc buffered io functions. Fixes: https://github.com/systemd/systemd/issues/7744 (cherry picked from commit 521251d2757295b6e9df4b51c7cb33929fbd65c4)
* basic: detect_vm_cpuid: use gcc's __get_cpuid() function (#7758)Mike Gilbert2018-01-111-30/+12
| | | | | | | | | | The __get_cpuid() function includes a safety check to ensure that executing the cpuid instruction is valid/safe. This method also works with clang. https://lists.freedesktop.org/archives/systemd-devel/2017-December/040054.html (cherry picked from commit d31b0033b7743393562a2e9d3c1e74afea981c13)
* analyze: correct help text where we take unit name argumentsLennart Poettering2018-01-111-2/+2
| | | | (cherry picked from commit bc6695ec7e602f76523342d6e211dea56d092836)
* man: systemd: fix typo (#7746)nulsoh2018-01-111-1/+1
| | | | | | Add missing _r_ for ctl-alt-del.target (cherry picked from commit 11b2dc547b32a62ad5d3148a9a79f72139ea1223)
* terminal-util: open /dev/null with O_CLOEXEC in make_stdio_null()Lennart Poettering2018-01-111-1/+1
| | | | | | | | | | | | Ultimately, O_CLOEXEC should be off in fd 0, 1, 2, but when we open /dev/null here it's unlikely to be < 0, and after dupping the fd to 0, 1, 2 we turn off O_CLOEXEC explicitly anyway. Unless we know that what we are about to open will return 0, 1 or 2 we should always set O_CLOEXEC in order to be safe to other threads forking of subprocesses at the wrong moment. (cherry picked from commit d8caff6db672ab0f2d8064c61f5ef0e8e8d288ca)
* fd-util: use close_nointr() return value instead of errnoLennart Poettering2018-01-111-9/+8
| | | | | | | Our own calls return errors in their return values, hence use that rather than errno when checking errors. (cherry picked from commit e43bc9f5266c266ff4c84018a0d5f24bd1d125e4)
* bootspec: drop ".conf" from BootEntry.filenameYu Watanabe2018-01-111-5/+13
| | | | | | | | | | | | | The boot loader systemd-boot removes ".conf" from file name of entry configs, and determine which entry is the default entry. However, bootspec, which is used by systemctl and bootctl did not remove ".conf", then sometimes bootctl marks wrong entry as default. This fixes the logic to choose the default entry in bootspec, to match the logic used in systemd-boot boot loader. Fixes #7727. (cherry picked from commit 263195c6ddcc4a29a90e90a73c3fd0fd01b494ca)
* meson: hopefully renameat2() will show up where renameat() is definedLennart Poettering2018-01-111-1/+2
| | | | | | | Should glibc add this eventually, let's try to be smart where to look for it. (cherry picked from commit 2acfd0ff439b6317f91c32f6dbb42e9ce06b8943)
* meson: look for gettid() definition where getpid() is definedLennart Poettering2018-01-111-1/+2
| | | | | | | Hopefully, should gettid() show up one day in glibc it'll show up where getpid() is defined too. (cherry picked from commit 7b961e40ee5cd5c453cad70906327ea5a11fa75e)
* meson: when pivot_root() is added one day, look for it in <unistd.h>Lennart Poettering2018-01-111-1/+2
| | | | | | | | | | | | We of course don't know in which header glibc will export pivot_root() and if it ever will. But there's a good chance they'll place it where chroot() is located, given the similarity in the operations, hence let's try our luck and look for it at the same place. If we are lucky this means we don't have to patch our code if glibc decides to expose the call one day. (cherry picked from commit 3c042add1db8948d7ed03be701fe097529785e77)
* meson: use "args" for setting _GNU_SOURCE when checking for functionsLennart Poettering2018-01-111-10/+6
| | | | | | | | | | | | | | | | This reworks how we set _GNU_SOURCE when checking for the availability of functions: 1. We set it for most of the functions we look for. After all we set it for our entire built anyway, and it's usually how Linux-specific definitions in glibc are protected these days. Given that we usually have checks for such modern stuff only anyway, let's just blanket enable it. 2. Use "args" instead of "prefix" to set the macro. This is what is suggested in the meson docs, hence let's do it. (cherry picked from commit 85db59b794d1ca7f16ea816c916bb4472958cc1b)
* meson: define _GNU_SOURCE to detect copy_file_range() (#7734)Yu Watanabe2018-01-111-1/+2
| | | | | | | | | | | Follow-up for bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f of git repository for glibc. Recently glibc added `copy_file_range()`, but to use it, `_GNU_SOURCE` needs to be defined. This adds the flag in meson.build to detect the function by meson correctly. (cherry picked from commit 0e50bfaefde2a01792f4e4bcad7e0d822c74835b)
* Add mkdir_errno_wrapper() and use instead of mkdir() in various placesZbigniew Jędrzejewski-Szmek2018-01-118-39/+49
| | | | | | | We'd pass pointers to mkdir and mkdir_label to call in various places. mkdir returns the error in errno while mkdir_label returns the error directly. (cherry picked from commit dae8b82eb9ef391e0566ba69534b5a8f140d6c88)
* systemctl: don't show vendor preset state for generated/transient units (#7711)Lennart Poettering2018-01-111-1/+2
| | | | | | | | | | | Showing the preset state for those suggests they could actually be enabled/disabled, but that concept doesn't exist for generated/transient units, hence hide this information. This came up here: https://lists.freedesktop.org/archives/systemd-devel/2017-December/040022.html (cherry picked from commit 15ce16477039f1bcdb7c9a4b3de8dc223804c2ca)
* core:socket: fix string in socket_exec_command_tableYu Watanabe2018-01-111-5/+5
| | | | (cherry picked from commit 836bb1cd4226e28839260cbbae87a85c572c119d)
* core,seccomp: fix logic to parse RestrictAddressFamilies= in dbus-execute.cYu Watanabe2018-01-111-12/+20
| | | | | | | | | | If multiple RestrictAddressFamilies= settings, some of them are whitelist and the others are blacklist, are sent to bus, then parsing result was corrupted. This fixes the parse logic, now it is the same as one used in load-fragment.c (cherry picked from commit 9ee896d5dd98ee9fba7c0ee40784a1266661cd5f)
* core,seccomp: fix logic to parse syscall filter in dbus-execute.cYu Watanabe2018-01-114-96/+102
| | | | | | | | | | If multiple SystemCallFilter= settings, some of them are whitelist and the others are blacklist, are sent to bus, then the parse result was corrupted. This fixes the parse logic, now it is the same as one used in load-fragment.c (cherry picked from commit 898748d8b97194e43f909e6edf27c100ecaad1be)