Zbigniew Jędrzejewski-Szmek [Thu, 5 Apr 2018 11:20:38 +0000 (13:20 +0200)]
Merge pull request #8662 from poettering/rfkill-enxio
handle ENODEV and ENXIO gracefully in rfkill
David Tardon [Thu, 5 Apr 2018 11:06:59 +0000 (13:06 +0200)]
journald: bump rate limits (#8660)
Apparently, it is quite common to hit a problem, where systemd-journald
would drop messages because service is logging too fast.
Lennart Poettering [Thu, 5 Apr 2018 10:43:08 +0000 (12:43 +0200)]
rfkill: treat ENXIO/ENODEV the same way as ENOENT
If an rfkill device disappears between the time we get notified about
the existance and we fully opened it we might get ENXIO or ENODEV (i.e.
the two kinds of "device not found" errors, which are typically
generated when for example a device node has no actual backing device
behind it). let's handle that the same way as ENOENT, and downgrade the
log message to LOG_DEBUG.
Fixes: #8586
Lennart Poettering [Thu, 5 Apr 2018 10:42:47 +0000 (12:42 +0200)]
rfkill: use our usual style for writing destructors
Let's accept NULL values gracefully, and let's return NULL.
Lennart Poettering [Thu, 5 Apr 2018 09:54:02 +0000 (11:54 +0200)]
Merge pull request #8617 from keszybz/tmpfiles-relax
Do not exit with error when systemd-tmpfiles --boot fails
Lennart Poettering [Thu, 5 Apr 2018 08:19:12 +0000 (10:19 +0200)]
Merge pull request #8656 from yuwata/random-fixes
use TAKE_PTR() and TAKE_FD() macros, and small fixes
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 14:37:21 +0000 (16:37 +0200)]
tmpfiles: ignore "operational" errors during setup
We still get the errors logged, but we don't fail the service. This
is better for users because rerunning tmpfiles-setup.service a second
time is dangerous (c.f.
cd9f5b68ce08375eb1d68a4ddaa7a24a5092d7ba).
Note that this only touches sd-tmpfiles-setup.service and
sd-tmpfiles-setup-dev.service. sd-tmpfiles-clean.service is as before.
https://bugzilla.redhat.com/show_bug.cgi?id=1539341
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 14:19:33 +0000 (16:19 +0200)]
tmpfiles: add a new return code for "operational failure" when processing
Things can fail, and we have no control over it:
- file system issues (immutable bits, file system errors, MAC refusals, etc)
- kernel refusing certain arguments when writing to /proc/sys or /sys
Let's add a new code for the case where we parsed configuration but failed
to execute it because of external errors.
Yu Watanabe [Thu, 5 Apr 2018 05:24:59 +0000 (14:24 +0900)]
core/device: trivial simplification
Yu Watanabe [Thu, 5 Apr 2018 05:26:26 +0000 (14:26 +0900)]
tree-wide: use TAKE_PTR() and TAKE_FD() macros
Yu Watanabe [Wed, 4 Apr 2018 15:33:22 +0000 (00:33 +0900)]
network: fix typo in log message
Yu Watanabe [Tue, 3 Apr 2018 07:19:25 +0000 (16:19 +0900)]
meson: sort source files
Yu Watanabe [Thu, 29 Mar 2018 12:20:30 +0000 (21:20 +0900)]
bus-util: fix a meaningless assertion
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 09:52:14 +0000 (11:52 +0200)]
Merge pull request #8605 from poettering/drop-in-name-fix
Fix validation of unit file drop-in naming in install.c.
Filipe Brandenburger [Wed, 4 Apr 2018 09:17:19 +0000 (02:17 -0700)]
test-path: Set umask explicitly (#8616)
Running `test-path` under an umask such as 027 fails with:
Assertion '(s.st_mode & S_IRWXO) == 0004' failed at ../src/test/test-path.c:247, function test_path_makedirectory_directorymode(). Aborting.
Looking at directory /tmp/test-path_makedirectory, it was indeed created
with mode 0740, applying the umask to the requested 0744.
Set an explicit umask for this test, to ensure reproducible results.
Filipe Brandenburger [Wed, 4 Apr 2018 09:14:37 +0000 (02:14 -0700)]
units: use `systemctl exit` to kill the user manager (#8648)
Use `systemctl --user --force exit` to implement the systemd-exit
user service.
This removes our dependence on an external `kill` binary and the
concerns about whether they recognize SIGRTMIN+n by name or what their
interpretation of SIGRTMIN is.
Tested: `systemctl --user start systemd-exit.service` kills the
`systemd --user` instance for my user.
Feng Sun [Wed, 4 Apr 2018 09:10:42 +0000 (17:10 +0800)]
fix missed bracket of exec-personality-ppc64le.service (#8650)
Signed-off-by: Neil Sun <neilsun@yunify.com>
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 07:39:10 +0000 (09:39 +0200)]
Merge pull request #8624 from yuwata/fix-8371
bash-completion: fixes for busctl
Filipe Brandenburger [Wed, 4 Apr 2018 07:32:59 +0000 (00:32 -0700)]
oss-fuzz: Fallback to `ninja-build` when available (#8641)
The ninja binary is deployed as `ninja-build` in older distros such as
RHEL 7/CentOS 7. Detect that and use `ninja-build` instead of `ninja`
when it's available.
Evgeny Vereshchagin [Tue, 3 Apr 2018 23:13:05 +0000 (02:13 +0300)]
Merge pull request #8643 from poettering/coding-style-fixlets
Trivial CODING_STYLE additions
Lennart Poettering [Thu, 29 Mar 2018 14:28:21 +0000 (16:28 +0200)]
CODING_STYLE: document suggested suffixes to use in documentation
Lennart Poettering [Thu, 29 Mar 2018 14:28:00 +0000 (16:28 +0200)]
CODING_STYLE: two minor additions
Lennart Poettering [Thu, 29 Mar 2018 14:27:45 +0000 (16:27 +0200)]
CODING_STYLE: mention that we ship .editconfig/.vimrc/.dir-locals.el in our repo
Lennart Poettering [Thu, 29 Mar 2018 15:47:03 +0000 (17:47 +0200)]
update TODO
Ricardo Salveti de Araujo [Tue, 3 Apr 2018 13:05:11 +0000 (10:05 -0300)]
tmpfiles: fix directory removal with force symlink (#8619)
symlink_atomic returns -EISDIR when the target symlink path is a
directory.
Fixes #7447
Signed-off-by: Ricardo Salveti <ricardo@opensourcefoundries.com>
Evgeny Vereshchagin [Tue, 3 Apr 2018 13:04:22 +0000 (16:04 +0300)]
core: skip the removal of cgroups in the TEST_RUN_MINIMAL mode (#8622)
When `systemd` is run in the TEST_RUN_MINIMAL mode, it doesn't really
set up cgroups, so it shouldn't try to remove anything.
Closes https://github.com/systemd/systemd/issues/8474.
João Paulo Rechi Vita [Tue, 3 Apr 2018 12:51:18 +0000 (05:51 -0700)]
dissect: Don't count RPMB and boot partitions (#8609)
Filter-out RPMB partitions and boot partitions from MMC devices when
counting partitions enumerated by the kernel. Also factor out the now
duplicated code into a separate function.
This complement the previous fixes to the problem reported in
https://github.com/systemd/systemd/issues/5806
Lennart Poettering [Tue, 3 Apr 2018 12:49:39 +0000 (14:49 +0200)]
Merge pull request #8628 from jwrdegoede/hwdb-sensors2
Hwdb sensors2
Radostin Stoyanov [Tue, 3 Apr 2018 03:06:53 +0000 (04:06 +0100)]
man: machinectl: update fedora exmple URL (#8642)
Alexander Kurtz [Mon, 2 Apr 2018 14:30:26 +0000 (16:30 +0200)]
coccinelle: fix typo in file name (#8640)
Lennart Poettering [Sat, 31 Mar 2018 10:56:58 +0000 (12:56 +0200)]
Merge pull request #8626 from floppym/initctl
sysvinit-2.89 compatibility fixes
Will Dietz [Sat, 31 Mar 2018 10:55:45 +0000 (05:55 -0500)]
generate-af-list.sh: slightly generalize pattern, fix w/musl (#8629)
Accept definitions to other AF_ constants, not just PF_ ones,
such as:
#define AF_LINUX AF_LOCAL
It may not be necessary to impose any restriction on the
definitions of the macros extracted, but for now
keep most of that requirement but match AF_* as well.
Hans de Goede [Fri, 30 Mar 2018 21:39:29 +0000 (23:39 +0200)]
hwdb: Add accelerometer orientation quirk for the Pipo W4 tablet
Add an accelerometer orientation quirk for the Pipo W4 tablet.
Mike Gilbert [Fri, 30 Mar 2018 15:04:57 +0000 (11:04 -0400)]
systemctl: try opening /run/initctl before /dev/initctl
This ensures compatability with old/new sysvinit.
http://git.savannah.nongnu.org/cgit/sysvinit.git/commit/?id=
80dbcf3de3c1b83aeaa713a8fe5b8d35d8649af2
Mike Gilbert [Fri, 30 Mar 2018 15:00:17 +0000 (11:00 -0400)]
units: initctl: move the fifo to /run/initctl to match sysvinit
The fifo location was moved in sysvinit-2.89.
http://git.savannah.nongnu.org/cgit/sysvinit.git/commit/?id=
80dbcf3de3c1b83aeaa713a8fe5b8d35d8649af2
Hans de Goede [Fri, 30 Mar 2018 18:00:27 +0000 (20:00 +0200)]
hwdb: Add accelerometer orientation quirk for the Lenovo Ideapad Miix 310
Add an accelerometer orientation quirk for the Lenovo Ideapad Miix 310.
Note this quirk is limited to the production batches which ship with a
portrait panel, rather then with a landscape panel (recognized by the
different BIOS version these 2 variants use).
Hans de Goede [Fri, 30 Mar 2018 15:10:21 +0000 (17:10 +0200)]
hwdb: Add accelerometer orientation quirk for the MSI S100 2-in-1
Add an accelerometer orientation quirk for the MSI S100 2-in-1.
Hans de Goede [Fri, 9 Mar 2018 13:55:11 +0000 (14:55 +0100)]
hwdb: Add accelerometer orientation quirk for the Yours Y8W81 tablet
Add an accelerometer orientation quirk for the Yours Y8W81 8" tablet.
For future reference: this tablet has the same case and mostly the same
internals as the Chuwi Vi8. Both seem to be from an ODM called inet-tek.
Both are labelled: "INET-I86M-REVxx" on the PCB, with the Chuwi Vi8 being
REV03 (and having a ALC5640 audio codec) and the Yours Y8W81 being REV21
(and having a ALC5651 audio codec).
Hans de Goede [Sun, 18 Feb 2018 20:42:43 +0000 (21:42 +0100)]
hwdb: Add accelerometer orientation entry for the I.T.Works TW701 tablet
Add accelerometer orientation entry for the I.T.Works TW701 7"
windows tablet, note this is the same hardware/PCB as the Trekstor
ST70416-6 for which we already have the same quirk.
Hans de Goede [Fri, 9 Mar 2018 13:50:04 +0000 (14:50 +0100)]
hwdb: 60-sensors: Fix alphabetic sorting by vendor name
The Cytrix entry was added at the end instead of sorted alphabetically
by vendor name.
Yu Watanabe [Fri, 30 Mar 2018 08:13:52 +0000 (17:13 +0900)]
bash-completion: busctl: make variables local
Yu Watanabe [Fri, 30 Mar 2018 08:08:11 +0000 (17:08 +0900)]
bash-completion: busctl: do not suggest "-" for signature
Fixes #8371.
Yu Watanabe [Fri, 30 Mar 2018 08:06:50 +0000 (17:06 +0900)]
bash-completion: busctl: suggests only writable properties for set-property
Yu Watanabe [Thu, 29 Mar 2018 14:15:56 +0000 (23:15 +0900)]
timesync: on network event do not establish connection when NTP servers are not changed (#8611)
Fixes #8603.
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 14:14:11 +0000 (16:14 +0200)]
sd-bus: allow description to be set for system/user busses (#8594)
sd_bus_open/sd_bus_open_system/sd_bus_open_user are convenient, but
don't allow the description to be set. After they return, the bus is
is already started, and sd_bus_set_description() fails with -EBUSY.
It would be possible to allow sd_bus_set_description() to update the
description "live", but messages are already emitted from sd_bus_open
functions, so it's better to allow the description to be set in
sd_bus_open/sd_bus_open_system/sd_bus_open_user.
Fixes message like:
Bus n/a: changing state UNSET → OPENING
Lennart Poettering [Thu, 29 Mar 2018 13:36:07 +0000 (15:36 +0200)]
bus-unit-util: one less newline
Lennart Poettering [Wed, 28 Mar 2018 14:44:19 +0000 (16:44 +0200)]
install: don't enforce that .d/ dropin files (and their symlink chain elements) for units must have names that qualify as unit names
The names of drop-in files can be anything as long as they are suffixed
in ".conf", hence don't be stricter than necessary when validating the
names used in symlink chains of such drop-in files.
Also, drop-in files should not be ale to change the type of unit file
itself, i.e. not affect whether it is considered masked or an alias as a
whole.
This adds a flag SEARCH_DROPIN that is passed whenever we load a drop-in
rather the main unit file, and in that case loosen checks and behaviour
we otherwise enforce for the unit file itself. Specifically:
1. If SEARCH_DROPIN is passed we won't change the unit's info->type
field anymore, as that field (which can be REGULAR, MASKED, SYMLINK)
should not be affected by drop-ins, but only by the unit file itself.
2. If SEARCH_DROPIN is passed we will shortcut following of symlink
chains, and not validate the naming of each element in the chain,
since that's irrelevant for drop-ins, and only matters for the unit
file itself.
Or in other words, without this:
1. A symlink /etc/systemd/system/foobar.service.d/20-quux.conf →
/dev/null might have caused the whole of foobar.service to be
considered "masked".
2. A symlink /etc/systemd/system/foobar.service.d/20-quux.conf →
/tmp/miepf might have caused the whole loading of foobar.service to
fail as EINVAL, as "miepf" is not a valid unit name.
Lennart Poettering [Mon, 26 Mar 2018 14:34:54 +0000 (16:34 +0200)]
fs-util: add shortcut for chase_symlinks() when it is called like open(O_PATH)
Let's optimize things, and let the kernel chase the paths if none of the
features chase_symlinks() offers are actually used.
Lennart Poettering [Mon, 26 Mar 2018 17:22:16 +0000 (19:22 +0200)]
dissect: port code to chase_symlinks_and_open()
Lennart Poettering [Mon, 26 Mar 2018 12:15:43 +0000 (14:15 +0200)]
fs-util: add calls that combine chase_symlinks() and open()/opendir() in one
This is useful when opening files within disk images, as we'll then take
the relative root directory properly into account.
Lennart Poettering [Mon, 26 Mar 2018 11:25:51 +0000 (13:25 +0200)]
fd-util: introduce fd_reopen() helper for reopening an fd
We have the same code for this in place at various locations, let's
unify that. Also, let's repurpose test-fs-util.c as a test for this new
helper cal..
Yu Watanabe [Thu, 29 Mar 2018 10:50:50 +0000 (19:50 +0900)]
tree-wide: remove unused variables (#8612)
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 10:30:18 +0000 (12:30 +0200)]
Merge pull request #8606 from dell/rename-suspend-to-hibernate
Rename suspend-to-hibernate to suspend-then-hibernate
Yu Watanabe [Thu, 29 Mar 2018 04:24:11 +0000 (13:24 +0900)]
Merge pull request #8607 from poettering/trivialities2
tiny, trivial, unrelated fixes
Evgeny Vereshchagin [Thu, 29 Mar 2018 04:20:57 +0000 (07:20 +0300)]
tests: run `udevadm settle` after `sfdisk` (#8610)
This makes the script wait for the newly created partition to
show up before trying to put a filesystem on it, which should
prevent the tests from failing with the following error:
```
New situation:
Disklabel type: dos
Disk identifier: 0x3541a0ec
Device Boot Start End Sectors Size Id Type
/dev/loop6p1 2048 800767 798720 390M 83 Linux
/dev/loop6p2 800768 819199 18432 9M 83 Linux
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
The file /dev/loop6p1 does not exist and no size was specified.
make: *** [setup] Error 1
F: Failed to mkfs -t ext4
Makefile:4: recipe for target 'setup' failed
```
Mario Limonciello [Wed, 28 Mar 2018 20:13:49 +0000 (15:13 -0500)]
Fix description on suspend-then-hibernate units.
Suspend; Idle into hibernate didn't make sense.
Mario Limonciello [Wed, 28 Mar 2018 16:00:06 +0000 (11:00 -0500)]
Rename suspend-to-hibernate to suspend-then-hibernate
Per some discussion with Gnome folks, they would prefer this name
as it's more descriptive of what's happening.
Lennart Poettering [Wed, 28 Mar 2018 15:07:42 +0000 (17:07 +0200)]
machine-image,mount-setup: minor coding style fixes
Lennart Poettering [Wed, 28 Mar 2018 15:07:11 +0000 (17:07 +0200)]
man: remove spurious 'system'
Lennart Poettering [Tue, 27 Mar 2018 12:58:21 +0000 (14:58 +0200)]
inhibit: make use of EXIT_SUCCESS where appropriate
Lennart Poettering [Tue, 27 Mar 2018 12:56:04 +0000 (14:56 +0200)]
util: check for overflows in xbsearch_r()
Lennart Poettering [Mon, 26 Mar 2018 11:27:26 +0000 (13:27 +0200)]
journald: make use of fd_get_path() where appropriate
Lennart Poettering [Tue, 20 Mar 2018 19:26:15 +0000 (20:26 +0100)]
update TODO
Lennart Poettering [Fri, 9 Mar 2018 20:35:48 +0000 (21:35 +0100)]
CODING_STYLE: document why O_NONBLOCK makes sense when opening regular files, too
Christian Hesse [Wed, 28 Mar 2018 19:58:10 +0000 (21:58 +0200)]
systemd-inhibit: ignore signal interrupt from keyboard (#8569)
By default both processes, systemd-inhibit and the forked one, receive
the signals. Pressing Ctrl+C on the keyboard results in SIGINT being
sent to the processes, followed by SIGTERM being sent to the forked
process when systemd-inhibit exits. This can cause trouble when the
forked process does not clean up properly but exit immediately.
Instead make systemd-inhibit ignore SIGINT, leaving it to the forked
process to clean up and exit.
Lennart Poettering [Wed, 28 Mar 2018 14:58:37 +0000 (16:58 +0200)]
doc: merge docs/ dir → doc/
It's weird having two subdirs for documentation, let's unify this in
one.
Zbigniew Jędrzejewski-Szmek [Wed, 28 Mar 2018 15:25:04 +0000 (17:25 +0200)]
systemctl: refuse to edit masked units (#8602)
Note: in check_triggering_units 'path' will be allocated twice. This is a
conscious choice, this way the implementation is simpler and not worth
optimizing.
Fixes #8519.
Yu Watanabe [Wed, 28 Mar 2018 11:37:27 +0000 (20:37 +0900)]
bus-util: add flags for bus_map_all_properties() (#8546)
This adds flags BUS_MAP_STRDUP and BUS_MAP_BOOLEAN_AS_BOOL.
If BUS_MAP_STRDUP is set, then each "s" message is duplicated.
If BUS_MAP_BOOLEAN_AS_BOOL is set, then each "b" message is
written to a bool pointer.
Follow-up for #8488.
See https://github.com/systemd/systemd/pull/8488#discussion_r175816270.
Krzysztof Nowicki [Wed, 28 Mar 2018 11:36:33 +0000 (13:36 +0200)]
core: dont't remount /sys/fs/cgroup for relabel if not needed (#8595)
The initial fix for relabelling the cgroup filesystem for
SELinux delivered in commit
8739f23e3 was based on the assumption that
the cgroup filesystem is already populated once mount_setup() is
executed, which was true for my system. What I wasn't aware is that this
is the case only when another instance of systemd was running before
this one, which can happen if systemd is used in the initrd (for ex. by
dracut).
In case of a clean systemd start-up the cgroup filesystem is actually
being populated after mount_setup() and does not need relabelling as at
that moment the SELinux policy is already loaded. Since however the root
cgroup filesystem was remounted read-only in the meantime this operation
will now fail.
To fix this check for the filesystem mount flags before relabelling and
only remount ro->rw->ro if necessary and leave the filesystem read-write
otherwise.
Fixes #7901.
Lennart Poettering [Wed, 28 Mar 2018 11:33:06 +0000 (13:33 +0200)]
Merge pull request #8140 from stuarthayes/new
udev: network device naming improvements (sr-iov, npar, slots)
Sebastian Reichel [Wed, 28 Mar 2018 11:32:27 +0000 (13:32 +0200)]
backlight: use current brightness if no saved value to trigger clamping (#8526)
This reads current brightness value in case it has not yet been
saved. This results in the brightness properly being clamped.
Lennart Poettering [Wed, 28 Mar 2018 11:01:37 +0000 (13:01 +0200)]
Merge pull request #8600 from keszybz/oss-fuzz-again
Fuzzing- and test-related fixes
Lauri Tirkkonen [Wed, 28 Mar 2018 10:57:21 +0000 (13:57 +0300)]
nspawn: do not insist on locking read-only container on readonly fs (#8589)
Zbigniew Jędrzejewski-Szmek [Wed, 28 Mar 2018 10:54:26 +0000 (12:54 +0200)]
Fix compilation w/o smack (#8593)
Zbigniew Jędrzejewski-Szmek [Wed, 28 Mar 2018 08:33:40 +0000 (10:33 +0200)]
shared/specifier: use realloc to free some memory after specifier expansion
This is a separate commit only because it actually *increases* memory allocations:
==3256== total heap usage: 100,120 allocs, 100,120 frees, 13,097,140 bytes allocated
to
==4690== total heap usage: 100,121 allocs, 100,121 frees, 14,198,329 bytes allocated
Essentially, we do a little more work to reduce the memory footprint a bit. For a
test where we just allocate the memory and drop it soon afterwards, this is not
beneficial, but it should still be useful for a long running program.
Zbigniew Jędrzejewski-Szmek [Wed, 28 Mar 2018 08:15:44 +0000 (10:15 +0200)]
shared/specifier: be less extravagant with memory allocations
ubsan times out because we do too many allocations:
$ valgrind build/fuzz-unit-file test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6977-full
...
test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6977-full... ok
==1757==
==1757== HEAP SUMMARY:
==1757== in use at exit: 0 bytes in 0 blocks
==1757== total heap usage: 199,997 allocs, 199,997 frees, 90,045,318,585 bytes allocated
...
==3256== total heap usage: 100,120 allocs, 100,120 frees, 13,097,140 bytes allocated
https://oss-fuzz.com/v2/issue/
4651449704251392/6977 should now be really fixed.
e3c3d6761b3e7d was the first attempt, but even with this change,
e3c3d6761b3e7d
still makes sense.
Zbigniew Jędrzejewski-Szmek [Tue, 27 Mar 2018 20:09:25 +0000 (22:09 +0200)]
core/main: preserve return value under valgrind
Filipe Brandenburger [Wed, 28 Mar 2018 07:00:42 +0000 (00:00 -0700)]
core/socket: use chase_symlinks to find binary inside chroot when looking for SELinux label (#8591)
This is a follow up for this comment from @poettering:
https://github.com/systemd/systemd/pull/8405#discussion_r175719214
This updates PR #8405.
Tested manually using the same commands in
https://lists.freedesktop.org/archives/systemd-devel/2018-March/040478.html.
Evgeny Vereshchagin [Tue, 27 Mar 2018 17:30:02 +0000 (20:30 +0300)]
Merge pull request #8576 from keszybz/oss-fuzz
oss-fuzz adjustments and other cleanups
Dimitri John Ledkov [Tue, 27 Mar 2018 10:58:10 +0000 (11:58 +0100)]
core: use setreuid/setregid trick to create session keyring with right ownership (#8447)
Re-use the hacks used to link user keyring, when creating the session
keyring. This way changing ownership of the keyring is not required, and thus
incovation_id can be correctly created in restricted environments.
Creating invocation_id with root permissions works and linking it into session
keyring works, as at that point session keyring is possessed.
Simple way to validate this is with following commands:
$ journalctl -f &
$ sudo systemd-run --uid 1000 /bin/sh -c 'keyctl describe @s; keyctl list @s; keyctl read `keyctl search @s user invocation_id`'
which now works in LXD containers as well as on the host.
Fixes: https://github.com/systemd/systemd/issues/7655
Lennart Poettering [Tue, 27 Mar 2018 07:36:49 +0000 (09:36 +0200)]
journal-file: we can't use a chain cache entry if we don't know where it starts (#8542)
It might happen that we try to bisect through a chain of offset arrays in the
journal whose last element was just allocated but no item yet written
to. In that case that array will be all NUL, but it might still end up
in our array chain cache. If it does, we cannot use it for bisection,
since for bisection we need to know the value of the first entry in that
array, but if it's uninitialized it does not have a first value. Hence,
as a simple fix, in this unlikely case, simply ignore the chain cache.
This is supposed to fix the issue pointed out in #8432, but in a more
permissive way, as this case isn't strictly a badly formatted journal
but actually a valid state (though one within a very short time window),
and we should make the best of it, and handle it gracefully.
Background: in each journal file entries are linked up in large arrays
of offsets. In each array the entries are strictly ordered by the
offsets of the entries, which permits search by bisection. These arrays
are allocated with a fixed size and then filled up as entries are added
to the journal file. If an array is fully filled up, a new array
(double in size as the old one) is appended to the journal file, and
linked up. This means, the journal file will contain a series of chained
up arrays, each time doubling in size, and strictly ordered. When
looking for an entry we maintain a "chain cache", which allows us to
bypass traversing the chain in full if we look for entries close to each
other in a short time. With the fix above we make sure we don't
erroneously use a chain cache item that doesn't carry enough information
for this bisection to work.
Original issue identified (with patch) by @Kxuan.
Replaces: #8432
Lennart Poettering [Tue, 27 Mar 2018 05:38:26 +0000 (07:38 +0200)]
label: rework label_fix() implementations (#8583)
This reworks the SELinux and SMACK label fixing calls in a number of
ways:
1. The two separate boolean arguments of these functions are converted
into a flags type LabelFixFlags.
2. The operations are now implemented based on O_PATH. This should
resolve TTOCTTOU races between determining the label for the file
system object and applying it, as it it allows to pin the object
while we are operating on it.
3. When changing a label fails we'll query the label previously set, and
if matches what we want to set anyway we'll suppress the error.
Also, all calls to label_fix() are now (void)ified, when we ignore the
return values.
Fixes: #8566
Stuart Hayes [Wed, 14 Feb 2018 20:44:47 +0000 (15:44 -0500)]
NEWS: Warn about predictable network naming changes
Stuart Hayes [Thu, 18 Jan 2018 20:14:56 +0000 (15:14 -0500)]
udev: net_id: Improve predictable names for NPAR devices
NPAR is a technology that allows a single network interface to
be divided into number of partitions. The partitions show up
as functions on the same PCI device... when there are more than
8 functions, ARI (alternative routing-ID interpretation) is
used. With ARI is enabled, the 8 bit field that normally has 5
bits for the PCI device and 3 bits for the PCI function is instead
interpreted as (implicit) device 0, with 8 bits for the function
number.
Because the linux kernel exposes the PCI device/function numbers
to userspace the same regardless of whether ARI is enabled,
systemd predictable device naming can generate unpredictable
names in this case, because network names using the PCI slot use
the function number, but not the device number, causing systemd
to generate the same name for mulitple network devices (so some
will revert to the "ethX" names).
With this patch, device naming code checks if ARI is enabled for
a PCI network device, and uses the full 8-bit function number
for naming to avoid this situation. This should improve
readability and predictability of device names.
Here is an example of how this change would affect naming:
before patch | after patch
-----------------------------
ens2f0 | ens2f0 NPAR partition 0 (in PCI slot 2)
ens2f1 | ens2f1 NPAR partition 1
...
ens2f7 | ens2f7 NPAR partition 7
eth1 | ens2f8 NPAR partition 8
eth2 | ens2f9 NPAR partition 9
Stuart Hayes [Wed, 17 Jan 2018 19:31:55 +0000 (14:31 -0500)]
udev: net_id: Improve predictable names for SR-IOV virtual devices
With PCI SR-IOV, a number of virtual network devices can be enabled,
all of which share the same physical network device. Currently,
udev generates names for SR-IOV virtual functions as if they were
independent network devices.
With this change, the predictable network device naming code will
check if a network device is an SR-IOV virtual device, and will
generate a name based on the physical PCI device plus a "v%u"
suffix. This should improve readability and predictability of
device names.
Here is an example of how this change would affect naming:
before patch | after patch
-----------------------------
eno1 | eno1 onboard NIC, physical function
enp101s0f0 | eno1v0 onboard NIC, SR-IOV virtual func 0
enp101s0f1 | eno1v1 onboard NIC, SR-IOV virtual func 1
Stuart Hayes [Tue, 16 Jan 2018 21:08:10 +0000 (16:08 -0500)]
udev: net_id: search parent devices for PCI slot number
To generate predictable network device names, the code in
udev-builting-net_id.c tries to match the PCI device address
of the network device to the entries in /sys/bus/pci/slots.
However, sometimes the slot number is not associated the
network controller PCI device itself, but rather with one of
its parents.
This change will try to find a match in /sys/bus/pci/slots for
the parents of the PCI network device, if it doesn't find a
match for the device itself.
Zbigniew Jędrzejewski-Szmek [Mon, 26 Mar 2018 16:00:08 +0000 (18:00 +0200)]
Merge pull request #8554 from poettering/chase-trail-slash
fs-util: add new CHASE_TRAIL_SLASH flag for chase_symlinks()
mourikwa [Mon, 26 Mar 2018 15:50:35 +0000 (17:50 +0200)]
Fix for alphabetical ordering (#8581)
I read the addition of the purism laptop keyboard and noticed
that the 60-keyboard.hwdb file could/should have an alphabetical ordering.
I scratched that itch with this commit.
Michael Olbrich [Mon, 26 Mar 2018 15:34:53 +0000 (17:34 +0200)]
core: don't include libmount.h in a header file (#8580)
linux/fs.h sys/mount.h, libmount.h and missing.h all include MS_*
definitions.
To avoid problems, only one of linux/fs.h, sys/mount.h and libmount.h
should be included. And missing.h must be included last.
Without this, building systemd may fail with:
In file included from [...]/libmount/libmount.h:31:0,
from ../systemd-238/src/core/manager.h:23,
from ../systemd-238/src/core/emergency-action.h:37,
from ../systemd-238/src/core/unit.h:34,
from ../systemd-238/src/core/dbus-timer.h:25,
from ../systemd-238/src/core/timer.c:26:
[...]/sys/mount.h:57:2: error: expected identifier before numeric constant
Lennart Poettering [Mon, 26 Mar 2018 13:34:39 +0000 (15:34 +0200)]
Merge pull request #8562 from keszybz/docs
Man page and log message fixes
Zbigniew Jędrzejewski-Szmek [Mon, 26 Mar 2018 08:40:45 +0000 (10:40 +0200)]
README: mention systemd-stable
Fixes #8564.
https://www.freedesktop.org/wiki/Software/systemd/Backports/ has already been
adjusted.
Zbigniew Jędrzejewski-Szmek [Mon, 26 Mar 2018 08:32:42 +0000 (10:32 +0200)]
basic/strbuf: include empty strings in count
Not that it matters much, but it seems cleaner to also count those
inputs, even if they do not consume extra storage space.
The test is extended to include an empty input and counts in the test are
adjusted to include it.
Zbigniew Jędrzejewski-Szmek [Mon, 26 Mar 2018 08:26:39 +0000 (10:26 +0200)]
basic/strbuf: use structured initalizers to shorten code
Zbigniew Jędrzejewski-Szmek [Sun, 25 Mar 2018 20:44:05 +0000 (22:44 +0200)]
journal: use structured initalizer
Zbigniew Jędrzejewski-Szmek [Sun, 25 Mar 2018 20:43:43 +0000 (22:43 +0200)]
tree-wide: add bsearch_safe and use where appropriate
Should fix #8557.
Zbigniew Jędrzejewski-Szmek [Sun, 25 Mar 2018 20:26:13 +0000 (22:26 +0200)]
fuzz-unit-file: add __has_feature(memory_sanitizer) when skipping ListenNetlink=
https://clang.llvm.org/docs/MemorySanitizer.html#id5 documents this
check as the way to detect MemorySanitizer at compilation time. We
only need to skip the test if MemorySanitizer is used.
Also, use this condition in cg_slice_to_path(). There, the code that is
conditionalized is not harmful in any way (it's just unnecessary), so remove
the FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION condition.
Fixes #8482.
Zbigniew Jędrzejewski-Szmek [Mon, 26 Mar 2018 12:54:30 +0000 (14:54 +0200)]
Merge pull request #8578 from yuwata/resolve-tool-cleanup
resolve-tool: small cleanups
Zbigniew Jędrzejewski-Szmek [Sun, 25 Mar 2018 20:11:44 +0000 (22:11 +0200)]
fuzz-unit-file: adjust check for ListenNetlink yet again
The test for ListenNetlink would abort the loop if a line longer then LINE_MAX
was encountered (read_line() returns -ENOBUFS in that case). Let's use the
the line length limit that the unit file parses uses.
https://oss-fuzz.com/v2/issue/
5546208027213824/7094.
Yu Watanabe [Sun, 25 Mar 2018 09:57:19 +0000 (18:57 +0900)]
resolve: always shows global settings
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 13:43:52 +0000 (14:43 +0100)]
core/service: rework the hold-off time over message
"hold-off" is apparently confusing, because we also have HoldoffTimeoutSec=.
Let's use RestartSec= directly in the message.
Fixes #5472.