Zbigniew Jędrzejewski-Szmek [Thu, 17 Nov 2016 01:51:47 +0000 (20:51 -0500)]
systemctl: shorter list-jobs --before/--after output a bit
(before)$ systemctl list-jobs --before --after
JOB UNIT TYPE STATE
8769 foobar.device start running
A job waits for this job: 8669 (run-rb6da596d0cfa4e36b7c594cd973e795a.service/start)
8669 run-rb6da596d0cfa4e36b7c594cd973e795a.service start waiting
This job waits for a job: 8769 (foobar.device/start)
2 jobs listed.
(after)$ systemctl list-jobs --before --after
JOB UNIT TYPE STATE
8769 foobar.device start running
waiting for job 8669 (run-rb6da596d0cfa4e36b7c594cd973e795a.service/start)
8669 run-rb6da596d0cfa4e36b7c594cd973e795a.service start waiting
blocking job 8769 (foobar.device/start)
2 jobs listed.
Lennart Poettering [Wed, 16 Nov 2016 14:03:08 +0000 (15:03 +0100)]
update TODO
Lennart Poettering [Wed, 16 Nov 2016 15:44:05 +0000 (16:44 +0100)]
systemctl: show waiting jobs when "systemctl list-jobs --after/--before" is called
Let's expose the new bus functions we added in the previous commit in
systemctl.
Lennart Poettering [Wed, 16 Nov 2016 15:07:32 +0000 (16:07 +0100)]
core: add bus calls for determining jobs waiting for other jobs
This should make it easier to debug job deadlocks.
Lennart Poettering [Wed, 16 Nov 2016 13:44:04 +0000 (14:44 +0100)]
system-run: add support for configuring unit dependencies with --property=
Support on the server side has already been in place for quite some time, let's
also add support on the client side for this.
Lennart Poettering [Wed, 16 Nov 2016 13:31:03 +0000 (14:31 +0100)]
systemctl: add env var to force connection to system manager via the bus
Sometimes it is useful for debugging purposes to force systemctl to connect to
PID 1 via the bus instead of direct connection, even if the direct connection
is possible.
Lennart Poettering [Tue, 15 Nov 2016 18:32:50 +0000 (19:32 +0100)]
core: GC redundant device jobs from the run queue
In contrast to all other unit types device units when queued just track
external state, they cannot effect state changes on their own. Hence unless a
client or other job waits for them there's no reason to keep them in the job
queue. This adds a concept of GC'ing jobs of this type as soon as no client or
other job waits for them anymore.
To ensure this works correctly we need to track which clients actually
reference a job (i.e. which ones enqueued it). Unfortunately that's pretty
nasty to do for direct connections, as sd_bus_track doesn't work for
them. For now, work around this, by simply remembering in a boolean that a job
was requested by a direct connection, and reset it when we notice the direct
connection is gone. This means the GC logic works fine, except that jobs are
not immediately removed when direct connections disconnect.
In the longer term, a rework of the bus logic should fix this properly. For now
this should be good enough, as GC works for fine all cases except this one, and
thus is a clear improvement over the previous behaviour.
Fixes: #1921
Lennart Poettering [Tue, 15 Nov 2016 18:29:50 +0000 (19:29 +0100)]
core: rename "clients" field of Job structure to "bus_track"
Let's make semantics of this field more similar to the same functionality in
the Unit object, in particular as we add new functionality to it later on.
Lennart Poettering [Tue, 15 Nov 2016 18:23:29 +0000 (19:23 +0100)]
core: drop n_in_gc_queue field of Manager structure
We count the units in the GC queue with this, but actually never make use of
it, hence drop it.
Lennart Poettering [Tue, 15 Nov 2016 18:19:57 +0000 (19:19 +0100)]
core: a few small coding style/modernization updates for job.c
Lennart Poettering [Tue, 15 Nov 2016 18:18:36 +0000 (19:18 +0100)]
shared: split out code for adding multiple names to sd_bus_track object
Let's introduce a new call bus_track_add_name_many() that adds a string list to
a tracking object.
Djalal Harouni [Tue, 15 Nov 2016 19:45:27 +0000 (20:45 +0100)]
Merge pull request #4658 from endocode/djalal/sandbox-various-fixes-v1
core: improve the logic that implies no new privileges and documentation fixes
Evgeny Vereshchagin [Tue, 15 Nov 2016 16:38:04 +0000 (19:38 +0300)]
tests: add UNIFIED_CGROUP_HIERARCHY=[default|hybrid] (#4675)
This will simplify testing a bit.
Mainly for https://github.com/systemd/systemd/pull/4670
Djalal Harouni [Tue, 15 Nov 2016 14:15:37 +0000 (15:15 +0100)]
bus-util: print RestrictNamespaces= as a string
Allow all callers that want to print RestrictNamespaces= returned from D-Bus
as a string instead of a u64 value.
Djalal Harouni [Tue, 15 Nov 2016 14:50:19 +0000 (15:50 +0100)]
test: add tests for RestrictNamespaces=
Djalal Harouni [Mon, 14 Nov 2016 08:12:21 +0000 (09:12 +0100)]
core:gperf: pass the exec_context struct directly to parse restrict namespaces
The RestrictNamespaces= takes yes, no or a list of namespaces types,
therefor config_parse_restrict_namespaces() is a bit complex and it
operates on the ExecContext, fix this by passing the offset of
ExecContext directly otherwise restricting namespaces won't work.
Djalal Harouni [Mon, 14 Nov 2016 07:32:06 +0000 (08:32 +0100)]
doc: move ProtectKernelModules= documentation near ProtectKernelTunalbes=
Djalal Harouni [Mon, 14 Nov 2016 07:24:41 +0000 (08:24 +0100)]
core: property is RestrictNamespaces with s
Djalal Harouni [Mon, 14 Nov 2016 09:02:00 +0000 (10:02 +0100)]
doc: note when no new privileges is implied
Djalal Harouni [Tue, 15 Nov 2016 09:15:27 +0000 (10:15 +0100)]
core: improve the logic that implies no new privileges
The no_new_privileged_set variable is not used any more since commit
9b232d3241fcfbf60af that fixed another thing. So remove it. Also no
need to check if we are under user manager, remove that part too.
David Herrmann [Mon, 14 Nov 2016 11:08:38 +0000 (12:08 +0100)]
Merge pull request #4665 from teg/networkd-split-1
networkd: split sources into subdirectories
Zbigniew Jędrzejewski-Szmek [Mon, 14 Nov 2016 10:49:49 +0000 (05:49 -0500)]
nspawn: restart the whole systemd-nspawn@.service unit on container reboot (#4613)
Since 133 is now used in a few places, add a #define for it.
Also make the status message a bit informative.
Another issue introduced in b006762. The logic was borked, we were supposed
to return 0 to break the loop, and 133 to restart the container, not the other
way around.
But this doesn't seem to work, reboot fails with:
Nov 08 00:41:32 laptop systemd-nspawn[26564]: Failed to register machine: Machine 'fedora-rawhide' already exists
So actually the version before this patch worked better, since 133 > 0 and we'd
at least loop internally.
Maks Naumov [Mon, 14 Nov 2016 10:33:43 +0000 (12:33 +0200)]
link: fix offload features initialization (#4639)
Tom Gundersen [Sun, 13 Nov 2016 03:59:06 +0000 (04:59 +0100)]
networkd: clean up main header file a bit
Rename networkd.h to networkd-manager.h, to more accurately describe what it
contains.
Tom Gundersen [Sun, 13 Nov 2016 01:01:19 +0000 (02:01 +0100)]
networkd: netdev - move to separate subdirectory
This could (and should) be made into a separate daemon, at least move
the sourcefiles out for now.
Tom Gundersen [Sun, 13 Nov 2016 00:29:28 +0000 (01:29 +0100)]
networkd-wait-online: move to separate subdirectory
Also clean up the header files a bit.
Tom Gundersen [Wed, 28 Sep 2016 10:32:31 +0000 (12:32 +0200)]
networkd: network - apply() does not need to take the manager object
Michael Biebl [Sat, 12 Nov 2016 18:47:32 +0000 (19:47 +0100)]
Merge pull request #4659 from keszybz/ctrl-alt-del-twice
build-sys: do not install ctrl-alt-del.target symlink twice
Zbigniew Jędrzejewski-Szmek [Sat, 12 Nov 2016 15:05:24 +0000 (10:05 -0500)]
build-sys: do not install ctrl-alt-del.target symlink twice
It was a harmless but pointless duplication. Fixes #4655.
Note: in general we try to install as little as possible in
/etc/systemd/{system,user}. We only install .wants links there for units which
are "user configurable", i.e. which have an [Install] section. Most our units
and aliases are not user configurable, do not have an [Install] section, and
must be symlinked statically during installation. A few units do have an
[Install] section, and are enabled through symlinks in /etc/ during
installation using GENERAL_ALIASES. It *would* be possible to not create those
symlinks, and instead require 'systemctl preset' to be invoked after
installation, but GENERAL_ALIASES works well enough.
Lucas Werkmeister [Sat, 12 Nov 2016 03:25:32 +0000 (04:25 +0100)]
man: add Itanium root GUID to table (#4656)
This GUID was added in #2263, but the manpage was not updated.
Felipe Sateler [Sat, 12 Nov 2016 02:28:06 +0000 (23:28 -0300)]
systemctl: resolve symlinks when finding unit paths (#4545)
Otherwise we think the alias is the real unit, and may edit/cat the
wrong unit.
Before this patch:
$ systemctl edit autovt@ # creates dropin in /etc/systemd/system/autovt@.service.d
$ systemctl cat autovt@ | grep @.service
# /lib/systemd/system/autovt@.service
# that serial gettys are covered by serial-getty@.service, not this
# /etc/systemd/system/autovt@.service.d/override.conf
$ systemctl cat getty@ | grep @.service
# /lib/systemd/system/getty@.service
# that serial gettys are covered by serial-getty@.service, not this
After this patch
$ systemctl edit autovt@ # creates dropin in /etc/systemd/system/getty@.service.d
$ systemctl cat autovt@ | grep @.service
# /usr/lib/systemd/system/getty@.service
# that serial gettys are covered by serial-getty@.service, not this
# /etc/systemd/system/getty@.service.d/override.conf
systemctl cat getty@ | grep @.service
# /usr/lib/systemd/system/getty@.service
# that serial gettys are covered by serial-getty@.service, not this
# /etc/systemd/system/getty@.service.d/override.conf
Djalal Harouni [Fri, 11 Nov 2016 23:49:20 +0000 (00:49 +0100)]
Merge pull request #4652 from mbiebl/configure-bzip2
various small cleanups in our configure help output
Zbigniew Jędrzejewski-Szmek [Fri, 11 Nov 2016 18:00:33 +0000 (13:00 -0500)]
units: disable /sys/fs/fuse/connections in private user namespaces (#4592)
The mount fails, even though CAP_SYS_ADMIN is granted.
Only file systems with FU_USERNS_MOUNT in .fs_flags may be mounted in userns,
and the patch to add that fusectl was rejected [1]. It would be nice if we
could check if the kernel has FU_USERNS_MOUNT for a given fs type, since this
could change over time, but this information doesn't seem to be exported.
So let's just skip this mount in userns to avoid an error during boot.
[1] https://patchwork.kernel.org/patch/2828269/
Zbigniew Jędrzejewski-Szmek [Fri, 11 Nov 2016 17:58:41 +0000 (12:58 -0500)]
tree-wide: make invocations of extract_first_word more uniform (#4627)
extract_first_words deals fine with the string being NULL, so drop the upfront
check for that.
akochetkov [Fri, 11 Nov 2016 17:50:46 +0000 (20:50 +0300)]
timesyncd: clear ADJ_MAXERROR to keep STA_UNSYNC cleared after jump adjust (#4626)
NTP use jump adjust if system has incorrect time read from RTC during boot.
It is desireble to update RTC time as soon as NTP set correct system time.
Sometimes kernel failed to update RTC due to STA_UNSYNC get set before RTC
update finised. In that case RTC time wouldn't be updated within long time.
The commit makes RTC updates stable.
When NTP do jump time adjust using ADJ_SETOFFSET it clears STA_UNSYNC flag.
If don't clear ADJ_MAXERROR, STA_UNSYNC will be set again by kernel within
1 second (by second_overflow() function). STA_UNSYNC flag prevent RTC updates
in kernel. Sometimes the kernel is able to update RTC withing 1 second,
but sometimes it falied.
Michael Biebl [Fri, 11 Nov 2016 16:02:26 +0000 (17:02 +0100)]
build-sys: use lowercase consistently in AS_HELP_STRING
We were using a mix of upper and lowercase. Since autoconf's own help
output uses lowercase, use that as well.
Zbigniew Jędrzejewski-Szmek [Fri, 11 Nov 2016 15:54:54 +0000 (10:54 -0500)]
basic/virt: fix userns check on CONFIG_USER_NS=n kernel (#4651)
ENOENT should be treated as "false", but because of the broken errno check it
was treated as an error. So ConditionVirtualization=user-namespaces probably
returned the correct answer, but only by accident.
Fixes #4608.
Michael Biebl [Fri, 11 Nov 2016 15:41:26 +0000 (16:41 +0100)]
build-sys: replace obsolete AC_HELP_STRING with AS_HELP_STRING
The AC_HELP_STRING autoconf macro is obsolete. Use AS_HELP_STRING instead.
Michael Biebl [Fri, 11 Nov 2016 15:34:49 +0000 (16:34 +0100)]
build-sys: fix help text of bzip2 configure check
The bzip2 support is enabled by default unless requested otherwise via
--disable-bzip2. Make the help text reflect that.
Fixes: #4636
Christian Hesse [Fri, 11 Nov 2016 14:08:57 +0000 (15:08 +0100)]
fstab-generator: add x-systemd.mount-timeout (#4603)
This adds a new systemd fstab option x-systemd.mount-timeout. The option
adds a timeout value that specifies how long systemd waits for the mount
command to finish. It allows to mount huge btrfs volumes without issues.
This is equivalent to adding option TimeoutSec= to [Mount] section in a
mount unit file.
fixes #4055
Zbigniew Jędrzejewski-Szmek [Fri, 11 Nov 2016 12:39:20 +0000 (07:39 -0500)]
test-nss: allow the module and names/addresses to be specified (#4258)
Useful for testing a single module. If nothing is specified, behaviour is the
same as before.
$ ./test-nss myhostname 192.168.0.14 localhost
======== myhostname ========
_nss_myhostname_gethostbyname4_r("localhost") → status=NSS_STATUS_SUCCESS
pat=buffer+0x38 errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
"localhost" AF_INET 127.0.0.1 %lo
"localhost" AF_INET6 ::1 %lo
_nss_myhostname_gethostbyname3_r("localhost", AF_INET) → status=NSS_STATUS_SUCCESS
errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
"localhost"
AF_INET 127.0.0.1
canonical: "localhost"
_nss_myhostname_gethostbyname3_r("localhost", AF_INET6) → status=NSS_STATUS_SUCCESS
errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
"localhost"
AF_INET6 ::1
canonical: "localhost"
_nss_myhostname_gethostbyname3_r("localhost", *) → status=NSS_STATUS_SUCCESS
errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
"localhost"
AF_INET 127.0.0.1
canonical: "localhost"
_nss_myhostname_gethostbyname3_r("localhost", AF_UNIX) → status=NSS_STATUS_UNAVAIL
errno=97/EAFNOSUPPORT h_errno=4/No address associated with name ttl=
2147483647
_nss_myhostname_gethostbyname2_r("localhost", AF_INET) → status=NSS_STATUS_SUCCESS
errno=0/--- h_errno=0/Resolver Error 0 (no error)
"localhost"
AF_INET 127.0.0.1
_nss_myhostname_gethostbyname2_r("localhost", AF_INET6) → status=NSS_STATUS_SUCCESS
errno=0/--- h_errno=0/Resolver Error 0 (no error)
"localhost"
AF_INET6 ::1
_nss_myhostname_gethostbyname2_r("localhost", *) → status=NSS_STATUS_SUCCESS
errno=0/--- h_errno=0/Resolver Error 0 (no error)
"localhost"
AF_INET 127.0.0.1
_nss_myhostname_gethostbyname2_r("localhost", AF_UNIX) → status=NSS_STATUS_UNAVAIL
errno=97/EAFNOSUPPORT h_errno=4/No address associated with name
_nss_myhostname_gethostbyname_r("localhost") → status=NSS_STATUS_SUCCESS
errno=0/--- h_errno=0/Resolver Error 0 (no error)
"localhost"
AF_INET 127.0.0.1
_nss_myhostname_gethostbyaddr2_r("192.168.0.14") → status=NSS_STATUS_SUCCESS
errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
"laptop"
AF_INET 192.168.0.14
AF_INET 192.168.122.1
AF_INET 169.254.209.76
_nss_myhostname_gethostbyaddr_r("192.168.0.14") → status=NSS_STATUS_SUCCESS
errno=0/--- h_errno=0/Resolver Error 0 (no error)
"laptop"
AF_INET 192.168.0.14
AF_INET 192.168.122.1
AF_INET 169.254.209.76
Zbigniew Jędrzejewski-Szmek [Fri, 11 Nov 2016 12:31:52 +0000 (07:31 -0500)]
man: update machine-id(5) with a note about privacy (#4645)
Djalal Harouni [Fri, 11 Nov 2016 10:07:40 +0000 (11:07 +0100)]
Merge pull request #4647 from evverx/arch-testsuite
tests: fix kernel/initrd searching (Arch)
Evgeny Vereshchagin [Fri, 11 Nov 2016 02:45:38 +0000 (13:45 +1100)]
tests: fix kernel/initrd searching (Arch)
We can run
sudo make run
instead of the
sudo make run KERNEL_BIN=/boot/vmlinuz-linux INITRD=/boot/initramfs-linux.img
See https://github.com/systemd/systemd/issues/4607
Susant Sahani [Thu, 10 Nov 2016 23:34:19 +0000 (05:04 +0530)]
networkd: support setting dhcp client listen port (#4631)
Allow setting custom port for the DHCP client to listen on in networkd.
[DHCP]
ListenPort=6677
Zbigniew Jędrzejewski-Szmek [Thu, 10 Nov 2016 23:31:46 +0000 (18:31 -0500)]
Merge pull request #4635 from eworm-de/resolved
resolved: unlink /run/systemd/resolve/resolv.conf upon exit
Lucas Werkmeister [Thu, 10 Nov 2016 23:20:44 +0000 (00:20 +0100)]
man: mention start rate limiting in Restart= doc (#4637)
Zbigniew Jędrzejewski-Szmek [Thu, 10 Nov 2016 22:09:44 +0000 (17:09 -0500)]
Merge pull request #4104 from ssahani/ethtool_xlink_settings
Link: port to new ethtool ETHTOOL_xLINKSETTINGS
Zbigniew Jędrzejewski-Szmek [Thu, 10 Nov 2016 18:52:15 +0000 (13:52 -0500)]
Merge pull request #4618 from grawity/signal-direction
busctl introspect: accept direction="out" for signals.
Djalal Harouni [Thu, 10 Nov 2016 17:11:37 +0000 (18:11 +0100)]
core:namespace: count and free failed paths inside chase_all_symlinks() (#4619)
This certainly fixes a bug that was introduced by PR
https://github.com/systemd/systemd/pull/4594 that intended to fix
https://github.com/systemd/systemd/issues/4567.
The fix was not complete. This patch makes sure that we count and free
all paths that fail inside chase_all_symlinks().
Fixes https://github.com/systemd/systemd/issues/4567
Christian Hesse [Wed, 9 Nov 2016 16:13:28 +0000 (17:13 +0100)]
resolved: unlink private resolv.conf on exit
This fixes the logic with systemd-nspawn which checks for private
resov.conf to decide whether or not to mount it into the container.
Christian Hesse [Wed, 9 Nov 2016 15:48:15 +0000 (16:48 +0100)]
resolved: use macro for private resolve.conf
Use the macro from header file to have a single definition of the path.
Susant Sahani [Fri, 4 Nov 2016 09:55:07 +0000 (15:25 +0530)]
Link: port to new ethtool ETHTOOL_xLINKSETTINGS
Link: port to new ethtool ETHTOOL_xLINKSETTINGS
This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API,
handled by the new get_link_ksettings/set_link_ksettings .
This is a WIP version based on this [kernel
patch](https://patchwork.kernel.org/patch/8411401/).
commit 0527f1c
http://github.com/torvalds/linux/commit/3f1ac7a700d039c61d8d8b99f28d605d489a60cfommit
35afb33
Martin Pitt [Thu, 10 Nov 2016 04:33:13 +0000 (05:33 +0100)]
core: don't use the unified hierarchy for the systemd cgroup yet (#4628)
Too many things don't get along with the unified hierarchy yet:
* https://github.com/opencontainers/runc/issues/1175
* https://github.com/docker/docker/issues/28109
* https://github.com/lxc/lxc/issues/1280
So revert the default to the legacy hierarchy for now. Developers of the above
software can opt into the unified hierarchy with
"systemd.legacy_systemd_cgroup_controller=0".
Jonathan Boulle [Wed, 9 Nov 2016 16:30:10 +0000 (17:30 +0100)]
man/sd_watchdog_enabled: correct minor typos (#4632)
Mantas Mikulėnas [Wed, 9 Nov 2016 14:39:16 +0000 (16:39 +0200)]
busctl introspect: use free_and_replace()
Mantas Mikulėnas [Tue, 8 Nov 2016 12:20:00 +0000 (14:20 +0200)]
busctl introspect: accept direction="out" for signals
According to the D-Bus spec (v0.29),
| The direction element on <arg> may be omitted, in which case it
| defaults to "in" for method calls and "out" for signals. Signals only
| allow "out" so while direction may be specified, it's pointless.
Therefore we still should accept a 'direction' attribute, even if it's
useless in reality.
Closes: #4616
Christian Hesse [Wed, 9 Nov 2016 03:01:26 +0000 (04:01 +0100)]
nspawn: fix condition for mounting resolv.conf (#4622)
The file /usr/lib/systemd/resolv.conf can be stale, it does not tell us
whether or not systemd-resolved is running or not.
So check for /run/systemd/resolve/resolv.conf as well, which is created
at runtime and hence is a better indication.
Djalal Harouni [Sun, 6 Nov 2016 22:31:55 +0000 (23:31 +0100)]
core: on DynamicUser= make sure that protecting sensitive paths is enforced (#4596)
This adds a variable that is always set to false to make sure that
protect paths inside sandbox are always enforced and not ignored. The only
case when it is set to true is on DynamicUser=no and RootDirectory=/chroot
is set. This allows users to use more our sandbox features inside RootDirectory=
The only exception is ProtectSystem=full|strict and when DynamicUser=yes
is implied. Currently RootDirectory= is not fully compatible with these
due to two reasons:
* /chroot/usr|etc has to be present on ProtectSystem=full
* /chroot// has to be a mount point on ProtectSystem=strict.
Zbigniew Jędrzejewski-Szmek [Wed, 9 Nov 2016 00:54:21 +0000 (19:54 -0500)]
Merge pull request #4536 from poettering/seccomp-namespaces
core: add new RestrictNamespaces= unit file setting
Merging, not rebasing, because this touches many files and there were tree-wide cleanups in the mean time.
Zbigniew Jędrzejewski-Szmek [Tue, 8 Nov 2016 13:09:40 +0000 (08:09 -0500)]
Merge pull request #4612 from keszybz/format-strings
Format string tweaks (and a small fix on 32bit)
Yu Watanabe [Tue, 8 Nov 2016 09:51:35 +0000 (18:51 +0900)]
man: fix typo (#4615)
Martin Pitt [Tue, 8 Nov 2016 08:41:51 +0000 (09:41 +0100)]
Merge pull request #4509 from keszybz/foreach-word-quoted
Remove FOREACH_WORD_QUOTED
Zbigniew Jędrzejewski-Szmek [Tue, 8 Nov 2016 08:39:10 +0000 (03:39 -0500)]
man: add an example how to unconditionally empty a directory (#4570)
It was logical, but not entirely obvious, that 'e' with no arguments does
nothing. Expand the explanation a bit and add an example.
Fixes #4564.
Mike Gilbert [Tue, 8 Nov 2016 08:36:41 +0000 (03:36 -0500)]
Adjust pkgconfig files to point at rootlibdir (#4584)
The .so symlinks got moved to rootlibdir in
082210c7.
Michael Biebl [Tue, 8 Nov 2016 08:09:53 +0000 (09:09 +0100)]
build-sys: remove leftover setcap configure check (#4597)
The check for the setcap binary was added in commit
dd5ae4c36c89da5dbe8d1628939b26c00db98753 to set the CAP_MAC_ADMIN
capability for systemd-bus-proxyd. Later on, bus-proxyd was removed in
commit
798c486fbcdce3346cd862c52e1a200bb8a2cb23.
So remove the leftover setcap configure check as well.
Zbigniew Jędrzejewski-Szmek [Tue, 8 Nov 2016 05:21:20 +0000 (00:21 -0500)]
coredump: bump type of arg_journal_size_max to uint64 too
For normal arches this doesn't matter, but on arm32 arg_journal_size_max was smaller
than the other *SizeMax variables. This doesn't seem useful.
This is anothet part of the fix in
5206a724a0.
Zbigniew Jędrzejewski-Szmek [Tue, 8 Nov 2016 04:38:17 +0000 (23:38 -0500)]
build-sys: fix appending of CFLAGS and define __SANE_USERSPACE_TYPES__
It's pointless to call AC_SUBST more than once on the same variable. Because
of all the copypasta, we were mixing CLFAGS and LDFLAGS.
… and the assertion in previous commit was wrong. PPC64 is a special snowflake.
__SANE_USERSPACE_TYPES__ is needed on PPC64 to make __u64 be llu, instead of
lu. Considering that both lu and llu are 64 bits, there's nothing sane about
this, maybe the flag should be called __INSANE_USERSPACE_TYPES__ instead. Sane
or not, this makes ppc64 kernel headers behave consistent with other
architectures. With this flag, no warnings are emitted at -O0 level.
Martin Pitt [Tue, 8 Nov 2016 04:31:55 +0000 (05:31 +0100)]
nspawn: fix exit code for --help and --version (#4609)
Commit b006762 inverted the initial exit code which is relevant for --help and
--version without a particular reason. For these special options, parse_argv()
returns 0 so that our main() immediately skips to the end without adjusting
"ret". Otherwise, if an actual container is being started, ret is set on error
in run(), which still provides the "non-zero exit on error" behaviour.
Fixes #4605.
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2016 16:49:51 +0000 (11:49 -0500)]
tree-wide: drop (llu) casts for kernel's __u64
According to comments in <asm/types.h>, __u64 is always defined as unsigned
long long. Those casts should be superfluous.
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2016 16:49:25 +0000 (11:49 -0500)]
tree-wide: add PRI_[NU]SEC, and use time format strings more
Evgeny Vereshchagin [Mon, 7 Nov 2016 22:53:21 +0000 (01:53 +0300)]
Merge pull request #4594 from endocode/djalal/fix-rootdir-apply-mntns
core: make RootDirectory= and ProtectKernelModules= work
Martin Pitt [Mon, 7 Nov 2016 18:51:20 +0000 (19:51 +0100)]
tests: use less aggressive systemctl --wait timeout in TEST-03-JOBS (#4606)
If the "systemctl start" happens at an "unlucky" time such as 1000.9 seconds
and then e. g. runs for 2.6 s (sleep 2 plus the overhead of starting the unit
and waiting for it) the END_SEC would be 1003.5s which would round to 1004,
making the difference 4. On busier testbeds the overhead apparently can take a
bit more than 0.5s. The main point is really that it doesn't wait that much
longer, so "-le 4" seems perfectly fine. We allow up to 1.5s in the subsequent
"wait5fail" test below too.
Fixes #4582
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2016 16:46:38 +0000 (11:46 -0500)]
coredump: fix format string on 32 bits
In file included from ./src/basic/macro.h:415:0,
from ./src/shared/acl-util.h:28,
from src/coredump/coredump.c:36:
src/coredump/coredump.c: In function ‘submit_coredump’:
src/coredump/coredump.c:711:26: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 7 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
log_info("The core will not be stored: size %zu is greater than %zu (the configured maximum)",
^
./src/basic/log.h:175:82: note: in definition of macro ‘log_full_errno’
? log_internal(_level, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
^~~~~~~~~~~
./src/basic/log.h:183:28: note: in expansion of macro ‘log_full’
#define log_info(...) log_full(LOG_INFO, __VA_ARGS__)
^~~~~~~~
src/coredump/coredump.c:711:17: note: in expansion of macro ‘log_info’
log_info("The core will not be stored: size %zu is greater than %zu (the configured maximum)",
^~~~~~~~
src/coredump/coredump.c:711:26: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 8 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
log_info("The core will not be stored: size %zu is greater than %zu (the configured maximum)",
^
./src/basic/log.h:175:82: note: in definition of macro ‘log_full_errno’
? log_internal(_level, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
^~~~~~~~~~~
./src/basic/log.h:183:28: note: in expansion of macro ‘log_full’
#define log_info(...) log_full(LOG_INFO, __VA_ARGS__)
^~~~~~~~
src/coredump/coredump.c:711:17: note: in expansion of macro ‘log_info’
log_info("The core will not be stored: size %zu is greater than %zu (the configured maximum)",
^~~~~~~~
src/coredump/coredump.c:741:27: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 7 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
log_debug("Not generating stack trace: core size %zu is greater than %zu (the configured maximum)",
^
./src/basic/log.h:175:82: note: in definition of macro ‘log_full_errno’
? log_internal(_level, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
^~~~~~~~~~~
./src/basic/log.h:182:28: note: in expansion of macro ‘log_full’
#define log_debug(...) log_full(LOG_DEBUG, __VA_ARGS__)
^~~~~~~~
src/coredump/coredump.c:741:17: note: in expansion of macro ‘log_debug’
log_debug("Not generating stack trace: core size %zu is greater than %zu (the configured maximum)",
^~~~~~~~~
src/coredump/coredump.c:741:27: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 8 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
log_debug("Not generating stack trace: core size %zu is greater than %zu (the configured maximum)",
^
./src/basic/log.h:175:82: note: in definition of macro ‘log_full_errno’
? log_internal(_level, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
^~~~~~~~~~~
./src/basic/log.h:182:28: note: in expansion of macro ‘log_full’
#define log_debug(...) log_full(LOG_DEBUG, __VA_ARGS__)
^~~~~~~~
src/coredump/coredump.c:741:17: note: in expansion of macro ‘log_debug’
log_debug("Not generating stack trace: core size %zu is greater than %zu (the configured maximum)",
^~~~~~~~~
src/coredump/coredump.c:768:34: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 7 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
log_info("The core will not be stored: size %zu is greater than %zu (the configured maximum)",
^
./src/basic/log.h:175:82: note: in definition of macro ‘log_full_errno’
? log_internal(_level, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
^~~~~~~~~~~
./src/basic/log.h:183:28: note: in expansion of macro ‘log_full’
#define log_info(...) log_full(LOG_INFO, __VA_ARGS__)
^~~~~~~~
src/coredump/coredump.c:768:25: note: in expansion of macro ‘log_info’
log_info("The core will not be stored: size %zu is greater than %zu (the configured maximum)",
^~~~~~~~
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2016 15:14:59 +0000 (10:14 -0500)]
Rename formats-util.h to format-util.h
We don't have plural in the name of any other -util files and this
inconsistency trips me up every time I try to type this file name
from memory. "formats-util" is even hard to pronounce.
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2016 13:57:30 +0000 (08:57 -0500)]
nspawn: slight simplification
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2016 13:54:47 +0000 (08:54 -0500)]
nspawn: avoid one strdup by using free_and_replace
tblume [Mon, 7 Nov 2016 13:20:43 +0000 (14:20 +0100)]
systemd-nspawn: decrease non-fatal mount errors to debug level (#4569)
non-fatal mount errors shouldn't be logged as warnings.
Djalal Harouni [Sun, 6 Nov 2016 21:51:49 +0000 (22:51 +0100)]
core: make RootDirectory= and ProtectKernelModules= work
Instead of having two fields inside BindMount struct where one is stack
based and the other one is heap, use one field to store the full path
and updated it when we chase symlinks. This way we avoid dealing with
both at the same time.
This makes RootDirectory= work with ProtectHome= and ProtectKernelModules=yes
Fixes: https://github.com/systemd/systemd/issues/4567
Viktar Vaŭčkievič [Sun, 6 Nov 2016 14:19:57 +0000 (17:19 +0300)]
machinectl: don't output "No machines." with --no-legend option (#4593)
Felipe Sateler [Sun, 6 Nov 2016 14:16:42 +0000 (11:16 -0300)]
delta: skip symlink paths when split-usr is enabled (#4591)
If systemd is built with --enable-split-usr, but the system is indeed a
merged-usr system, then systemd-delta gets all confused and reports
that all units and configuration files have been overridden.
Skip any prefix paths that are symlinks in this case.
Fixes: #4573
Zbigniew Jędrzejewski-Szmek [Fri, 28 Oct 2016 02:44:50 +0000 (22:44 -0400)]
Drop FOREACH_WORD_QUOTED
Zbigniew Jędrzejewski-Szmek [Fri, 28 Oct 2016 01:30:48 +0000 (21:30 -0400)]
core/device: port to extract_first_word
Zbigniew Jędrzejewski-Szmek [Fri, 28 Oct 2016 01:15:59 +0000 (21:15 -0400)]
core/load-fragment: modify existing environment instead of copying strv over and over
Zbigniew Jędrzejewski-Szmek [Fri, 28 Oct 2016 00:15:22 +0000 (20:15 -0400)]
core/load-fragment: port to extract_first_word
Zbigniew Jędrzejewski-Szmek [Fri, 28 Oct 2016 00:06:44 +0000 (20:06 -0400)]
tree-wide: drop unneded WHITESPACE param to extract_first_word
It's the default, and NULL is shorter.
Ronny Chevalier [Sat, 5 Nov 2016 14:23:31 +0000 (15:23 +0100)]
Merge pull request #4578 from evverx/no-hostname-memleak
journalctl: fix memleak
Ronny Chevalier [Sat, 5 Nov 2016 13:22:59 +0000 (14:22 +0100)]
Merge pull request #4579 from evverx/acl-memleak
acl-util: fix memleak
Lennart Poettering [Wed, 2 Nov 2016 02:25:19 +0000 (20:25 -0600)]
core: add new RestrictNamespaces= unit file setting
This new setting permits restricting whether namespaces may be created and
managed by processes started by a unit. It installs a seccomp filter blocking
certain invocations of unshare(), clone() and setns().
RestrictNamespaces=no is the default, and does not restrict namespaces in any
way. RestrictNamespaces=yes takes away the ability to create or manage any kind
of namspace. "RestrictNamespaces=mnt ipc" restricts the creation of namespaces
so that only mount and IPC namespaces may be created/managed, but no other
kind of namespaces.
This setting should be improve security quite a bit as in particular user
namespacing was a major source of CVEs in the kernel in the past, and is
accessible to unprivileged processes. With this setting the entire attack
surface may be removed for system services that do not make use of namespaces.
Yu Watanabe [Fri, 4 Nov 2016 12:58:41 +0000 (21:58 +0900)]
kernel-install: use exit instead of return (#4565)
/bin/kernel-install: line 143: return: can only `return' from a function or sourced script
https://bugzilla.redhat.com/show_bug.cgi?id=1391829
Zbigniew Jędrzejewski-Szmek [Fri, 4 Nov 2016 12:40:58 +0000 (08:40 -0400)]
man: update kernel-install(8) to match reality (#4563)
Zbigniew Jędrzejewski-Szmek [Fri, 4 Nov 2016 00:27:45 +0000 (20:27 -0400)]
Merge pull request #4548 from keszybz/seccomp-help
systemd-analyze syscall-filter
Kees Cook [Fri, 4 Nov 2016 00:26:59 +0000 (18:26 -0600)]
doc: clarify NoNewPrivileges (#4562)
Setting no_new_privs does not stop UID changes, but rather blocks
gaining privileges through execve(). Also fixes a small typo.
Evgeny Vereshchagin [Thu, 3 Nov 2016 22:04:40 +0000 (22:04 +0000)]
acl-util: fix memleak
Fixes:
$ ./libtool --mode execute valgrind --leak-check=full ./journalctl >/dev/null
==22309== Memcheck, a memory error detector
==22309== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==22309== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==22309== Command: /home/vagrant/systemd/.libs/lt-journalctl
==22309==
Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages.
Pass -q to turn off this notice.
==22309==
==22309== HEAP SUMMARY:
==22309== in use at exit: 8,680 bytes in 4 blocks
==22309== total heap usage: 5,543 allocs, 5,539 frees, 9,045,618 bytes allocated
==22309==
==22309== 488 (56 direct, 432 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 4
==22309== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
==22309== by 0x6F37A0A: __new_var_obj_p (__libobj.c:36)
==22309== by 0x6F362F7: __acl_init_obj (acl_init.c:28)
==22309== by 0x6F37731: __acl_from_xattr (__acl_from_xattr.c:54)
==22309== by 0x6F36087: acl_get_file (acl_get_file.c:69)
==22309== by 0x4F15752: acl_search_groups (acl-util.c:172)
==22309== by 0x113A1E: access_check_var_log_journal (journalctl.c:1836)
==22309== by 0x113D8D: access_check (journalctl.c:1889)
==22309== by 0x115681: main (journalctl.c:2236)
==22309==
==22309== LEAK SUMMARY:
==22309== definitely lost: 56 bytes in 1 blocks
==22309== indirectly lost: 432 bytes in 1 blocks
==22309== possibly lost: 0 bytes in 0 blocks
==22309== still reachable: 8,192 bytes in 2 blocks
==22309== suppressed: 0 bytes in 0 blocks
Evgeny Vereshchagin [Thu, 3 Nov 2016 21:23:22 +0000 (21:23 +0000)]
journalctl: fix memleak
bash-4.3# journalctl --no-hostname >/dev/null
=================================================================
==288==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 48492 byte(s) in 2694 object(s) allocated from:
#0 0x7fb4aba13e60 in malloc (/lib64/libasan.so.3+0xc6e60)
#1 0x7fb4ab5b2cc4 in malloc_multiply src/basic/alloc-util.h:70
#2 0x7fb4ab5b3194 in parse_field src/shared/logs-show.c:98
#3 0x7fb4ab5b4918 in output_short src/shared/logs-show.c:347
#4 0x7fb4ab5b7cb7 in output_journal src/shared/logs-show.c:977
#5 0x5650e29cd83d in main src/journal/journalctl.c:2581
#6 0x7fb4aabdb730 in __libc_start_main (/lib64/libc.so.6+0x20730)
SUMMARY: AddressSanitizer: 48492 byte(s) leaked in 2694 allocation(s).
Closes: #4568
Martin Pitt [Thu, 3 Nov 2016 21:15:33 +0000 (23:15 +0200)]
build-sys: link test-seccomp against seccomp libs (#4560)
Fixes build error on recent toolchains:
../src/test/test-seccomp.c:35: error: undefined reference to 'seccomp_arch_native'
collect2: error: ld returned 1 exit status
Zbigniew Jędrzejewski-Szmek [Thu, 3 Nov 2016 18:33:49 +0000 (14:33 -0400)]
analyze: fix build w/o seccomp
Lennart Poettering [Thu, 3 Nov 2016 19:59:20 +0000 (13:59 -0600)]
Merge pull request #4510 from keszybz/tree-wide-cleanups
Tree wide cleanups
Zbigniew Jędrzejewski-Szmek [Thu, 3 Nov 2016 17:16:42 +0000 (13:16 -0400)]
Revert "sd-bus: use PRIu64 instead of casting" (#4556)
This reverts commit
75ead2b753cb9586f3f208326446081baab70da1.
Follow up for #4546:
> @@ -848,8 +848,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
if (k->src_id == KDBUS_SRC_ID_KERNEL)
bus_message_set_sender_driver(bus, m);
else {
- xsprintf(m->sender_buffer, ":1.%llu",
- (unsigned long long)k->src_id);
+ xsprintf(m->sender_buffer, ":1.%"PRIu64, k->src_id);
This produces:
src/libsystemd/sd-bus/bus-kernel.c: In function ‘bus_kernel_make_message’:
src/libsystemd/sd-bus/bus-kernel.c:851:44: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘__u64 {aka long long unsigned int}’ [-Wformat=]
xsprintf(m->sender_buffer, ":1.%"PRIu64, k->src_id);
^
Lennart Poettering [Thu, 3 Nov 2016 17:16:01 +0000 (11:16 -0600)]
hwdb update for 232 (#4557)