]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agoaudit: introduce audit_session_is_valid() and make use of it everywhere
Lennart Poettering [Fri, 14 Jul 2017 16:42:17 +0000 (18:42 +0200)] 
audit: introduce audit_session_is_valid() and make use of it everywhere

Let's add a proper validation function, since validation isn't entirely
trivial. Make use of it where applicable. Also make use of
AUDIT_SESSION_INVALID where we need a marker for an invalid audit
session.

6 years agoescape: fix systemd-escape description text
Lennart Poettering [Fri, 14 Jul 2017 16:39:18 +0000 (18:39 +0200)] 
escape: fix systemd-escape description text

The long man page paragraph got it right: the tool is for escaping systemd unit
names, not just system unit names. Also fix the short man page paragraph
and the --help text.

Follow-up for 303608c1bcf9568371625fbbd9442946cadba422

6 years agonamespace: keep selinuxfs mounted read-write with ProtectKernelTunables (#5741)
Nicolas Iooss [Mon, 31 Jul 2017 15:45:33 +0000 (17:45 +0200)] 
namespace: keep selinuxfs mounted read-write with ProtectKernelTunables (#5741)

When a service unit uses "ProtectKernelTunables=yes", it currently
remounts /sys/fs/selinux read-only. This makes libselinux report SELinux
state as "disabled", because most SELinux features are not usable. For
example it is not possible to validate security contexts (with
security_check_context_raw() or /sys/fs/selinux/context). This behavior
of libselinux has been described in
http://danwalsh.livejournal.com/73099.html and confirmed in a recent
email, https://marc.info/?l=selinux&m=149220233032594&w=2 .

Since commit 0c28d51ac849 ("units: further lock down our long-running
services"), systemd-localed unit uses ProtectKernelTunables=yes.
Nevertheless this service needs to use libselinux API in order to create
/etc/vconsole.conf, /etc/locale.conf... with the right SELinux contexts.
This is broken when /sys/fs/selinux is mounted read-only in the mount
namespace of the service.

Make SELinux-aware systemd services work again when they are using
ProtectKernelTunables=yes by keeping selinuxfs mounted read-write.

6 years agomount-setup: mount xenfs filesystem (#6491)
vliaskov [Mon, 31 Jul 2017 13:59:02 +0000 (15:59 +0200)] 
mount-setup: mount xenfs filesystem (#6491)

6 years agocore: Do not fail perpetual mount units without fragment (#6459)
Abdó Roig-Maranges [Mon, 31 Jul 2017 10:32:09 +0000 (12:32 +0200)] 
core: Do not fail perpetual mount units without fragment (#6459)

mount_load does not require fragment files to be present in order to
load mount units which are perpetual, or come from /proc/self/mountinfo.

mount_verify should do the same, otherwise a synthesized '-.mount' would
be marked as failed with "No such file or directory", as it is perpetual
but not marked to come from /proc/self/mountinfo at this point.

This happens for the user instance, and I suspect it was the cause of #5375
for the system instance, without gpt-generator.

6 years agoMerge pull request #6472 from yuwata/journal-gateway-fix
Lennart Poettering [Mon, 31 Jul 2017 10:11:48 +0000 (12:11 +0200)] 
Merge pull request #6472 from yuwata/journal-gateway-fix

Some journal-gateway and journal-remote related fixes

6 years agorfkill: fix erroneous behavior when polling the udev monitor (#6489)
S. Fan [Mon, 31 Jul 2017 10:10:10 +0000 (05:10 -0500)] 
rfkill: fix erroneous behavior when polling the udev monitor (#6489)

Comparing udev_device_get_sysname(device) and sysname will always return
true. We need to check the device received from udev monitor instead.

Also, fd_wait_for_event() sometimes never exits. Better set a timeout
here.

6 years agocryptsetup: fix infinite timeout (#6486)
Andrew Soutar [Mon, 31 Jul 2017 06:19:16 +0000 (02:19 -0400)] 
cryptsetup: fix infinite timeout (#6486)

0004f698d causes `arg_timeout` to be infinity instead of 0 when timeout=0. The
logic here now matches this change.

Fixes #6381

6 years agocore: properly handle deserialization of unknown unit types (#6476)
Zbigniew Jędrzejewski-Szmek [Mon, 31 Jul 2017 06:05:35 +0000 (02:05 -0400)] 
core: properly handle deserialization of unknown unit types (#6476)

We just abort startup, without printing any error. Make sure we always
print something, and when we cannot deserialize some unit, just ignore it and
continue.

Fixup for 4bc5d27b942afa83cc3d95debd2ad48d42ac07a8. Without this, we would hang
in daemon-reexec after upgrade.

6 years agoMerge pull request #6462 from keszybz/man-tweaks
Martin Pitt [Fri, 28 Jul 2017 09:49:44 +0000 (11:49 +0200)] 
Merge pull request #6462 from keszybz/man-tweaks

Some small man page fixes

6 years agoman: do not recommend rescue.target for alt-↑ 6462/head
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jul 2017 20:04:52 +0000 (16:04 -0400)] 
man: do not recommend rescue.target for alt-↑

rescue.target does not work well, and we don't have a suitable emergency
shell unit that can be started on existing systems right now. So let's just
remove the recommendation for now.

Fixes #6451.

6 years agoman: do not encourgage starting of poweroff/halt/reboot/kexec targets directly
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jul 2017 19:53:30 +0000 (15:53 -0400)] 
man: do not encourgage starting of poweroff/halt/reboot/kexec targets directly

Going through logind and systemd allows polkit to be used,
the job mode will be set properly, and is generally easier
to get correct.

Fixes #6452.

6 years agoman: describe which units types are stopped on isolate
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jul 2017 19:25:50 +0000 (15:25 -0400)] 
man: describe which units types are stopped on isolate

Fixes #6455.

6 years agoMerge pull request #6365 from keszybz/fast-tests
Martin Pitt [Fri, 28 Jul 2017 09:09:50 +0000 (11:09 +0200)] 
Merge pull request #6365 from keszybz/fast-tests

Make tests faster by default

6 years agoMerge pull request #6461 from keszybz/meson-options-fix
Martin Pitt [Fri, 28 Jul 2017 07:51:29 +0000 (09:51 +0200)] 
Merge pull request #6461 from keszybz/meson-options-fix

Meson options fix

6 years agoboot/efi: don't hard fail on error for tpm measure (#6473)
Harald Hoyer [Fri, 28 Jul 2017 07:46:05 +0000 (09:46 +0200)] 
boot/efi: don't hard fail on error for tpm measure (#6473)

Display the error for a small amount of time, but don't fail hard.

In case of a faulty BIOS, a TPM error should not prevent the boot.
If something cares about the PCM measurement, it will be noticed
anyway later on.

Especially important now, that TPM measurement is the default now on
some distribution builds.

https://bugzilla.redhat.com/show_bug.cgi?id=1411156

6 years agotest-timesync: ignore failure to listen on /run/systemd/netif/links/ (#6463)
Zbigniew Jędrzejewski-Szmek [Fri, 28 Jul 2017 07:33:43 +0000 (03:33 -0400)] 
test-timesync: ignore failure to listen on /run/systemd/netif/links/ (#6463)

Fixes #6353.

6 years agoMerge pull request #6465 from keszybz/drop-kdbus
Martin Pitt [Fri, 28 Jul 2017 07:29:07 +0000 (09:29 +0200)] 
Merge pull request #6465 from keszybz/drop-kdbus

Drop kdbus-dependent code

6 years agomkosi.arch: fix comment (#6470)
AsciiWolf [Fri, 28 Jul 2017 07:24:12 +0000 (09:24 +0200)] 
mkosi.arch: fix comment (#6470)

libidn -> libidn2

6 years agojournal-remote: use MHD_OPTION_STRICT_FOR_CLIENT if MHD_USE_PEDANTIC_CHECKS is deprecated 6472/head
Yu Watanabe [Fri, 28 Jul 2017 07:22:14 +0000 (16:22 +0900)] 
journal-remote: use MHD_OPTION_STRICT_FOR_CLIENT if MHD_USE_PEDANTIC_CHECKS is deprecated

The option MHD_OPTION_STRICT_FOR_CLIENT is provided since libmicrohttpd-0.9.54, and
MHD_USE_PEDANTIC_CHECKS will be deprecated in future.
This makes support both option.

6 years agojournal-gateway: use MHD_USE_POLL_INTERNAL_THREAD instead of MHD_USE_POLL
Yu Watanabe [Fri, 28 Jul 2017 04:21:34 +0000 (13:21 +0900)] 
journal-gateway: use MHD_USE_POLL_INTERNAL_THREAD instead of MHD_USE_POLL

The option MHD_USE_THREAD_PER_CONNECTION requires MHD_USE_POLL_INTERNAL_THREAD
since libmicrohttpd-0.9.53.
If MHD_USE_POLL is used instead of MHD_USE_POLL_INTERNAL_THREAD, then
the library outputs the following warning:
```
Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with
MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD was added.
Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.
```
The option MHD_USE_POLL_INTERNAL_THREAD is defined as
`MHD_USE_POLL_INTERNAL_THREAD = MHD_USE_POLL | MHD_USE_INTERNAL_POLLING_THREAD,`
So, let's use MHD_USE_POLL_INTERNAL_THREAD instead of MHD_USE_POLL.

6 years agojournal-remote,gateway: use MHD_USE_TLS instead of MHD_USE_SSL
Yu Watanabe [Fri, 28 Jul 2017 04:19:52 +0000 (13:19 +0900)] 
journal-remote,gateway: use MHD_USE_TLS instead of MHD_USE_SSL

The option is renamed in libmicrohttpd-0.9.52.

6 years agounits,sysusers: use DynamicUser= for journal-gatewayd and drop user systemd-journal...
Yu Watanabe [Fri, 28 Jul 2017 03:28:17 +0000 (12:28 +0900)] 
units,sysusers: use DynamicUser= for journal-gatewayd and drop user systemd-journal-gateway from sysusers

6 years agobash-completion: use the first argument instead of the global variable (#6457)
Yu Watanabe [Thu, 27 Jul 2017 11:22:54 +0000 (20:22 +0900)] 
bash-completion: use the first argument instead of the global variable (#6457)

Without this fix:

$ systemctl start <tab>
Display all 135 possibilities? (y or n)
$ __get_startable_units --system | wc -l
224

the number of the suggestions are quite different, as __get_startable_units --system does
not filter already started units. With this fix,

$ systemctl start <tab>
Display all 135 possibilities? (y or n)
$ __get_startable_units --system | wc -l
123
$ __get_template_names --system | wc -l
12

the number of the suggestions matches one the function returns.
For consistency with the other internal functions, it should use the first argument
instead of the global variable $mode.

[zj: add commit message to make it sound like we know what we're doing]

6 years agomeson: add empty lines before enabled/disabled status 6461/head
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jul 2017 18:14:44 +0000 (14:14 -0400)] 
meson: add empty lines before enabled/disabled status

Those line are long enough to wrap around a few times, and they are
much more legible with some whitespace.

6 years agomeson: -D remote and -D importd should be "combo" options
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jul 2017 18:11:15 +0000 (14:11 -0400)] 
meson: -D remote and -D importd should be "combo" options

The default should be 'auto', and we allow 'true'
and 'false' too.

Fixes #6445.

6 years agomeson: drop unnecesary default value setting
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jul 2017 18:09:22 +0000 (14:09 -0400)] 
meson: drop unnecesary default value setting

'true' is the default.
Follow-up for 7d77b8880d571447825bb6b0d61683d2e9d58895.

6 years agomeson.build: reorder tests to match order in meson_options.txt
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jul 2017 18:08:46 +0000 (14:08 -0400)] 
meson.build: reorder tests to match order in meson_options.txt

This makes it easier to edit both files.

6 years agohwdb: Add axis range for System76 Galago Pro (galp2) (#6439)
Benjamin Berg [Tue, 25 Jul 2017 01:35:58 +0000 (03:35 +0200)] 
hwdb: Add axis range for System76 Galago Pro (galp2) (#6439)

6 years agobasic: cosmetic changes (#6440)
Yu Watanabe [Mon, 24 Jul 2017 23:32:34 +0000 (08:32 +0900)] 
basic: cosmetic changes (#6440)

6 years agoMerge pull request #6438 from poettering/distro-porting-more
Zbigniew Jędrzejewski-Szmek [Mon, 24 Jul 2017 12:15:45 +0000 (08:15 -0400)] 
Merge pull request #6438 from poettering/distro-porting-more

extend README and DISTRO_PORTING a bit

6 years agoMerge pull request #6429 from keszybz/dropins-and-ordering-cycles
Lennart Poettering [Mon, 24 Jul 2017 09:58:21 +0000 (11:58 +0200)] 
Merge pull request #6429 from keszybz/dropins-and-ordering-cycles

Dropin loading and ordering cycle logging improvements

6 years agoREADME: document that max_bonds=0 is the way to go for bonding.ko 6438/head
Lennart Poettering [Mon, 24 Jul 2017 09:28:04 +0000 (11:28 +0200)] 
README: document that max_bonds=0 is the way to go for bonding.ko

Everything else just is annoying, hence let's list this among the
requirements we make on the kernel in order to minimize confusion
leading to #6184 and suchlike.

6 years agoDISTRO_PORTING: document that distros may/should change fallback DNS as well as fallb...
Lennart Poettering [Mon, 24 Jul 2017 09:26:54 +0000 (11:26 +0200)] 
DISTRO_PORTING: document that distros may/should change fallback DNS as well as fallback NTP if they wish

The DNS and NTP fallback server situation is pretty similar, and
downstream distros might want to change both to whatever they need,
hence mention them both.

6 years agomeson: install the git hook (#6425)
Zbigniew Jędrzejewski-Szmek [Mon, 24 Jul 2017 08:41:45 +0000 (04:41 -0400)] 
meson: install the git hook (#6425)

This was done autogen.sh previously and was dropped in
72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8. Let's add it back.
The meson configuration step is the only reasonable place.

Note that this only works for the most standard git dirs, e.g.
the hook will not be installed if git worktree is used or if
$GIT_DIR is specified, etc. I think that's OK because most of
the time meson will be run at least once in the original cloned
dir.

6 years agonspawn: do not mount /sys/fs/kdbus 6465/head
Zbigniew Jędrzejewski-Szmek [Sun, 23 Jul 2017 16:03:00 +0000 (12:03 -0400)] 
nspawn: do not mount /sys/fs/kdbus

6 years agoDrop kdbus bits
Zbigniew Jędrzejewski-Szmek [Sun, 23 Jul 2017 15:45:57 +0000 (11:45 -0400)] 
Drop kdbus bits

Some kdbus_flag and memfd related parts are left behind, because they
are entangled with the "legacy" dbus support.

test-bus-benchmark is switched to "manual". It was already broken before
(in the non-kdbus mode) but apparently nobody noticed. Hopefully it can
be fixed later.

6 years agoDrop bus-policy bits
Zbigniew Jędrzejewski-Szmek [Sun, 23 Jul 2017 13:28:45 +0000 (09:28 -0400)] 
Drop bus-policy bits

6 years agoDrop busname unit type
Zbigniew Jędrzejewski-Szmek [Sun, 23 Jul 2017 13:24:39 +0000 (09:24 -0400)] 
Drop busname unit type

Since busname units are only useful with kdbus, they weren't actively
used. This was dead code, only compile-tested. If busname units are
ever added back, it'll be cleaner to start from scratch (possibly reverting
parts of this patch).

6 years agocore: when logging about dependency cycles, add UNIT= entries for all involved units 6429/head
Zbigniew Jędrzejewski-Szmek [Sat, 22 Jul 2017 19:52:20 +0000 (15:52 -0400)] 
core: when logging about dependency cycles, add UNIT= entries for all involved units

Example log:
Jul 22 15:55:21 fedora systemd[1]: a1.service: Found ordering cycle on a2.service/start
Jul 22 15:55:21 fedora systemd[1]: a1.service: Found dependency on a3.service/start
Jul 22 15:55:21 fedora systemd[1]: a1.service: Found dependency on a1.service/start
Jul 22 15:55:21 fedora systemd[1]: a1.service: Job a2.service/start deleted to break ordering cycle starting with a1.service/start
Jul 22 15:55:21 fedora systemd[1]: Starting a1.service...
Jul 22 15:55:21 fedora systemd[1]: Started a1.service.

Example log entry:

Sat 2017-07-22 15:55:21.372389 EDT [s=0004bb6302d94ac3aa69987fb6157338;i=9ae;b=a96eb6153d4f4f3686c7b4
    _BOOT_ID=a96eb6153d4f4f3686c7b4db8a432908
    _MACHINE_ID=ad18f69b80264b52bb3b766240742383
    _HOSTNAME=fedora
    PRIORITY=3
    SYSLOG_FACILITY=3
    SYSLOG_IDENTIFIER=systemd
    _UID=0
    _GID=0
    _PID=1
    _TRANSPORT=journal
    _CAP_EFFECTIVE=3fffffffff
    _COMM=systemd
    _EXE=/usr/lib/systemd/systemd
    _SYSTEMD_CGROUP=/init.scope
    _SYSTEMD_UNIT=init.scope
    _SYSTEMD_SLICE=-.slice
    _SELINUX_CONTEXT=system_u:system_r:kernel_t:s0
    CODE_FILE=../src/core/transaction.c
    CODE_FUNC=transaction_verify_order_one
    UNIT=a3.service
    UNIT=a1.service
    UNIT=a2.service
    CODE_LINE=430
    MESSAGE=a1.service: Job a2.service/start deleted to break ordering cycle starting with a1.service
    _CMDLINE=/usr/lib/systemd/systemd --system --deserialize 28
    _SOURCE_REALTIME_TIMESTAMP=1500753321372389

This should make it easier to see when any of the units are involved in an
ordering cycle.

Fixes #6336.

v2:
- also update the "Unable to break cycle" message.

6 years agoshared/dropin: improve error message
Zbigniew Jędrzejewski-Szmek [Sat, 22 Jul 2017 12:54:27 +0000 (08:54 -0400)] 
shared/dropin: improve error message

We're not just sorting, but actually creating the list. We can
also use the output parameter directly, without a temporary variable.

6 years agoRevert "core: don't load dropin data multiple times for the same unit (#5139)"
Zbigniew Jędrzejewski-Szmek [Sat, 22 Jul 2017 12:39:49 +0000 (08:39 -0400)] 
Revert "core: don't load dropin data multiple times for the same unit (#5139)"

This reverts commit 2d058a87ffb2d31a50422a8aebd119bbb4427244.

When we add another name to a unit (by following an alias), we need to
reload all drop-ins. This is necessary to load any additional dropins
found in the dirs created from the alias name.

Fixes #6334.

6 years agoman/systemd.network: DHCP defaults to "no" (#6423)
Lion Yang [Fri, 21 Jul 2017 20:21:30 +0000 (15:21 -0500)] 
man/systemd.network: DHCP defaults to "no" (#6423)

Code at: /src/network/networkd-network.c#L160

6 years agodoc/systemd-resolved.service: fix typo (#6422)
Lion Yang [Fri, 21 Jul 2017 20:20:49 +0000 (15:20 -0500)] 
doc/systemd-resolved.service: fix typo (#6422)

DNS sever => DNS server

6 years agocore: fix typo (#6417)
Yu Watanabe [Fri, 21 Jul 2017 08:36:39 +0000 (17:36 +0900)] 
core: fix typo (#6417)

6 years agotree-wide: fput[cs]() → fput[cs]_unlocked() wherever that makes sense (#6396)
Lennart Poettering [Fri, 21 Jul 2017 08:35:45 +0000 (10:35 +0200)] 
tree-wide: fput[cs]() → fput[cs]_unlocked() wherever that makes sense (#6396)

As a follow-up for db3f45e2d2586d78f942a43e661415bc50716d11 let's do the
same for all other cases where we create a FILE* with local scope and
know that no other threads hence can have access to it.

For most cases this shouldn't change much really, but this should speed
dbus introspection and calender time formatting up a bit.

6 years agoMerge pull request #6413 from poettering/getpid
Zbigniew Jędrzejewski-Szmek [Thu, 20 Jul 2017 19:14:13 +0000 (15:14 -0400)] 
Merge pull request #6413 from poettering/getpid

speed up getpid() again

6 years agonspawn: downgrade warning when we get sd_notify() message from unexpected process...
Lennart Poettering [Thu, 20 Jul 2017 18:46:58 +0000 (20:46 +0200)] 
nspawn: downgrade warning when we get sd_notify() message from unexpected process (#6416)

Given that we set NOTIFY_SOCKET unconditionally it's not surprising that
processes way down the process tree think it's smart to send us a
notification message.

It's still useful to keep this message, for debugging things, but it
shouldn't be generated by default.

6 years agotree-wide: make use of getpid_cached() wherever we can 6413/head
Lennart Poettering [Thu, 20 Jul 2017 14:19:18 +0000 (16:19 +0200)] 
tree-wide: make use of getpid_cached() wherever we can

This moves pretty much all uses of getpid() over to getpid_raw(). I
didn't specifically check whether the optimization is worth it for each
replacement, but in order to keep things simple and systematic I
switched over everything at once.

6 years agoprocess-util: add getpid_cached() as a caching wrapper for getpid()
Lennart Poettering [Thu, 20 Jul 2017 13:46:05 +0000 (15:46 +0200)] 
process-util: add getpid_cached() as a caching wrapper for getpid()

Let's make getpid() fast again.

6 years agoMerge pull request #6266 from keszybz/drop-autotools
Lennart Poettering [Thu, 20 Jul 2017 17:56:07 +0000 (19:56 +0200)] 
Merge pull request #6266 from keszybz/drop-autotools

Drop support for autotools / automake / make

6 years agocall chase_symlinks without the /sysroot prefix (#6411)
Harald Hoyer [Thu, 20 Jul 2017 17:13:09 +0000 (19:13 +0200)] 
call chase_symlinks without the /sysroot prefix (#6411)

In case fstab-generator is called in the initrd, chase_symlinks()
returns with a canonical path "/sysroot/sysroot/<mountpoint>", if the
"/sysroot" prefix is present in the path.

This patch skips the "/sysroot" prefix for the chase_symlinks() call,
because "/sysroot" is already the root directory and chase_symlinks()
prepends the root directory in the canonical path returned.

6 years agoMerge pull request #6386 from poettering/mkosi-without-tests
Martin Pitt [Thu, 20 Jul 2017 13:10:49 +0000 (15:10 +0200)] 
Merge pull request #6386 from poettering/mkosi-without-tests

mkosi: support mkosi's --without-tests switch

6 years agomkosi: use '[' rather than 'test' everywhere 6386/head
Lennart Poettering [Tue, 18 Jul 2017 08:30:52 +0000 (10:30 +0200)] 
mkosi: use '[' rather than 'test' everywhere

6 years agomkosi: support mkosi's --without-tests switch
Lennart Poettering [Mon, 17 Jul 2017 18:54:16 +0000 (20:54 +0200)] 
mkosi: support mkosi's --without-tests switch

This adds support for the mkosi switch --without-tests that is
introduced by:

https://github.com/systemd/mkosi/pull/122

With this in place doing "mkosi -ifT shell" is the fastest way from a
git clone to a shell within a freshly compiled systemd system.

6 years agohwdb: add two more hotkeys to Lenovo IdeaPad (#6410)
Shengyao Xue [Thu, 20 Jul 2017 12:21:48 +0000 (20:21 +0800)] 
hwdb: add two more hotkeys to Lenovo IdeaPad (#6410)

Tested on Lenovo IdeaPad E41-15, and both keys work after those two line added.

6 years agosd-path: make sure to use tmp_dir() and var_tmp_dir() (#6397)
Lennart Poettering [Thu, 20 Jul 2017 12:19:57 +0000 (14:19 +0200)] 
sd-path: make sure to use tmp_dir() and var_tmp_dir() (#6397)

Let's reuse the common code wherever appropriate.

6 years agotest-condition: don't assume that all non-root users are normal users (#6409)
Felipe Sateler [Thu, 20 Jul 2017 00:48:23 +0000 (20:48 -0400)] 
test-condition: don't assume that all non-root users are normal users (#6409)

Automated builders may run under a dedicated system user, and this test would fail that

Fixes #6366

6 years agovirt: enable detecting QEMU (TCG) via CPUID (#6399)
Daniel Berrange [Wed, 19 Jul 2017 09:06:07 +0000 (10:06 +0100)] 
virt: enable detecting QEMU (TCG) via CPUID (#6399)

QEMU >= 2.10 will include a CPUID leaf with value "TCGTCGTCGTCG"
on x86 when running with the TCG CPU emulator:

  https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg05231.html

Existing methods of detecting QEMU are left unchanged for sake of
backcompatibility.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
6 years agotest-unit-name: setup fake runtime directory before starting manager (#6401)
Yu Watanabe [Tue, 18 Jul 2017 17:26:09 +0000 (02:26 +0900)] 
test-unit-name: setup fake runtime directory before starting manager (#6401)

Since 3536f49e8fa281539798a7bc5004d73302f39673, manager_new() in
user mode requires XDG_RUNTIME_DIR is set. So, in this commit,
setup_fake_runtime_directory() is added in the beginning of test.

Fixes an issue comment in #6384.

6 years agocore/manager: fix memory leak (#6400)
Yu Watanabe [Tue, 18 Jul 2017 14:30:52 +0000 (23:30 +0900)] 
core/manager: fix memory leak (#6400)

This fixes the memory leak introduced by 3536f49e8fa281539798a7bc5004d73302f39673,
which forgot to free the prefixes in the manager.

Fixes #6398.

6 years agobuild-sys: rename SD_BOOT_LOG_TPM to ENABLE_TPM 6266/head
Zbigniew Jędrzejewski-Szmek [Thu, 13 Jul 2017 13:31:47 +0000 (09:31 -0400)] 
build-sys: rename SD_BOOT_LOG_TPM to ENABLE_TPM

This makes it more like other configure defines.

Also, it fixes meson status output which was looking for HAVE_ and ENABLE_
prefixes only (the define under meson was OK, just the summary message was
wrong.)

6 years agobuild-sys: add basic support for ./configure && make && make install
Zbigniew Jędrzejewski-Szmek [Fri, 14 Jul 2017 00:57:43 +0000 (20:57 -0400)] 
build-sys: add basic support for ./configure && make && make install

This adds the basic make support required by
https://github.com/cgwalters/build-api. CFLAGS, CXXFLAGS, DESTDIR variables are
supported:
   ./configure CFLAGS=... CXXFLAGS=... && make && make install DESTDIR=

6 years agoHACKING: update for meson
Zbigniew Jędrzejewski-Szmek [Thu, 13 Jul 2017 23:38:50 +0000 (19:38 -0400)] 
HACKING: update for meson

6 years agotest: try to guess the build directory
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jul 2017 03:00:43 +0000 (23:00 -0400)] 
test: try to guess the build directory

This will work if $(TOP_SRC_DIR) has exactly one subdirectory with
.ninja_deps. Otherwise, BUILD_DIR has to be specified.

6 years agotest: convert test/ to use meson install
Zbigniew Jędrzejewski-Szmek [Sat, 1 Jul 2017 16:01:30 +0000 (12:01 -0400)] 
test: convert test/ to use meson install

Automatic rebuilding is removed: it doesn't play well with ninja, because
ninja always writes logs, and even if nothing needs to be built, it will
make the log file owned by root. So let's just remove this, and say that
the user must always do the build first.

I'm also keeping make for the tests, because ninja doesn't play well with
sudo.

Since the build directory is arbitrary, it needs to be specified, e.g.
  sudo make BUILD_DIR=/home/zbyszek/src/systemd/build1 -C test/TEST-01-BASIC/

6 years agobuild-sys: drop gitignore patterns for in-tree builds
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 14:20:38 +0000 (10:20 -0400)] 
build-sys: drop gitignore patterns for in-tree builds

... and other autotools-generated files.

6 years agopython: remove star imports
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 00:26:32 +0000 (20:26 -0400)] 
python: remove star imports

Star imports are discouraged and break pyflakes.

I'm happy to report that pyflakes finds no issues ;)

6 years agobuild-sys: drop support for generation of Makefile-man.am
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 00:22:35 +0000 (20:22 -0400)] 
build-sys: drop support for generation of Makefile-man.am

6 years agobuild-sys: drop automake support
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 00:21:34 +0000 (20:21 -0400)] 
build-sys: drop automake support

v2:
- also mention m4

6 years agomailmap: add entry
Zbigniew Jędrzejewski-Szmek [Sat, 15 Jul 2017 15:50:14 +0000 (11:50 -0400)] 
mailmap: add entry

6 years agocore: add {State,Cache,Log,Configuration}Directory= (#6384)
Yu Watanabe [Tue, 18 Jul 2017 12:34:52 +0000 (21:34 +0900)] 
core: add {State,Cache,Log,Configuration}Directory= (#6384)

This introduces {State,Cache,Log,Configuration}Directory= those are
similar to RuntimeDirectory=. They create the directories under
/var/lib, /var/cache/, /var/log, or /etc, respectively, with the mode
specified in {State,Cache,Log,Configuration}DirectoryMode=.

This also fixes #6391.

6 years agoMerge pull request #6349 from poettering/mkosi-builddir
Lennart Poettering [Tue, 18 Jul 2017 07:46:08 +0000 (09:46 +0200)] 
Merge pull request #6349 from poettering/mkosi-builddir

mkosi builddir support

6 years agomkosi: add m4 (#6389)
Lucas Werkmeister [Mon, 17 Jul 2017 22:51:14 +0000 (00:51 +0200)] 
mkosi: add m4 (#6389)

This seems to be required since the move to meson.

6 years agotests: ignore router state in networkd test (#6390)
Martin Pitt [Mon, 17 Jul 2017 22:06:35 +0000 (00:06 +0200)] 
tests: ignore router state in networkd test (#6390)

In networkd-test.py, don't assert that the router state is "routable".
While it should eventually become that, we don't wait for it, and thus
at that point it often is "carrier" or "degrated" still. It is also not
really relevant as this only tests the "client" side interface.

6 years agobasic: use _unlocked() stdio in strip_tab_ansi() (#6385)
Vito Caputo [Mon, 17 Jul 2017 22:05:52 +0000 (15:05 -0700)] 
basic: use _unlocked() stdio in strip_tab_ansi() (#6385)

Trivial performance boost by explicitly bypassing the implicit
locking of stdio.

This significantly affects common cases of `journalctl` usage:

 Before:

  # time ./journalctl -b -1 > /dev/null
   real    0m26.628s
   user    0m26.495s
   sys     0m0.125s

  # time ./journalctl -b -1 > /dev/null
   real    0m27.069s
   user    0m26.936s
   sys     0m0.134s

  # time ./journalctl -b -1 > /dev/null
   real    0m26.727s
   user    0m26.607s
   sys     0m0.119s

 After:

  # time ./journalctl -b -1 > /dev/null
   real    0m23.394s
   user    0m23.244s
   sys     0m0.142s

  # time ./journalctl -b -1 > /dev/null
   real    0m23.283s
   user    0m23.160s
   sys     0m0.121s

  # time ./journalctl -b -1 > /dev/null
   real    0m23.274s
   user    0m23.125s
   sys     0m0.144s

Fixes https://github.com/systemd/systemd/issues/6341

6 years agoMerge pull request #6387 from keszybz/fix-timeout-0
Lennart Poettering [Mon, 17 Jul 2017 22:04:24 +0000 (00:04 +0200)] 
Merge pull request #6387 from keszybz/fix-timeout-0

Fix x-systemd.timeout=0 in fstab

6 years agomkosi: roll back to libidn on Arch (#6388)
Lucas Werkmeister [Mon, 17 Jul 2017 20:41:31 +0000 (22:41 +0200)] 
mkosi: roll back to libidn on Arch (#6388)

This reverts the mkosi.arch part of a8a2a0ed64. libidn2 is only
available on AUR, which mkosi doesn’t support.

6 years agoUse config_parse_sec_fix_0() also for JobRunningTimeoutSec 6387/head
Zbigniew Jędrzejewski-Szmek [Mon, 17 Jul 2017 19:45:44 +0000 (15:45 -0400)] 
Use config_parse_sec_fix_0() also for JobRunningTimeoutSec

2d79a0bbb9f651656384a0a86ed814e6306fb5dd did that for TimeoutSec=,
89beff89edba592366b2960bd830d3f6e602c2c7 did that for JobTimeoutSec=,
and 0004f698df1410ef8b6ab3fb5f4b41a60c91182c did that for
x-systemd.device-timeout=. But after parsing x-systemd.device-timeout=xxx
we write it out as JobRunningTimeoutSec=xxx. Two options:
- write out JobRunningTimeoutSec=<a very big number>,
- change JobRunningTimeoutSec= to behave like the other options.

I think it would be confusing for JobRunningTimeoutSec= to have different
syntax then TimeoutSec= and JobTimeoutSec=, so this patch implements the
second option.

Fixes #6264, https://bugzilla.redhat.com/show_bug.cgi?id=1462378.

6 years agoman: make crypttab(5) a bit easier to read
Zbigniew Jędrzejewski-Szmek [Mon, 17 Jul 2017 20:03:17 +0000 (16:03 -0400)] 
man: make crypttab(5) a bit easier to read

6 years agomkosi: make use of BUILDDIR if it is set 6349/head
Lennart Poettering [Wed, 12 Jul 2017 17:58:53 +0000 (19:58 +0200)] 
mkosi: make use of BUILDDIR if it is set

This way, the new "mkosi.builddir" support proposed in PR:

https://github.com/systemd/mkosi/pull/114

will be made use of automatically.

6 years agogitignore: include mkosi -i files in gitignore
Lennart Poettering [Wed, 12 Jul 2017 17:58:35 +0000 (19:58 +0200)] 
gitignore: include mkosi -i files in gitignore

(also: sort the entries again)

6 years agojournald: make sure we retain all stream fds across restarts (#6348)
Michal Sekletar [Mon, 17 Jul 2017 08:04:37 +0000 (10:04 +0200)] 
journald: make sure we retain all stream fds across restarts (#6348)

Currently we set 4096 as maximum for number of stream connections that
we accept. However maximum number of file descriptors that systemd is
willing to accept from us is just 1024. This means we can't retain all
stream connections that we accepted. Hence bump the limit of fds in a
unit file so that systemd holds open all stream fds while we are
restarted.

New limit is set to 4224 (4096 + 128).

6 years agoMerge pull request #6354 from walyong/smack_process_label_free
Lennart Poettering [Mon, 17 Jul 2017 08:04:12 +0000 (10:04 +0200)] 
Merge pull request #6354 from walyong/smack_process_label_free

core: modify resource leak and missed security context dump

6 years agoMerge pull request #6355 from vcaputo/journal_avoid_mmap_cache_get_calls
Lennart Poettering [Mon, 17 Jul 2017 08:03:52 +0000 (10:03 +0200)] 
Merge pull request #6355 from vcaputo/journal_avoid_mmap_cache_get_calls

journal: avoid unnecessary mmap_cache_get() calls

6 years agofstab-generator: ignore x-systemd.device-timeout for non-devices (#6368)
NeilBrown [Mon, 17 Jul 2017 08:03:34 +0000 (18:03 +1000)] 
fstab-generator: ignore x-systemd.device-timeout for non-devices (#6368)

If you specify "x-systemd.device-timeout" for an NFS mount
point, you get no warning and a meaningless device unit
dependency created.

Better to have a warning and no dependency.

6 years agoMerge pull request #6367 from keszybz/enable-tpm
Lennart Poettering [Mon, 17 Jul 2017 08:03:13 +0000 (10:03 +0200)] 
Merge pull request #6367 from keszybz/enable-tpm

build-sys: enable tpm by default

6 years agoMerge pull request #6324 from keszybz/generator-add-symlink
Lennart Poettering [Mon, 17 Jul 2017 08:02:54 +0000 (10:02 +0200)] 
Merge pull request #6324 from keszybz/generator-add-symlink

Add helper function for creation of unit symlinks in generators

6 years agoMerge pull request #6328 from yuwata/runtime-preserve
Lennart Poettering [Mon, 17 Jul 2017 08:02:19 +0000 (10:02 +0200)] 
Merge pull request #6328 from yuwata/runtime-preserve

core: Allow preserving contents of RuntimeDirectory over process restart

6 years agocore: support subdirectories in RuntimeDirectory= option 6328/head
Yu Watanabe [Mon, 17 Jul 2017 07:30:53 +0000 (16:30 +0900)] 
core: support subdirectories in RuntimeDirectory= option

6 years agocore: allow preserving contents of RuntimeDirectory= over process restart
Yu Watanabe [Mon, 17 Jul 2017 07:22:25 +0000 (16:22 +0900)] 
core: allow preserving contents of RuntimeDirectory= over process restart

This introduces RuntimeDirectoryPreserve= option which takes a boolean
argument or 'restart'.

Closes #6087.

6 years agoMerge pull request #6380 from keszybz/seccomp-arm64
Lennart Poettering [Sun, 16 Jul 2017 14:17:59 +0000 (16:17 +0200)] 
Merge pull request #6380 from keszybz/seccomp-arm64

Seccomp arm64

6 years agotest-seccomp: arm64 does not have access() and poll() 6380/head
Zbigniew Jędrzejewski-Szmek [Sat, 15 Jul 2017 19:30:48 +0000 (19:30 +0000)] 
test-seccomp: arm64 does not have access() and poll()

glibc uses faccessat and ppoll, so just add a filters for that.

(cherry picked from commit abc0213839fef92e2e2b98a434914f22ece48490)

6 years agoseccomp: arm64 does not have mmap2
Zbigniew Jędrzejewski-Szmek [Sat, 15 Jul 2017 19:30:01 +0000 (19:30 +0000)] 
seccomp: arm64 does not have mmap2

I messed up when adding the definitions in 4278d1f5310f5acb4c6a6788233625234edb5145.
Unfortunately I didn't have the hardware at hand and went by
looking at the kernel headers.

(cherry picked from commit 53196fafcb7b24b45ed4f48ab894d00a24a6d871)

6 years agoseccomp: arm64/x32 do not have _sysctl
Zbigniew Jędrzejewski-Szmek [Sat, 15 Jul 2017 19:28:02 +0000 (19:28 +0000)] 
seccomp: arm64/x32 do not have _sysctl

So don't even try to added the filter to reduce noise.
The test is updated to skip calling _sysctl because the kernel prints
an oops-like message that is confusing and unhelpful:

Jul 15 21:07:01 rpi3 kernel: test-seccomp[8448]: syscall -10080
Jul 15 21:07:01 rpi3 kernel: Code: aa0503e4 aa0603e5 aa0703e6 d4000001 (b13ffc1f)
Jul 15 21:07:01 rpi3 kernel: CPU: 3 PID: 8448 Comm: test-seccomp Tainted: G        W       4.11.8-300.fc26.aarch64 #1
Jul 15 21:07:01 rpi3 kernel: Hardware name: raspberrypi rpi/rpi, BIOS 2017.05 06/24/2017
Jul 15 21:07:01 rpi3 kernel: task: ffff80002bb0bb00 task.stack: ffff800036354000
Jul 15 21:07:01 rpi3 kernel: PC is at 0xffff8669c7c4
Jul 15 21:07:01 rpi3 kernel: LR is at 0xaaaac64b6750
Jul 15 21:07:01 rpi3 kernel: pc : [<0000ffff8669c7c4>] lr : [<0000aaaac64b6750>] pstate: 60000000
Jul 15 21:07:01 rpi3 kernel: sp : 0000ffffdc640fd0
Jul 15 21:07:01 rpi3 kernel: x29: 0000ffffdc640fd0 x28: 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x27: 0000000000000000 x26: 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x25: 0000000000000000 x24: 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x23: 0000000000000000 x22: 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x21: 0000aaaac64b4940 x20: 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x19: 0000aaaac64b88f8 x18: 0000000000000020
Jul 15 21:07:01 rpi3 kernel: x17: 0000ffff8669c7a0 x16: 0000aaaac64d2ee0
Jul 15 21:07:01 rpi3 kernel: x15: 0000000000000000 x14: 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x13: 203a657275746365 x12: 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x11: 0000ffffdc640418 x10: 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x9 : 0000000000000005 x8 : 00000000ffffd8a0
Jul 15 21:07:01 rpi3 kernel: x7 : 7f7f7f7f7f7f7f7f x6 : 7f7f7f7f7f7f7f7f
Jul 15 21:07:01 rpi3 kernel: x5 : 65736d68716f7277 x4 : 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x3 : 0000000000000008 x2 : 0000000000000000
Jul 15 21:07:01 rpi3 kernel: x1 : 0000000000000000 x0 : 0000000000000000
Jul 15 21:07:01 rpi3 kernel:

(cherry picked from commit 1e20e640132c700c23494bb9e2619afb83878380)

6 years agoshared/seccomp-util: add parentheses and no. after syscall name
Zbigniew Jędrzejewski-Szmek [Sat, 15 Jul 2017 19:25:19 +0000 (19:25 +0000)] 
shared/seccomp-util: add parentheses and no. after syscall name

"Failed to add rule for system call access, ignoring: Numerical argument out of domain"
is confusing. Make that "... system call access() / 238".

(cherry picked from commit 977dc6ca5acb8069a2966ec63e7378576bc2ca51)

6 years agoFix spelling (#6378)
Lucas Werkmeister [Sat, 15 Jul 2017 16:29:09 +0000 (18:29 +0200)] 
Fix spelling (#6378)

6 years agojournald: make reading /dev/kmsg optional (#6362)
Susant Sahani [Sat, 15 Jul 2017 11:57:52 +0000 (11:57 +0000)] 
journald: make reading /dev/kmsg optional (#6362)

Closes #6022

6 years agoadd version argument to help function (#6377)
IPv4v6 [Sat, 15 Jul 2017 11:53:21 +0000 (13:53 +0200)] 
add version argument to help function (#6377)

Signed-off-by: Stefan Pietsch <mail.ipv4v6+gh@gmail.com>
6 years agocore: support "nsdelegate" cgroup v2 mount option (#6294)
Tejun Heo [Fri, 14 Jul 2017 17:27:13 +0000 (13:27 -0400)] 
core: support "nsdelegate" cgroup v2 mount option (#6294)

cgroup namespace wasn't useful for delegation because it allowed resource
control interface files (e.g. memory.high) to be written from inside the
namespace - this allowed the namespace parent's resource distribution to be
disturbed by its namespace-scoped children.

A new mount option, "nsdelegate", was added to cgroup v2 to address this issue.
The flag is meangingful only when mounting cgroup v2 in the init namespace and
makes a cgroup namespace a delegation boundary.  The kernel feature is pending
for v4.13.

This should have been the default behavior on cgroup namespaces and this commit
makes systemd try "nsdelegate" first when trying to mount cgroup v2 and fall
back if the option is not supported.

Note that this has danger of breaking usages which depend on modifying the
parent's resource settings from the namespace root, which isn't a valid thing
to do, but such usages may still exist.