]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agoverify: use manager_load_startable_unit_or_warn() to load units for verification
Zbigniew Jędrzejewski-Szmek [Thu, 12 Apr 2018 13:58:45 +0000 (15:58 +0200)] 
verify: use manager_load_startable_unit_or_warn() to load units for verification

This doesn't change the outcome:
(before)
/home/zbyszek/src/systemd/test/test-execute/exec-basic.service:6: Executable path specifies a directory: /usr/bin/test/
exec-basic.service: Failed to create exec-basic.service/start: Unit exec-basic.service is not loaded properly: Exec format error.
(after)
/home/zbyszek/src/systemd/test/test-execute/exec-basic.service:6: Executable path specifies a directory: /usr/bin/test/
Failed to load file /home/zbyszek/src/systemd/test/test-execute/exec-basic.service: Exec format error

(before)
masked.service: Failed to create masked.service/start: Unit masked.service is masked.
(after)
File /home/zbyszek/src/systemd/test/test-execute/masked.service is masked.

but the failure is immediate and the error messages are more direct.

6 years agotests: use manager_load_startable_unit_or_warn() to load units
Zbigniew Jędrzejewski-Szmek [Thu, 12 Apr 2018 13:51:39 +0000 (15:51 +0200)] 
tests: use manager_load_startable_unit_or_warn() to load units

Doing manager_load_unit() followed by UNIT_VTABLE(unit)->start(unit) would
result in an assertion failure in ->start() if the unit failed to load
properly. Something like this is okey-ish is tests, since the test units are
not expected to fail to load, but the reason for failure is clearer if we
fail immediately.

6 years agocore/manager: split out function to verify that unit is loaded and not masked
Zbigniew Jędrzejewski-Szmek [Thu, 12 Apr 2018 13:13:14 +0000 (15:13 +0200)] 
core/manager: split out function to verify that unit is loaded and not masked

No functional change.

6 years agotest-execute/exec-specifier.service: fix quoting
Zbigniew Jędrzejewski-Szmek [Thu, 12 Apr 2018 14:16:19 +0000 (16:16 +0200)] 
test-execute/exec-specifier.service: fix quoting

The lines would cause the whole service to fail to be loaded.

