Commit graph

19288 commits

Author SHA1 Message Date
Yu Watanabe 977f65f01d sd-boot, udev: trivial condition simplifications
Reported and proposed by @dcb314.

Fixes #7656 and #7657.
2017-12-25 19:45:40 +01:00
Lennart Poettering ebe6ff658d
Merge pull request #7663 from keszybz/mkdir-return-value
util-lib: fix return value in mkdir_parents()
2017-12-24 11:59:58 +01:00
Lennart Poettering 15ce164770 systemctl: don't show vendor preset state for generated/transient units (#7711)
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
2017-12-24 08:47:24 +09:00
Lennart Poettering 7785da68e6
Merge pull request #7695 from yuwata/transient-socket
DBus-API: implement transient socket unit
2017-12-23 19:20:29 +01:00
Susant Sahani d384826f69 networkd: Add support for ipvlan L3s and flags (#7726)
This works supports to configure L3S mode and flags
such as bridge, private and vepa
2017-12-23 18:55:03 +01:00
Yu Watanabe 533f8a6771 load-fragment: simplify list insertion logic
LIST_FIND_TAIL and LIST_INSERT_AFTER can work for empty list.
2017-12-23 19:32:46 +09:00
Yu Watanabe 32048f5414 cgroup: IODeviceWeight= or friends can take device node files in /run/systemd/inaccessible/
systemd creates several device nodes in /run/systemd/inaccessible/.
This makes CGroup's settings related to IO can take device node
files in the directory.
2017-12-23 19:32:42 +09:00
Yu Watanabe 845001221d core/socket: shorten socket_fdname() 2017-12-23 19:32:40 +09:00
Yu Watanabe 827d9bf297 core/socket: dump more settings 2017-12-23 19:32:38 +09:00
Yu Watanabe 13ec20d42a dbus-cgroup: merge several blocks which operate almost same tasks 2017-12-23 19:32:36 +09:00
Yu Watanabe d6ff82d37c dbus-execute: use empty_to_null() where it can be applicable 2017-12-23 19:32:34 +09:00
Yu Watanabe d9f7305fd7 cgroup: move path checking logic to dbus-cgroup.c 2017-12-23 19:32:29 +09:00
Yu Watanabe 62b749a981 bus-unit-util: simplify bus_append_cgroup_property() 2017-12-23 19:32:27 +09:00
Yu Watanabe eae194a51b bus-unit-util: make dependency settings can take multiple units
This allows people to specify multiple units in dependency settings
e.g. `Requires=foo.service baz.service`.
2017-12-23 19:32:25 +09:00
Yu Watanabe b48e508db3 dbus-socket: move truncation check to bus_socket_set_transient_property() 2017-12-23 19:32:23 +09:00
Yu Watanabe e045e325df basic: introduce socket_protocol_{from,to}_name()
And use them where they can be applicable.
2017-12-23 19:32:04 +09:00
Yu Watanabe d59ef3e243 run: add support to create transient path and socket unit 2017-12-23 18:48:27 +09:00
Yu Watanabe 89ada3ba08 bus-unit-util: add socket unit related options
Also, split bus_append_unit_property_assignment().
2017-12-23 18:48:16 +09:00
Yu Watanabe 9c0320e7ab core: implement transient socket unit 2017-12-23 18:47:33 +09:00
Yu Watanabe 398ce0bc5a socket-util: add socket_address_type_{from,to}_string() 2017-12-23 18:46:43 +09:00
Yu Watanabe 038ed5a4b6 core/socket: add socket_port_type_from_string() 2017-12-23 18:46:16 +09:00
Yu Watanabe 836bb1cd42 core:socket: fix string in socket_exec_command_table 2017-12-23 18:45:59 +09:00
Yu Watanabe 9ee896d5dd core,seccomp: fix logic to parse RestrictAddressFamilies= in dbus-execute.c
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
2017-12-23 18:45:52 +09:00
Yu Watanabe 898748d8b9 core,seccomp: fix logic to parse syscall filter in dbus-execute.c
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
2017-12-23 18:45:32 +09:00
Mathieu Malaterre 63d00dfb64 shared/seccomp: add mmap handling for powerpc
Also remove the warning:

./src/shared/seccomp-util.c:1414:2: warning: #warning "Consider adding the right mmap() syscall definitions here!" [-Wcpp]
 #warning "Consider adding the right mmap() syscall definitions here!"
2017-12-22 15:30:03 +01:00
Yu Watanabe e1694a752f networkd: show warning on error or cast to void when error is ignored (#7716) 2017-12-21 19:07:23 +01:00
Susant Sahani 36e6e28bce Fix #7704 and #7708. (#7712)
Init rule variable iif oif and to, from

While foreign rules are added the network part is not attached.
attach manager to rules and use it in routing_policy_rule_free.
2017-12-21 21:27:45 +09:00
Zbigniew Jędrzejewski-Szmek 281bb5c110 network: fix memory leak when an netdev was skipped
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).
-------
2017-12-20 16:17:29 +01:00
Lennart Poettering 28e176cc2d
Merge pull request #7702 from keszybz/reduce-linkage
Some small cleanups and another attempt to reduce linkage of nss modules
2017-12-20 12:08:40 +01:00
Zbigniew Jędrzejewski-Szmek db7d1dcae6 sd-bus: drop check for selinux before calling getsockopt(SO_PEERSEC)
Quoting Lennart Poettering in
https://github.com/systemd/systemd/pull/6464#issuecomment-319029293:
> If the kernel allows us to query that data we should also be Ok with passing
> it on to our own caller, regardless if selinux is technically on or off...

The advantage is that this allows gcc to be smarter and reduce linkage:
(before)$ ldd build/libnss_systemd.so.2
	linux-vdso.so.1 (0x00007ffeb46ff000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f2f60da6000)
	libcap.so.2 => /lib64/libcap.so.2 (0x00007f2f60ba1000)
	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f2f60978000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2f60759000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f2f60374000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f2f61294000)
	libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f2f600f0000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f2f5feec000)
