1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 18:55:40 +03:00
Commit Graph

24993 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
cf73f65089 kernel-install: create the entry directory only if $BOOT/$MACHINE_ID exists
Things are currently fairly ugly in Fedora: we create $BOOT/$MACHINE_ID/$KERNEL_VERSION/,
and then 20-grub.install that is installed by grub2-common.rpm wants to remove that
directory before 50-dracut.install get a chance to run. 50-dracut.install
checks for the presence of that directory to decide where to install the
kernel. So let's make the creation of the directory conditional. Previous
commit changes bootctl install to create $BOOT/$MACHINE_ID, and this commit
makes kernel-install not create it. In effect, the entry directory will only be
created if 'bootctl install' or something else created the parent directory.

https://bugzilla.redhat.com/show_bug.cgi?id=1648907
2019-03-12 09:45:16 +01:00
Zbigniew Jędrzejewski-Szmek
341890de86 bootctl: create $BOOT/<machine-id> when installing sd-boot 2019-03-12 09:45:16 +01:00
Zbigniew Jędrzejewski-Szmek
d271c5d345 kernel-install: rename $BOOT_DIR[_ABS] to $ENTRY_DIR[_ABS]
"BOOT" is misleading, because it sounds like this refers to /boot or $BOOT,
when in fact it refers to some subdirectory. Those variable names are purely
interal, so we can change them. $BOOT_DIR_ABS was used in NEWS, but it should
not be (because it is an internal detail), so the old NEWS entry is reworded to
use "entry directory".
2019-03-12 09:45:16 +01:00
Yu Watanabe
1f682e243f udev: fix memleak in 'udevadm trigger --settle'
Fixes #11966.
2019-03-12 09:15:02 +01:00
Lennart Poettering
995cbd72b2 efivars: make sure efi_loader_entry_name_valid() is always compiled in
The string validation should always be done correctly, and not fail just
because EFI is turned off. After all an EFI loader entry name string
remains properly formatted regardless if EFI is on or off...

Fixes: #11948
2019-03-11 21:12:23 +01:00
Yu Watanabe
40769ccc73 libudev: use device_get_seqnum() and device_get_action() 2019-03-12 03:49:53 +09:00
Yu Watanabe
91bd2c349b login: use device_is_in_action() 2019-03-12 03:49:53 +09:00
Yu Watanabe
a7f95575b1 network: use device_get_action() 2019-03-12 03:49:53 +09:00
Yu Watanabe
a7395c867e core/device: use device_get_action() 2019-03-12 03:49:53 +09:00
Yu Watanabe
a12b87f59c udevadm-test: check action string earlier
The string will be checked later in device_new_from_synthetic_event(),
but let's check it earlier in parse_argv().
2019-03-12 03:49:53 +09:00
Yu Watanabe
2c18a85400 udevadm: use device_get_action() 2019-03-12 03:49:53 +09:00
Yu Watanabe
7a2093236b udev: refuse to modify SEQNUM by udev rules 2019-03-12 03:49:53 +09:00
Yu Watanabe
d4d690facd udevd: use device_get_action() and device_get_seqnum() 2019-03-12 03:49:53 +09:00
Yu Watanabe
a707c65b70 util: introduce device_for_action()
It will be used in later commits.
2019-03-12 03:49:53 +09:00
Yu Watanabe
5ebd3fc3c1 sd-device: store parsed ACTION= and SEQNUM= udev properties 2019-03-12 03:49:53 +09:00
Lennart Poettering
35d3a35e56
Merge pull request #11960 from mrc0mmand/more-fuzzers
fuzz: introduce more fuzzers
2019-03-11 18:04:22 +01:00
Clemens Gruber
c423be28a0 network: introduce TripleSampling= option in CAN section
When enabled, three samples are used to determine the value of a
received bit by majority rule.

This patch adds support for the TripleSampling= option in the [CAN]
section of .network files.
2019-03-11 17:15:47 +01:00
Zbigniew Jędrzejewski-Szmek
7054308a8d kernel-install: add --verbose
This makes it easier to see what is going on. Documentation for
--verbose and --help is added to the man page. Our plugins are updated
to also log a bit.
2019-03-11 15:49:53 +01:00
Zbigniew Jędrzejewski-Szmek
7061e4ca00 kernel-install/50-depmod: use standard header 2019-03-11 15:46:36 +01:00
Zbigniew Jędrzejewski-Szmek
0e636bf51a nspawn: fix memleak uncovered by fuzzer
Also use TAKE_PTR as appropriate.
2019-03-11 14:29:30 +01:00
Frantisek Sumsal
b5b499b32c fuzz: add nspawn-settings fuzzer 2019-03-11 14:13:00 +01:00
Frantisek Sumsal
04ddab1462 fuzz: add hostname-util fuzzer 2019-03-11 14:12:06 +01:00
Frantisek Sumsal
18d51b4509 fuzz: add env-file fuzzer 2019-03-11 14:11:28 +01:00
Yu Watanabe
3a6797f19f machinectl: do not format size if freed disk space is "-1"
Closes #11941.
2019-03-11 14:04:16 +01:00
Yu Watanabe
a289dfd69b journal-remote: do not request Content-Length if Transfer-Encoding is chunked
This fixes a bug introduced by 7fdb237f54.