6 years agotest-path: Set umask explicitly (#8616)
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.

6 years agounits: use `systemctl exit` to kill the user manager (#8648)
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.

6 years agofix missed bracket of exec-personality-ppc64le.service (#8650)
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>
6 years agoMerge pull request #8624 from yuwata/fix-8371
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

6 years agooss-fuzz: Fallback to `ninja-build` when available (#8641)
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.

6 years agoMerge pull request #8643 from poettering/coding-style-fixlets
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

6 years agoCODING_STYLE: document suggested suffixes to use in documentation 8643/head
Lennart Poettering [Thu, 29 Mar 2018 14:28:21 +0000 (16:28 +0200)] 
CODING_STYLE: document suggested suffixes to use in documentation

6 years agoCODING_STYLE: two minor additions
Lennart Poettering [Thu, 29 Mar 2018 14:28:00 +0000 (16:28 +0200)] 
CODING_STYLE: two minor additions

6 years agoCODING_STYLE: mention that we ship .editconfig/.vimrc/.dir-locals.el in our repo
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

6 years agoupdate TODO
Lennart Poettering [Thu, 29 Mar 2018 15:47:03 +0000 (17:47 +0200)] 
update TODO

6 years agotmpfiles: fix directory removal with force symlink (#8619)
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>
6 years agocore: skip the removal of cgroups in the TEST_RUN_MINIMAL mode (#8622)
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.

6 years agodissect: Don't count RPMB and boot partitions (#8609)
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

6 years agoMerge pull request #8628 from jwrdegoede/hwdb-sensors2
Lennart Poettering [Tue, 3 Apr 2018 12:49:39 +0000 (14:49 +0200)] 
Merge pull request #8628 from jwrdegoede/hwdb-sensors2

Hwdb sensors2

6 years agoman: machinectl: update fedora exmple URL (#8642)
Radostin Stoyanov [Tue, 3 Apr 2018 03:06:53 +0000 (04:06 +0100)] 
man: machinectl: update fedora exmple URL (#8642)

6 years agococcinelle: fix typo in file name (#8640)
Alexander Kurtz [Mon, 2 Apr 2018 14:30:26 +0000 (16:30 +0200)] 
coccinelle: fix typo in file name (#8640)

6 years agoMerge pull request #8626 from floppym/initctl
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

6 years agogenerate-af-list.sh: slightly generalize pattern, fix w/musl (#8629)
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.

6 years agohwdb: Add accelerometer orientation quirk for the Pipo W4 tablet 8628/head
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.

6 years agosystemctl: try opening /run/initctl before /dev/initctl 8626/head
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

6 years agounits: initctl: move the fifo to /run/initctl to match sysvinit
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

6 years agohwdb: Add accelerometer orientation quirk for the Lenovo Ideapad Miix 310
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).

6 years agohwdb: Add accelerometer orientation quirk for the MSI S100 2-in-1
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.

6 years agohwdb: Add accelerometer orientation quirk for the Yours Y8W81 tablet
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).

6 years agohwdb: Add accelerometer orientation entry for the I.T.Works TW701 tablet
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.

6 years agohwdb: 60-sensors: Fix alphabetic sorting by vendor name
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.

6 years agobash-completion: busctl: make variables local 8624/head
Yu Watanabe [Fri, 30 Mar 2018 08:13:52 +0000 (17:13 +0900)] 
bash-completion: busctl: make variables local

6 years agobash-completion: busctl: do not suggest "-" for signature
Yu Watanabe [Fri, 30 Mar 2018 08:08:11 +0000 (17:08 +0900)] 
bash-completion: busctl: do not suggest "-" for signature

Fixes #8371.

6 years agobash-completion: busctl: suggests only writable properties for set-property
Yu Watanabe [Fri, 30 Mar 2018 08:06:50 +0000 (17:06 +0900)] 
bash-completion: busctl: suggests only writable properties for set-property

6 years agotimesync: on network event do not establish connection when NTP servers are not chang...
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.

6 years agosd-bus: allow description to be set for system/user busses (#8594)
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

6 years agotree-wide: remove unused variables (#8612)
Yu Watanabe [Thu, 29 Mar 2018 10:50:50 +0000 (19:50 +0900)] 
tree-wide: remove unused variables (#8612)

6 years agoMerge pull request #8606 from dell/rename-suspend-to-hibernate
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

6 years agoMerge pull request #8607 from poettering/trivialities2
Yu Watanabe [Thu, 29 Mar 2018 04:24:11 +0000 (13:24 +0900)] 
Merge pull request #8607 from poettering/trivialities2

tiny, trivial, unrelated fixes

6 years agotests: run `udevadm settle` after `sfdisk` (#8610)
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
```

6 years agoFix description on suspend-then-hibernate units. 8606/head
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.

6 years agoRename suspend-to-hibernate to suspend-then-hibernate
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.

6 years agomachine-image,mount-setup: minor coding style fixes 8607/head
Lennart Poettering [Wed, 28 Mar 2018 15:07:42 +0000 (17:07 +0200)] 
machine-image,mount-setup: minor coding style fixes

6 years agoman: remove spurious 'system'
Lennart Poettering [Wed, 28 Mar 2018 15:07:11 +0000 (17:07 +0200)] 
man: remove spurious 'system'

6 years agoinhibit: make use of EXIT_SUCCESS where appropriate
Lennart Poettering [Tue, 27 Mar 2018 12:58:21 +0000 (14:58 +0200)] 
inhibit: make use of EXIT_SUCCESS where appropriate

6 years agoutil: check for overflows in xbsearch_r()
Lennart Poettering [Tue, 27 Mar 2018 12:56:04 +0000 (14:56 +0200)] 
util: check for overflows in xbsearch_r()

6 years agojournald: make use of fd_get_path() where appropriate
Lennart Poettering [Mon, 26 Mar 2018 11:27:26 +0000 (13:27 +0200)] 
journald: make use of fd_get_path() where appropriate

6 years agoupdate TODO
Lennart Poettering [Tue, 20 Mar 2018 19:26:15 +0000 (20:26 +0100)] 
update TODO

6 years agoCODING_STYLE: document why O_NONBLOCK makes sense when opening regular files, too
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

6 years agosystemd-inhibit: ignore signal interrupt from keyboard (#8569)
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.

6 years agodoc: merge docs/ dir → doc/
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.

6 years agosystemctl: refuse to edit masked units (#8602)
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.

6 years agobus-util: add flags for bus_map_all_properties() (#8546)
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.

6 years agocore: dont't remount /sys/fs/cgroup for relabel if not needed (#8595)
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.

6 years agoMerge pull request #8140 from stuarthayes/new
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)

6 years agobacklight: use current brightness if no saved value to trigger clamping (#8526)
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.

6 years agoMerge pull request #8600 from keszybz/oss-fuzz-again
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

6 years agonspawn: do not insist on locking read-only container on readonly fs (#8589)
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)

6 years agoFix compilation w/o smack (#8593)
Zbigniew Jędrzejewski-Szmek [Wed, 28 Mar 2018 10:54:26 +0000 (12:54 +0200)] 
Fix compilation w/o smack (#8593)

6 years agoshared/specifier: use realloc to free some memory after specifier expansion 8600/head
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.

6 years agoshared/specifier: be less extravagant with memory allocations
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.

6 years agocore/main: preserve return value under valgrind
Zbigniew Jędrzejewski-Szmek [Tue, 27 Mar 2018 20:09:25 +0000 (22:09 +0200)] 
core/main: preserve return value under valgrind

6 years agocore/socket: use chase_symlinks to find binary inside chroot when looking for SELinux...
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.

6 years agoMerge pull request #8576 from keszybz/oss-fuzz
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

6 years agocore: use setreuid/setregid trick to create session keyring with right ownership...
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
6 years agojournal-file: we can't use a chain cache entry if we don't know where it starts ...
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

6 years agolabel: rework label_fix() implementations (#8583)
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
6 years agoNEWS: Warn about predictable network naming changes 8140/head
Stuart Hayes [Wed, 14 Feb 2018 20:44:47 +0000 (15:44 -0500)] 
NEWS: Warn about predictable network naming changes

6 years agoudev: net_id: Improve predictable names for NPAR devices
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

6 years agoudev: net_id: Improve predictable names for SR-IOV virtual devices
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

6 years agoudev: net_id: search parent devices for PCI slot number
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.

6 years agoMerge pull request #8554 from poettering/chase-trail-slash
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()

6 years agoFix for alphabetical ordering (#8581)
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.

6 years agocore: don't include libmount.h in a header file (#8580)
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

6 years agoMerge pull request #8562 from keszybz/docs
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

6 years agoREADME: mention systemd-stable 8576/head
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.

6 years agobasic/strbuf: include empty strings in count
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.

6 years agobasic/strbuf: use structured initalizers to shorten code
Zbigniew Jędrzejewski-Szmek [Mon, 26 Mar 2018 08:26:39 +0000 (10:26 +0200)] 
basic/strbuf: use structured initalizers to shorten code

6 years agojournal: use structured initalizer
Zbigniew Jędrzejewski-Szmek [Sun, 25 Mar 2018 20:44:05 +0000 (22:44 +0200)] 
journal: use structured initalizer

6 years agotree-wide: add bsearch_safe and use where appropriate
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.

6 years agofuzz-unit-file: add __has_feature(memory_sanitizer) when skipping ListenNetlink=
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.

6 years agoMerge pull request #8578 from yuwata/resolve-tool-cleanup
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

6 years agofuzz-unit-file: adjust check for ListenNetlink yet again
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.

6 years agoresolve: always shows global settings 8578/head
Yu Watanabe [Sun, 25 Mar 2018 09:57:19 +0000 (18:57 +0900)] 
resolve: always shows global settings

6 years agocore/service: rework the hold-off time over message 8562/head
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.

6 years agoman: add an additional note about journalctl -u
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 13:27:48 +0000 (14:27 +0100)] 
man: add an additional note about journalctl -u

Fixes #5387.

I kept the _SYSTEMD_UNIT= example because it is easy to understand and
not very verbose. _SYSTEMD_CGROUP has much longer entries which do not
fit well in the narrow man page. Instead, I added an explanation of what
-u is translated into.

6 years agoman: mention that oldest journal files are removed
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 13:04:13 +0000 (14:04 +0100)] 
man: mention that oldest journal files are removed

Fixes #7225.

6 years agoman: add a note about "archived" journal files and when files can be copied
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 12:54:20 +0000 (13:54 +0100)] 
man: add a note about "archived" journal files and when files can be copied

Issue #6673 requests advice on backup strategy. But the right backup strategy
depends on many factors, too many to describe in a man page. So let's just
provide some general information which files are mutable and that it is always
safe to use/copy files.

Closes #6673.

6 years agoman: add a note about $XDG_SEAT and $XDG_VTNR to pam_systemd(8)
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 12:15:19 +0000 (13:15 +0100)] 
man: add a note about $XDG_SEAT and $XDG_VTNR to pam_systemd(8)

Issue #6499 requests that a mention that those varibles can be set in the
environment is added. But the man page already says that. There isn't much
detail, but a man page does not need to and in this case should not include
all the details. Instead a note is added that those vars can be derived from
$DISPLAY.

Closes #6499.

6 years agoman: add link and list of known attrs to systemd-gpt-auto-generator(8)
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 11:59:09 +0000 (12:59 +0100)] 
man: add link and list of known attrs to systemd-gpt-auto-generator(8)

Fixes #7859.

6 years agoman: add missing headers to glib-event-glue.c
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 15:38:51 +0000 (16:38 +0100)] 
man: add missing headers to glib-event-glue.c

6 years agoman: fix compilation of journal-iterate-poll.c
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 15:35:02 +0000 (16:35 +0100)] 
man: fix compilation of journal-iterate-poll.c

Our examples should compile...

6 years agoman: drop license header in glib-event-glue.c
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 19:02:49 +0000 (20:02 +0100)] 
man: drop license header in glib-event-glue.c

We're moving towards just SPDX license identifiers, and the boilerplate
is especially annoying in a man page. Also adjust to the smaller indentation
to make the code fit better on a page.

6 years agoman: move examples out of sd_journal_get_fd into separate files
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 15:32:17 +0000 (16:32 +0100)] 
man: move examples out of sd_journal_get_fd into separate files

man/.dir-locals is to keep indentation under control.

This makes it much easier to compile and run those examples, c.f. #7578.

v2:
- copy more of .dir-locals.el from the root to man/.dir-locals.el
  (I though emacs would inherit from the one in the parent dir, but
   it seems it just uses its own broken defaults, including
   indent-tabs-mode by default.)

6 years agoresolve: actually shows information about all specified interfaces
Yu Watanabe [Tue, 20 Mar 2018 09:11:39 +0000 (18:11 +0900)] 
resolve: actually shows information about all specified interfaces

6 years agoMerge pull request #8565 from poettering/cocci-again
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 18:22:24 +0000 (19:22 +0100)] 
Merge pull request #8565 from poettering/cocci-again

run all coccinelle again

6 years agoMerge pull request #8559 from poettering/integration-test-fixes
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 18:21:25 +0000 (19:21 +0100)] 
Merge pull request #8559 from poettering/integration-test-fixes

make integration tests pass again

6 years agococcinelle: run no-if-assignments.cocci again 8565/head
Lennart Poettering [Fri, 23 Mar 2018 15:33:38 +0000 (16:33 +0100)] 
coccinelle: run no-if-assignments.cocci again

6 years agococcinelle: run safe_fclose.cocci again
Lennart Poettering [Fri, 23 Mar 2018 15:32:48 +0000 (16:32 +0100)] 
coccinelle: run safe_fclose.cocci again

6 years agococcinelle: run while-true.cocci again
Lennart Poettering [Fri, 23 Mar 2018 15:32:26 +0000 (16:32 +0100)] 
coccinelle: run while-true.cocci again

6 years agoPartially revert "seccomp: add mmap and address family restrictions for MIPS" (#8563)
James Cowgill [Fri, 23 Mar 2018 15:04:16 +0000 (15:04 +0000)] 
Partially revert "seccomp: add mmap and address family restrictions for MIPS" (#8563)

This reverts the mmap parts of f5aeac1439d64905c7b1b57042c39589dd31e3a6,
but keeps the part which restricts address families which works
correctly.

Unfortunately the MIPS toolchains still do not implement PT_GNU_STACK.
This means that while the commit to restrict mmap on MIPS was "correct",
it had the side effect of causing pthread_create to fail because glibc tries
to allocate an executable stack for new threads in the absense of
PT_GNU_STACK. We should wait until PT_GNU_STACK is implemented in all
the relevant parts of the toolchain (at least gcc and glibc) before
enabling this again.