(after )$ ldd build/libnss_systemd.so.2
	linux-vdso.so.1 (0x00007ffe5f543000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f427dcaa000)
	libcap.so.2 => /lib64/libcap.so.2 (0x00007f427daa5000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f427d886000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f427d4a1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f427e196000)

Note that this only works in conjuction with the previous commit: either
of the two commits alone does not have the desired effect on linkage.

Replaces #6464.
2017-12-19 15:24:31 +01:00
Zbigniew Jędrzejewski-Szmek de2e28d87d Move selinux-related stuff from btrfs-util.c to label.c
In preparation for future changes.
2017-12-19 15:22:05 +01:00
Zbigniew Jędrzejewski-Szmek d49a7143fc machine-id-setup: use return log_error… pattern
No functional difference, but this way it's clearer that the original errno
value is returned.
2017-12-19 15:20:38 +01:00
Zbigniew Jędrzejewski-Szmek 5364c68690 bootctl: silence warning about signed/unsigned comparison 2017-12-19 15:20:37 +01:00
Yu Watanabe a51986154f timedatectl: fix status output (#7696)
Follow-up for 3ec530a189.

Fixes #7693.
2017-12-19 11:15:50 +01:00
Zbigniew Jędrzejewski-Szmek dc0a35550e cryptsetup: use uint64_t for keyfile-offset= (#7689)
On 32bit, refuse large offsets. Once https://gitlab.com/cryptsetup/cryptsetup/issues/359
is resolved, we should switch to the new api, whatever it is.

Fixes #7677.
2017-12-19 16:51:12 +09:00
Yu Watanabe e7bcff4ec4 core: move path_kill_slashes() to manager 2017-12-19 10:44:20 +09:00
Yu Watanabe 5976f1ca76 core: fix wrong validity check 2017-12-19 10:44:04 +09:00
Yu Watanabe 586290017d tree-wide: use !strv_isempty() instead of strv_length() > 0 2017-12-19 10:43:57 +09:00
Zbigniew Jędrzejewski-Szmek bf0e0a4df2 analyze: use normal bus connection for "plot" verb (#7685)
We need to connect to hostnamed, so a private bus connection is no good.
It'd be simpler to use the normal bus connection unconditionally, but
that'd mean that e.g. systemd-analyze set-log-level might not work in
emergency mode. So let's keep trying to use the private connection except
for "plot".

Fixes #7667.
2017-12-18 19:35:03 +01:00
Lennart Poettering bd8fdbcfc5
Merge pull request #7687 from hbakken/work/add-missing-features2
Kernel 3.10 compat
2017-12-18 19:29:00 +01:00
Jan Alexander Steffens aff0b1fa7b cryptsetup-generator: Don't mistake NULL input as OOM (#7688)
Since systemd v236, several Arch users complained that
systemd-cryptsetup-generator exits with an OOM error and that it
prevents the boot from continuing.

Investigating the diff of cryptsetup-generator between v235 and v236 I
noticed that create_disk allowed for the `password` and `filtered`
variables to be NULL (they're handled with `strempty()`) but not their
`*_escaped` versions, and returned OOM errors in those cases.

Fix this by checking that the input string is non-NULL before deciding
that `specifier_escape` had an OOM error.

I could not test this fix myself, but some users have reported success.

Downstream bug: https://bugs.archlinux.org/task/56733
2017-12-18 14:47:18 +01:00
Henrik Grindal Bakken ffc01f0680 missing: Add DM_DEFERRED_REMOVE
Also include missing.h in dissect-image.c to pick it up.
2017-12-18 14:15:17 +01:00
Henrik Grindal Bakken 8cbe9f06f4 missing: Define SMACK_MAGIC if it's missing 2017-12-18 14:15:17 +01:00
Henrik Grindal Bakken cacc0d7a78 nspawn: Include missing.h 2017-12-18 14:15:17 +01:00
Henrik Grindal Bakken 1381f244c8 missing: Define EFIVARFS_MAGIC if missing 2017-12-18 14:15:17 +01:00
Henrik Grindal Bakken 56766f99d9 missing: Add MAX_HANDLE_SZ 2017-12-18 14:15:10 +01:00
Henrik Grindal Bakken 80ebe5c2a4 missing: Add PR_SET_MM_{ARG,ENV}_{START,END} 2017-12-18 12:32:41 +01:00
Henrik Grindal Bakken 122b79079b missing: Add some more btrfs structs and constants 2017-12-18 11:20:41 +01:00
Henrik Grindal Bakken 895d071656 btrfs: Include missing.h in btrfs-ctree.h 2017-12-18 11:19:32 +01:00
Chris Down e16647c39d condition: Create AssertControlGroupController (#7630)
Up until now, the behaviour in systemd has (mostly) been to silently
ignore failures to action unit directives that refer to an unavailble
controller. The addition of AssertControlGroupController and its
conditional counterpart allow explicit specification of the desired
behaviour when such a situation occurs.

As for how this can happen, it is possible that a particular controller
is not available in the cgroup hierarchy. One possible reason for this
is that, in the running kernel, the controller simply doesn't exist --
for example, the CPU controller in cgroup v2 has only recently been
merged and was out of tree until then. Another possibility is that the
controller exists, but has been forcibly disabled by `cgroup_disable=`
on the kernel command line.

In future this will also support whatever comes out of issue #7624,
`DefaultXAccounting=never`, or similar.
2017-12-18 08:53:29 +01:00