Closes #11571.
2019-03-11 13:52:10 +01:00
Frantisek Sumsal
e5f274bee1 fuzz: add bus-label fuzzer 2019-03-11 13:00:32 +01:00
Yu Watanabe
0a8321d33c import: do not try to set selinux related attributes if selinux is disabled
Closes #11940.
2019-03-11 10:59:13 +01:00
Yu Watanabe
7750b79695 network: update logs 2019-03-11 08:10:50 +01:00
Lennart Poettering
4cea310fc7 execute: remove one aa profile output from context dump
The same data is output a few lines further up already, drop one.
2019-03-11 11:05:22 +09:00
Vesa Jääskeläinen
ab212633d4 Fix compilation without EFI being enabled
If EFI is disabled compilation can fail with:

../src/login/logind-dbus.c: In function ‘property_get_reboot_to_boot_loader_entry’:
../src/login/logind-dbus.c:2772:29: error: implicit declaration of function ‘efi_loader_entry_name_valid’; did you mean ‘efi_loader_get_features’? [-Werror=implicit-function-declaration]
                 } else if (!efi_loader_entry_name_valid(v)) {
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                             efi_loader_get_features
../src/login/logind-dbus.c:2772:29: warning: nested extern declaration of ‘efi_loader_entry_name_valid’ [-Wnested-externs]

This adds stub for efi_loader_entry_name_valid() to enable compilation.
2019-03-11 10:48:49 +09:00
Yu Watanabe
49942d6b1e timedate: fix emitted value when ntp client is enabled/disabled (#11951)
This fixes a regression originall caused by cf3872bd2 and
triggered by b4356b5720.

Fixes #11944
2019-03-10 20:44:21 +01:00
Yu Watanabe
b459700b98 core: simplify and check validity of paths for RequiresMountsFor=
Prompted by #11910.
2019-03-08 15:48:34 +01:00
Zbigniew Jędrzejewski-Szmek
ff19ad888d efi: wrap some long lines 2019-03-08 11:04:16 +01:00
Lennart Poettering
4ad9fb38a9 run: make sure NetworkNamespacePath= can be used on the systemd-run cmdline 2019-03-07 17:47:29 +01:00
Lennart Poettering
7619cb32f0 core: support netns joining also for sockets created by .socket unit
Similar to the cgroup magic we nowadays do when listening to sockets, to
assign them the right bpf programs, let's also do the same and join the
specified netns in the child process.

This allows people to listen in sockets in specific namespaces, or join
multiple services and socket units together to live in the same
namespace.
2019-03-07 17:47:29 +01:00
Lennart Poettering
a8d08f39d1 core: add new setting NetworkNamespacePath= for configuring a netns by path for a service
Fixes: #2741
2019-03-07 16:55:23 +01:00
Lennart Poettering
51af7fb230 core: add open_netns_path() helper
The new call allows us to open a netns from the file system, and store
it in a "storage fd pair". It's supposed to work with setup_netns() and
allows pre-population of the netns used with one opened from the file
system.
2019-03-07 16:55:23 +01:00
Lennart Poettering
da6bc6ed05 execute: no need to check for NULL when function right after does anyway 2019-03-07 16:55:19 +01:00
Lennart Poettering
44ffcbaea4 execute: (void)ify more 2019-03-07 16:53:45 +01:00
Lennart Poettering
2fa3742d96 execute: make things a tiny bit shorter 2019-03-07 16:53:45 +01:00
Lennart Poettering
8e8009dc50 execute: use structured initialization 2019-03-07 16:53:45 +01:00
Zbigniew Jędrzejewski-Szmek
ea39de2f9e systemd-analyze: support cat-config kernel/install.d
Extension of f1d9d36ac5.
2019-03-07 16:34:35 +01:00
Lennart Poettering
5468d9af77 random-seed: don't use "label" version of mkdir_parents()
We don't load the selinux label database anyway, hence this is not going
to do anything at all. Let's simplify this hence and drop the explicit
request.

Also note that today SELinux can take the filename into account when
automatically deducing the label for a new file, hence even if this code
actually would have done something it is redundant today.
2019-03-07 15:10:06 +01:00
Lennart Poettering
0c0e87fcd5 catalog: _cleanup_close_ is your friend 2019-03-07 15:10:06 +01:00
Lennart Poettering
3d477d6101 catalog: (void)ify all things 2019-03-07 15:10:06 +01:00
Lennart Poettering
5432d8a187 catalog: use structured initialization more 2019-03-07 15:10:06 +01:00
Lennart Poettering
3f1e2714a4 catalog: let's use mkdir_parents() and use same mode as tmpfiles.d for this dir
let's use mkdir_parents() (because its shorter), and 0755 as access
mode, so that things have the access mode tmpfiles.d also suggests.

Prompted by: #11903
2019-03-07 15:09:21 +01:00
Lennart Poettering
0640d48afb catalog: be a bit less aggressive with line breaking. After all 109ch is what we going for 2019-03-07 14:46:35 +01:00
Lennart Poettering
bbe804325e catalog: don't make catalog_entry_lang() clobber output params on failure
A minor fix to bring this in-line with our coding style
2019-03-07 14:46:35 +01:00
Lennart Poettering
441dc329d7
Merge pull request #11916 from yuwata/pid1-id-renaming-handling
core: handle ID_RENAMING= udev property
2019-03-07 14:42:08 +01:00
Lennart Poettering
9522200649
Merge pull request #11918 from keszybz/clang-8
Two trivial changes to build with clang 8
2019-03-07 14:41:44 +01:00
Lennart Poettering
27da7ef0d0 nspawn: move payload to sub-cgroup first, then sync cgroup trees
if we sync the legacy and unified trees before moving to the right
subcgroup then ultimately the cgroup paths in the hierarchies will be
out-of-sync... Hence, let's move the payload first, and sync then.

Addresses: https://github.com/systemd/systemd/pull/9762#issuecomment-441187979
2019-03-07 11:26:17 +01:00
Zbigniew Jędrzejewski-Szmek
2bd061a48b test-execute: avoid undefined variable warning when compiled w/o seccomp 2019-03-07 10:59:06 +01:00
Stephane Chazelas
106bf8e445 remove "." path components from required mount paths
unit_require_mounts_for may be passed path arguments that contain "."
components like for user's home directories where "." is sometimes used
to specify some form of anchor point.

This change stops considering such path as an error and removes the "."
components instead.

Closes: #11910
2019-03-07 10:12:03 +01:00
Yu Watanabe
dcee4a134c udevadm trigger: make --action option support all possible actions
This also make udevadm abort operations if invalid action is specified.
2019-03-07 15:19:02 +09:00
Yu Watanabe
08caaee0ac sd-device: move device_action_from_string() and friends to device-private.h 2019-03-07 15:18:49 +09:00
Yu Watanabe
2efa43dc4a core/device: make devices with ID_RENAMING= property be considered not ready 2019-03-07 12:54:58 +09:00
Zbigniew Jędrzejewski-Szmek
bd29f9de69 shared/bootspec: do not fail on errors when reading EFI vars
It seems that my EFI storage is corrupted. The kernel reports the file as present, but returns
an error when reading. Nevertheless, this shouldn't prevent me from reading the entry
list.

Fixes #11909.
2019-03-06 22:49:52 +01:00
Zbigniew Jędrzejewski-Szmek
1f18d94215 shared/bootspec: treat empty EFI vars as missing
We shouldn't really make any fuss about this. Also, change 'var' to 'variable'
for consistency with systemctl.c.
2019-03-06 22:45:37 +01:00
Zbigniew Jędrzejewski-Szmek
f40999f878 shared/bootspec: minor simplification 2019-03-06 22:21:34 +01:00
Lennart Poettering
c03f9cec42
Merge pull request #11898 from keszybz/meson-conv-lib
Use a convenience library for the sources shared between core/ and shutdown/
2019-03-06 10:46:18 +01:00
Lennart Poettering
13a16a2bb3 json: log about the right line number
We mean the line number in the json data, not the line number in our
C source code.

Addresses: https://github.com/systemd/systemd/pull/9762#issuecomment-441183987
2019-03-05 21:10:57 +01:00
Zbigniew Jędrzejewski-Szmek
68d923d0d0 meson: drop "_la_" from variable name
A left-over from libtool times.
2019-03-05 21:02:40 +01:00
Zbigniew Jędrzejewski-Szmek
53f79e125d meson: use a convenience library for the sources shared between core/ and the outside
This avoids double compilation. Those files are tiny, so it doesn't save time,
but we avoid repeated warnings and errors, and it's generally cleaner to it
this way.

The number of commands in 'ninja -C build clean && ninja -C build' drops from
1462 to 1455 for me.
2019-03-05 21:01:17 +01:00
Zbigniew Jędrzejewski-Szmek
3170dfe42d
Merge pull request #10495 from poettering/login-boot-hookup
add "systemctl reboot --boot-loader-menu=" and "systemctl reboot --boot-loader-entry="
2019-03-05 20:38:41 +01:00
Zbigniew Jędrzejewski-Szmek
23bdba61b1 pkgconfig: avoid double slash with split-usr configuration
By defining rootprefix= we avoid a double slash in $systemdsystemunitdir and
other variables. This fixes a regression introduced in
1c2c7c6cb3 where the variables using rootprefix=/
would start with a double slash. This should be interpreted the same, but is
certainly ugly.

The rootprefix variable was added to systemd.pc in
1c2c7c6cb3, so there is no question of backwards
compatiblity. If people try to "override" the prefix and specify
--define-variable=rootprefix=/, they will get a double slash, which should be
OK, and is the same as --define-variable=rootprefix=/something/, which also
results in a double slash somewhere in the strings.
2019-03-05 18:49:28 +01:00
Lennart Poettering
350f9518ac logind: refactor logic of returning polkit challenge result into its own function
Let's share some code.
2019-03-05 16:52:46 +01:00
Lennart Poettering
97af80c5a7 systemctl: add support for booting into boot menu/entry
(This also removes support for booting into the EFI firmware setup
without logind. That's because otherwise the non-EFI fallback logind
implements can't work.)

Fixes: #9896
2019-03-05 16:52:46 +01:00
Lennart Poettering
31b221cf5e logind: add support for booting into the boot menu or a specific boot menu entry
This behaves similar to the "boot into firmware" logic, and also allows
either direct EFI operation (which sd-boot supports and others might
support eventually too) or override through env var.
2019-03-05 16:52:46 +01:00
Lennart Poettering
eed7210a5c bootspec: validate bootpsec entry ids before we use them 2019-03-05 16:50:58 +01:00
Lennart Poettering
38bd74d67e bootspec: get rid of find_default_boot_entry() entirely
Now only two operations are left. Let's just move this into the caller,
since it should make things simpler, clearer and shorter, in particular
as there's only a single user for this.
2019-03-05 16:50:58 +01:00
Lennart Poettering
b1a8771996 bootspec: rework find_default_boot_entry() to use boot_entries_load_config_auto()
it's pretty much the same code now, hence use it.
2019-03-05 16:50:58 +01:00
Lennart Poettering
eea4ce1ec7 bootspec: introduce new helper boot_entries_load_config_auto()
It's a simple wrapper around boot_entries_load_config(), but determines
the ESP/XBOOTLDR paths automatically at first. Also, it looks for a path
/run/boot-loader-entries/ and loads the entries from there if it
exists. This is supposed to be a hook for other boot loaders to make our
tools aware of their own entries.
2019-03-05 16:50:58 +01:00
Lennart Poettering
dba33c4a2c bootspec: correct error code shown in log msg 2019-03-05 16:50:58 +01:00
Lennart Poettering
93f14ce28d bootspec: move augmentation of loader-discovered entries into bootspec.c
Previously, bootctl would show boot loader entries discovered by the
boot loader which couldn't found locally separately in the output.

Let's move this code into bootspec.c, and beef it up a bit. This way we
can use it later on for logind, and correctly show automatically
discovered windows/macos entries too.
2019-03-05 16:50:58 +01:00
Lennart Poettering
5b1da1ba6d bootspec: simplify find_default_boot_entry()
If the only caller passes NULL for the two paths, let's remove the
parameter altogether.
2019-03-05 16:50:58 +01:00
Lennart Poettering
c943e95f89 systemctl: let's FORK_WAIT where we can 2019-03-05 16:50:58 +01:00
Lennart Poettering
0f88d82979 systemctl: when something is not supported use EOPNOTSUPP 2019-03-05 16:50:58 +01:00
Lennart Poettering
78c38fe79c systemctl: be careful with boot loader entries lacking a 'linux' line
A boot loader entry might not have a 'linux' line, but an 'efi' line or
something else. Let's handle that case nicely.
2019-03-05 16:50:58 +01:00
Lennart Poettering
7800322ca5 bootspec: move log msg from systemctl.c to bootspec.c
find_default_boot_entry() is only used by systemctl.c, and currently
handles one log message in the caller instead of the callee. Let's
simplify that and move it over, too
2019-03-05 16:50:58 +01:00
Lennart Poettering
4629499e7f bootctl: tweak 'list' output a bit
Let's suppress the final newline in the list if it's the last entry we
are outputting.
2019-03-05 16:50:58 +01:00
Lennart Poettering
e667266a74 logind: optionally support non-EFI reboot-to-firmware
This extends the reboot-to-firmware logic in logind, so that other than
EFI firmwares could be theoretically support. The scheme is like this:
if you want to support this, set the $SYSTEMD_REBOOT_TO_FIRMWARE=1 env
var for logind. If so, this will override the EFI logic, and cause a
file /run/systemd/reboot-to-firmware file to be created when
reboot-to-firmware is requested. This file has no contents, it's mere
existance indicates a reboot with reboot-to-firmware set.

The idea is that for alternative firmwares a drop-in for logind is added
that sets the env var, in combination with some code run during shutdown
that checks for the file and does the right thing.
2019-03-05 16:50:58 +01:00
Lennart Poettering
3279692370 efivars: extend character set that may be used in boot loader entry ids a bit
See https://github.com/systemd/systemd/pull/10495#discussion_r233992570
2019-03-05 16:22:17 +01:00
Zbigniew Jędrzejewski-Szmek
bea3d64a73
Merge pull request #11896 from poettering/shutdown-fixes
move src/core/shutdown.c and helpers to src/shutdown/
2019-03-05 15:36:03 +01:00
Lennart Poettering
55dadc5c57 core: warn if people use the undocumented/depreacted ConditionNull=
Triggered by:

https://github.com/systemd/systemd/issues/11812
2019-03-05 13:54:20 +01:00
Franck Bui
3c37dadf62 udev: restore debug level when logging a failure in the external prog called by IMPORT{program}
It was already the case before commit a75211421f,
which upgraded the log to warning.

This seems an unintended side effect as the commit message doesn't mention it
and the old behavior looks more appropriate.
2019-03-05 13:53:25 +01:00
Lennart Poettering
9e71f5d983 shutdown: rearrange shutdown sources in source tree
Let's move the shutdown binary into its own subdirectory in
src/shutdown, after all it is relatively isolated from the normal PID 1
sources, being a different binary and all.

Unfortunately it's not possible to move some of the code, since it is
shared with PID 1, that I wished we could move, but I still think it's
worth it.
2019-03-05 12:21:17 +01:00
Lennart Poettering
3a736a3216 shutdown: (void)ify more stuff 2019-03-05 12:21:17 +01:00
Lennart Poettering
66034f9c07 shutdown: fix up return type of sync_making_progress()
We shouldn't return negative errnos as "bool", hence fix the type of the
function to "int".
2019-03-05 12:21:17 +01:00
Lennart Poettering
73622e02fb
Merge pull request #11881 from yuwata/networkd-vs-interface-renaming
Networkd vs interface renaming
2019-03-05 10:05:57 +01:00
Yu Watanabe
39a15c8a8d udev: run programs in the specified order
This fixes bugs introduced by 29448498c7
and d838e14515.

Previously, RUN and SECLABEL keys are stored in udev_list with its unique
flag is false. If the flag is false, then udev_list is just a linked
list and new entries are always added in the last.
So, we should use OrderedHashmap instead of Hashmap.

Fixes #11368.
2019-03-05 09:27:29 +01:00
Yu Watanabe
23041689ca dhcp: refuse to configure DHCP IAID if the interface is under renaming
systemd-networkd itself does not start dhcp client, but the code
may be used in other projects. So, check that the interface is under
renaming or not.
2019-03-05 12:48:26 +09:00
Yu Watanabe
299ad32d48 network: do not configure interfaces under renaming 2019-03-05 10:33:42 +09:00
Yu Watanabe
90ba130f00 util: introduce device_is_renaming()
It will be used in the later commit.
2019-03-05 10:33:41 +09:00
Yu Watanabe
30de2b89d1 network: always drop configs when interface is renamed
Before the renaming, wrong .network file may be assigned to the link.
So, let's always drop link configuration.
2019-03-05 10:33:27 +09:00
Yu Watanabe
a4055a608e udev: set ID_RENAMING property when interface renaming is requested
And drop the property on the corresponding 'move' uevent.
2019-03-05 10:31:35 +09:00
Yu Watanabe
6d0fdf4513 udev: do not read UdevEvent object before checking it is non-NULL 2019-03-05 10:31:20 +09:00
Yu Watanabe
589384be8d udev: drop unnecessary copy of new interface name 2019-03-05 10:02:09 +09:00
Yu Watanabe
4d64309955 netlink: check new interface name is valid or not before sending request 2019-03-05 10:02:09 +09:00
Lennart Poettering
bb5e88a226
Merge pull request #11841 from keszybz/dns-packet-speedup
DNS packet speedup
2019-03-04 19:30:23 +01:00
Lennart Poettering
1788875576
Merge pull request #11871 from yuwata/systemctl-show-format-unprintable
systemctl: format many entries in 'show' command
2019-03-04 19:04:27 +01:00
Lennart Poettering
38ba8c8874
Merge pull request #11888 from keszybz/non-atomic
Drop unused atomic operations
2019-03-04 19:03:46 +01:00
Zbigniew Jędrzejewski-Szmek
dffb827772 resolved: when adding RR to an answer, avoid comparing keys twice
We'd call dns_resource_record_equal(), which calls dns_resource_key_equal()
internally, and then dns_resource_key_equal() a second time. Let's be
a bit smarter, and call dns_resource_key_equal() only once.

(before)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=275
dns_resource_key_equal_count=62371
4.13s user 0.01s system 99% cpu 4.153 total

(after)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=276
dns_resource_key_equal_count=31337
2.13s user 0.01s system 99% cpu 2.139 total
2019-03-04 15:53:37 +01:00
Zbigniew Jędrzejewski-Szmek
51969a5893 resolve: split the RR comparison function in two
No functional change.
2019-03-04 15:53:37 +01:00
Zbigniew Jędrzejewski-Szmek
2d34cf0c16 resolved: use a temporary Set to speed up dns question parsing
This doesn't necessarily make things faster, because we still spend more time
in dns_answer_add(), but it improves the compuational complexity of this part.
If we even make dns_resource_key_equal_faster, this will become worthwhile.
2019-03-04 15:53:37 +01:00
Yu Watanabe
305a285092 systemctl: format LogExtraFields= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe
4c787df72f systemctl: format BindPaths= or TemporaryFileSystems= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe
04749e4003 systemctl: print RestrictAddressFamilies= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe
48d3358db1 systemctl: show nothing if no LoadError= 2019-03-04 23:45:07 +09:00
Yu Watanabe
56c6b69007 systemctl: format IPIngressBytes= or friends nicely 2019-03-04 23:45:07 +09:00
Yu Watanabe
9c1f946566 systemctl: show IPAddressAllow= and IPAddressDeny= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe
9201eea137 test: add tests for test_in_addr_prefix_to_string() 2019-03-04 23:45:07 +09:00
Yu Watanabe
146cf7f05b test: move tests for in_addr_prefix_from_string() 2019-03-04 23:45:07 +09:00
Yu Watanabe
d9143dac3e util: introduce in_addr_prefix_to_string() 2019-03-04 23:45:07 +09:00
Yu Watanabe
81260be12e util: use _cleanup_ attributes 2019-03-04 23:45:07 +09:00
Yu Watanabe
a672f4fe8d core: fix received size of signal or status size
sd_bus_message_read_array() returns size of array in bytes, not number
of elements.

This also convert int to int32_t, as the dbus type 'i' is int32_t.
2019-03-04 23:44:29 +09:00
Zbigniew Jędrzejewski-Szmek
756479043d sd-hwdb: fix off_t vs. size_t confusion in cast
> on 32bit, size_t is 32bit, but .st_size is off_t hence 64bit
2019-03-04 15:42:58 +01:00
Yu Watanabe
4a22071201 systemctl: show SuccessExitStatus= and friends 2019-03-04 23:35:56 +09:00
Yu Watanabe
8e066ef316 systemctl: use streq() if arguments must be non-NULL 2019-03-04 23:35:56 +09:00
Yu Watanabe
a3ddd4571d systemctl: do not show negative values in {Success,Failure}ActionExitStatus= 2019-03-04 23:35:56 +09:00
Yu Watanabe
102b021460 bus-util: drop unnecessary re-formatting 2019-03-04 23:35:46 +09:00
INSUN PYO
c7bb2fec78 systemctl: show SELinuxContext=, AppArmorProfile= and SmackProcessLabel=
Run: systemctl show -a dbus.service | grep -E "SELinuxContext|AppArmorProfile|SmackProcessLabel"

Before patch:
  SELinuxContext=[unprintable]
  AppArmorProfile=[unprintable]
  SmackProcessLabel=[unprintable]

After patch:
  SELinuxContext=[""|"value of context"]
  AppArmorProfile=[""|"value of context"]
  SmackProcessLabel=[""|"value of context"]
2019-03-04 15:27:30 +01:00
Davide Cavalca
4d97f5a09e test: do not assume test-chown-rec is running as root 2019-03-04 14:40:17 +01:00
Zbigniew Jędrzejewski-Szmek
311b63fef8 Remove now-unused refcnt.h 2019-03-04 14:16:39 +01:00
Zbigniew Jędrzejewski-Szmek
f23ab4dc3c sd-netlink: do not use atomic reference counters
Same as with the other users, any non-trivial use of the objects requires
use from a single thread only or external locking. Using atomic operations
just for reference counts is not useful.
2019-03-04 14:16:39 +01:00
Zbigniew Jędrzejewski-Szmek
af40711050 sd-hwdb: some minor logging and style updates 2019-03-04 14:16:39 +01:00
Zbigniew Jędrzejewski-Szmek
468905cac8 sd-hwdb: use non-atomic reference counters
The sd-hwdb objects cannot be used concurrently from two threads in any
meaningful way, because query and iteration operations modify the object.
Thus atomic reference counts are pointless.
2019-03-04 14:16:39 +01:00
Zbigniew Jędrzejewski-Szmek
42541a71a2 bus: make reference counting non-atomic
We had atomic counters, but all other operations were non-serialized. This
means that concurrent access to the bus object was only safe if _all_ threads
were doing read-only access. Even sending of messages from threads would not be
possible, because after sending of the message we usually want to remove it
from the send queue in the bus object, which would race. Let's just kill this.
2019-03-04 14:16:24 +01:00
Zbigniew Jędrzejewski-Szmek
f68a26221c tests: use the test helpers in more places
This is mostly cosmetic. It makes those test binaries support SYSTEMD_LOG_*
environment variables.
2019-03-04 14:15:38 +01:00
Lennart Poettering
46d4d67d79
Merge pull request #11820 from dm0-/chase
Allow tmpfiles to create files in a root under an unprivileged directory
2019-03-04 13:04:45 +01:00
Lennart Poettering
d8a23f5e4f
Merge pull request #11770 from yuwata/fix-9955
network: rework address pool
2019-03-04 12:11:07 +01:00
Mike Lothian
17f377efd0 login: HyperV requires master-of-seat to be set
v2: Update comment provided by Lennart

Fixes: https://github.com/systemd/systemd/issues/11299
2019-03-04 12:04:53 +01:00
Yu Watanabe
55ac7b6314 fuzz-dhcp6-client: avoid assertion failure on samples which dont fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11584.
2019-03-04 12:04:09 +01:00
Yu Watanabe
59c1546b45 test: add tests for log_syntax() 2019-03-04 15:28:32 +09:00
Yu Watanabe
ee96382fdb log: make log_syntax() assign correct errno and show valid error cause 2019-03-04 15:18:06 +09:00
Zbigniew Jędrzejewski-Szmek
bdc8f36bfb
Merge pull request #11472 from poettering/sd-bus-ref-tweak
try harder to detect when a bus and its queued messages are fully unreffed and free everything then
2019-03-01 17:52:57 +01:00
Lennart Poettering
d3f3df6199 btrfs: when falling back to plain copy when snapshoting exclude submounts
The subvol snapshot logic doesn't cover sub-mounts either, and it really
shouldn't in the general case, hence let's simply stop at submounts in
all cases, both in the main and in the fall-back codepath.

As discussed here:

https://github.com/systemd/systemd/pull/11243#pullrequestreview-209477230
2019-03-01 16:22:36 +01:00
Zbigniew Jędrzejewski-Szmek
cc5fc36aec
Merge pull request #11243 from poettering/nspawn-root-overlay
add systemd-nspawn --volatile=overlay support, as well as the same for host systems
2019-03-01 16:08:55 +01:00
Lennart Poettering
4b70aedc4a test: add test for new sd-bus refcnt logic 2019-03-01 15:37:39 +01:00
Lennart Poettering
c1757a70ea sd-bus: use "queue" message references for managing r/w message queues in connection objects
Let's make use of the new concept the previous commit added.

See: #4846
2019-03-01 15:37:39 +01:00
Lennart Poettering
1b3f9dd759 bus-message: introduce two kinds of references to bus messages
Before this commit bus messages had a single reference count: when it
reached zero the message would be freed. This simple approach meant a
cyclic dependency was typically seen: a message that was enqueued in a
bus connection object would reference the bus connection object but also
itself be referenced by the bus connection object. So far out strategy
to avoid cases like this was: make sure to process the bus connection
regularly so that messages don#t stay queued, and at exit flush/close
the connection so that the message queued would be emptied, and thus the
cyclic dependencies resolved. Im many cases this isn't done properly
however.

With this change, let's address the issue more systematically: let's
break the reference cycle. Specifically, there are now two types of
references to a bus message:

1. A regular one, which keeps both the message and the bus object it is
   associated with pinned.

2. A "queue" reference, which is weaker: it pins the message, but not
   the bus object it is associated with.

The idea is then that regular user handling uses regular references, but
when a message is enqueued on its connection, then this takes a "queue"
reference instead. This then means that a queued message doesn't imply
the connection itself remains pinned, only regular references to the
connection or a message associated with it do. Thus, if we end up in the
situation where a user allocates a bus and a message and enqueues the
latter in the former and drops all refs to both, then this will detect
this case and free both.

Note that this scheme isn't perfect, it only covers references between
messages and the busses they are associated with. If OTOH a bus message
is enqueued on a different bus than it is associated with cyclic deps
cannot be recognized with this simple algorithm, and thus if you enqueue
a message associated with a bus A on a bus B, and another message
associated with bus B on a bus A, a cyclic ref will be in effect and not
be discovered. However, given that this is an exotic case (though one
that happens, consider systemd-bus-stdio-bridge), it should be OK not to
cover with this, and people have to explicit flush all queues on exit in
that case.

Note that this commit only establishes the separate reference counters
per message. A follow-up commit will start making use of this from the
bus connection object.
2019-03-01 15:37:39 +01:00
Lennart Poettering
b41812d1e3 sd-bus: always go through sd_bus_unref() to free messages
Don't try to be smart, don't bypass the ref counting logic if there's no
real reason to.

This matters if we want to tweak the ref counting logic later.
2019-03-01 15:19:45 +01:00
Lennart Poettering
39feb2ce41 sd-bus: drop two inappropriate empty lines 2019-03-01 15:19:45 +01:00
Lennart Poettering
c0bc4ec5cc sd-bus: make sure dispatch_rqueue() initializes return parameter on all types of success
Let's make sure our own code follows coding style and initializes all
return values on all types of success (and leaves it uninitialized in
all types of failure).
2019-03-01 15:19:45 +01:00
Lennart Poettering
e593b6a87a sd-bus: reorder bus ref and bus message ref handling
Let's always place handling of these references together, so that all
reference counting during allocation is at a single place.
2019-03-01 15:19:45 +01:00
Lennart Poettering
143d4e045a sd-bus: make rqueue/wqueue sizes of type size_t
Let's do this like we usually do and size arrays with size_t.

We already do this for the "allocated" counter correctly, and externally
we expose the queue sizes as uint64_t anyway, hence there's really no
point in usigned "unsigned" internally.
2019-03-01 15:19:45 +01:00
Lennart Poettering
2fe9a10d76 sd-bus: initialize mutex after we allocated the wqueue
That way the mutex doesn't have to be destroyed when we exit early due
to OOM.
2019-03-01 15:19:45 +01:00
Lennart Poettering
8f37636d91 test: fix indenting off by one 2019-03-01 15:19:45 +01:00
Lennart Poettering
adc6f43b14 copy: don't synthesize a 'user.crtime_usec' xattr on copy unless explicitly requested
Previously, when we'd copy an individual file we'd synthesize a
user.crtime_usec xattr with the source's creation time if we can
determine it. As the creation/birth time was until recently not
queriable form userspace this effectively just propagated the same xattr
on the source to the same xattr on the destination. However, current
kernels now allow to query the birthtime using statx() and we do make
use of that now. Which means that suddenly we started synthesizing these
xattrs much more regularly.

Doing this actually does make sense, but only in very few cases:
not for the typical regular files we copy, but certainly when dealing
with disk images. Hence, let's keep this kind of propagation, but let's
make it a flag and default to off. Then turn it on whenever we deal with
disk images, and leave it off otherwise.

This is particularly relevant as overlayfs combining a real fs, and a
tmpfs on top will result in EOPNOTSUPP when it is attempted to open a
file with xattrs for writing, as tmpfs does not support xattrs, and
hence the copy-up cannot work. Hence, let's avoid synthesizing this
needlessly, to increase compat with overlayfs.
2019-03-01 14:11:07 +01:00
Lennart Poettering
2bef2582a1 gpt-auto-generator: use new /run/systemd/volatile-root symlink as fallback when we otherwise cannot determine root device node 2019-03-01 14:11:07 +01:00