Commit Graph

21670 Commits

Author SHA1 Message Date
Yu Watanabe f330408d62 tree-wide: drop empty lines in comments 2018-07-23 08:44:24 +02:00
Filipe Brandenburger 46f2579c2a systemctl: Only wait when there's something to wait for.
Tested:
- `systemctl --wait start i-do-not-exist.service` does not wait.
- `systemctl --wait start i-do-not-exist.service valid-unit.service` does.
2018-07-21 23:40:08 +09:00
Luke Shumaker 677a72cd3e nspawn: mount_sysfs(): Unconditionally mkdir /sys/fs/cgroup
Currently, mount_sysfs() only creates /sys/fs/cgroup if cg_ns_supported().
The comment explains that we need to "Create mountpoint for
cgroups. Otherwise we are not allowed since we remount /sys read-only.";
that is: that we need to do it now, rather than later.  However, the
comment doesn't do anything to explain why we only need to do this if
cg_ns_supported(); shouldn't we _always_ need to do it?

The answer is that if !use_cgns, then this was already done by the outer
child, so mount_sysfs() only needs to do it if use_cgns.  Now,
mount_sysfs() doesn't know whether use_cgns, but !cg_ns_supported() implies
!use_cgns, so we can optimize" the case where we _know_ !use_cgns, and deal
with a no-op mkdir_p() in the false-positive where cgns_supported() but
!use_cgns.

But is it really much of an optimization?  We're potentially spending an
access(2) (cg_ns_supported() could be cached from a previous call) to
potentially save an lstat(2) and mkdir(2); and all of them are on virtual
fileystems, so they should all be pretty cheap.

So, simplify and drop the conditional.  It's a dubious optimization that
requires more text to explain than it's worth.
2018-07-20 12:12:03 -04:00
Luke Shumaker f09e86bcaa cgroup-util: cg_kernel_controllers(): Fix comment about including "name="
Remove "arbitrary named hierarchies" from the list of things that
cg_kernel_controllers() might return, and clarify that "name="
pseudo-controllers are not included in the returned list.

/proc/cgroups does not contain "name=" pseudo-controllers, and
cg_kernel_controllers() makes no effort to enumerate them via a different
mechanism.
2018-07-20 12:12:02 -04:00
Luke Shumaker 93dbdf6cb1 nspawn: sync_cgroup(): Rename arg_uid_shift -> uid_shift
Naming it arg_uid_shift is confusing because of the global arg_uid_shift in
nspawn.c
2018-07-20 12:12:02 -04:00
Luke Shumaker 0402948206 nspawn: Move cgroup mount stuff from nspawn-mount.c to nspawn-cgroup.c 2018-07-20 12:12:02 -04:00
Luke Shumaker 2fa017f169 nspawn: Simplify tmpfs_patch_options() usage, and trickle that up
One of the things that tmpfs_patch_options does is take an (optional) UID,
and insert "uid=${UID},gid=${UID}" into the options string.  So we need a
uid_t argument, and a way of telling if we should use it.  Fortunately,
that is built in to the uid_t type by having UID_INVALID as a possible
value.

So this is really a feature that requires one argument.  Yet, it is somehow
taking 4!  That is absurd.  Simplify it to only take one argument, and have
that trickle all the way up to mount_all()'s usage.

Now, in may of the uses, the argument becomes

    uid_shift == 0 ? UID_INVALID : uid_shift

because it used to treat uid_shift=0 as invalid unless the patch_ids flag
was also set.  This keeps the behavior the same.  Note that in all cases
where it is invoked, if !use_userns (sometimes called !userns), then
uid_shift is 0; we don't have to add any checks for that.

That said, I'm pretty sure that "uid=0" and not setting "uid=" are the
same, but Christian Brauner seemed to not think so when implementing the
cgns support.  https://github.com/systemd/systemd/pull/3589
2018-07-20 12:12:02 -04:00
Luke Shumaker 9c0fad5fb5 nspawn: Simplify mkdir_userns() usage, and trickle that up
One of the things that mkdir_userns{,_p}() does is take an (optional) UID,
and chown the directory to that.  So we need a uid_t argument, and a way of
telling if we should use that uid_t argument.  Fortunately, that is built
in to the uid_t type by having UID_INVALID as a possible value.

However, currently mkdir_userns() also takes a MountSettingsMask and checks
a couple of bits in it to decide if it should perform the chown.

Drop the mask argument, and instead have the caller pass UID_INVALID if it
shouldn't chown.
2018-07-20 12:12:02 -04:00
Lennart Poettering 79d53eb8f7 bus-unit-util: tiny coding style fix 2018-07-20 16:57:35 +02:00
Lennart Poettering 2f28018cb8 nss: never become IPC clients for services that are about to be started
This is an attempt to automatically detect and avoid certain kinds of
NSS deadlocks as discussed in this thread:

https://lists.freedesktop.org/archives/systemd-devel/2018-July/040975.html
2018-07-20 16:57:35 +02:00
Lennart Poettering d521916d0f pid1: tell PAM/NSS modules why we are calling them 2018-07-20 16:57:35 +02:00
Lennart Poettering 088c49c3da growfs: make global variables that don't need to be exported static 2018-07-20 16:57:35 +02:00
Lennart Poettering 6b228852bc path-util: avoid name clashes
One of those days we should rework this to use the UNIQ macros, but for
now, an underscore should be enough.
2018-07-20 16:57:35 +02:00
Lennart Poettering ccfc19c960 env-util: make env-util.h self contained
The header file references strlen(), hence it should include string.h
2018-07-20 16:57:35 +02:00
Lennart Poettering 74bf45bb2c tests: prefer MS_SLAVE over MS_PRIVATE for turning off mount propagation
When we open our own little namespace for running our tests in, let's
turn off mount propagation only one way, rather than both ways. This is
better as this means we don't pin host mounts unnecessarily long in our
namespace, even though the host already got rid of them. This is because
MS_SLAVE in contrast to MS_PRIVATE allows umount events to propagate
from the host into our environment.
2018-07-20 16:51:20 +02:00
Lennart Poettering f606cd16d3
Merge pull request #9500 from zsol/append
Add support for opening files for appending
2018-07-20 15:45:08 +02:00
Alan Jenkins d3243f55ca core: remove support for API bus "started outside our own logic"
Looking at a recent Bad Day, my log contains over 100 lines of

    systemd[23895]: Failed to connect to API bus: Connection refused

It is due to "systemd --user" retrying to connect to an API bus.[*]  I
would prefer to avoid spamming the logs.  I don't think it is good for us
to retry so much like this.

systemd was mislead by something setting DBUS_SESSION_BUS_ADDRESS.  My best
guess is an unfortunate series of events caused gdm to set this.  gdm has
code to start a session dbus if there is not a bus available already (and
in this case it exports the environment variable).  I believe it does not
normally do this when running under systemd, because "systemd --user" and
hence "dbus.service" would already have been started by pam_systemd.

I see two possibilities

1. Rip out the check for DBUS_SESSION_BUS_ADDRESS entirely.
2. Only check for DBUS_SESSION_BUS_ADDRESS on startup.  Not in the
   "recheck" logic.

The justification for 2), is that the recheck is called from unit_notify(),
this is used to check whether the service just started (or stopped) was
"dbus.service".  This reason for rechecking does not apply if we think
the session bus was started outside our logic.

But I think we can justify 1).  dbus-daemon ships a statically-enabled
/usr/lib/systemd/user/dbus.service, which would conflict with an attempt to
use an external dbus.  Also "systemd --user" is started from user@.service;
if you try to start it manually so that it inherits an environment
variable, it will conflict if user@.service was started by pam_systemd
(or loginctl enable-linger).
2018-07-20 15:25:55 +02:00
Lennart Poettering 496a6ba40e
Merge pull request #9516 from keszybz/module-load-unification
Module load unification
2018-07-20 13:55:56 +02:00
Lennart Poettering 9638adaf21
Merge pull request #9614 from poettering/negative-sec
parse-util: make sure "-0.-0s" is not considered a valid time specifi…
2018-07-20 13:22:01 +02:00
Zsolt Dollenstein 566b7d23eb Add support for opening files for appending
Addresses part of #8983
2018-07-20 03:54:22 -07:00
Yu Watanabe efe6112dc5 analyze: fix width calculation in plot command 2018-07-20 12:51:31 +02:00
Lennart Poettering 48a0ab391c
Merge pull request #9659 from yuwata/fix-network-memleak2
fix networkd memleak and voidify several function calls
2018-07-20 12:38:49 +02:00
Yu Watanabe b22c8bfcd4 hostname: set sd_event_add_signal() 2018-07-20 15:00:02 +09:00
Yu Watanabe 50008ae48a locale: set sd_event_add_signal() 2018-07-20 14:59:36 +09:00
Yu Watanabe 754f026935 timedate: set sd_event_add_signal() 2018-07-20 14:59:23 +09:00
Filipe Brandenburger 279f52a1d3 parse-util: make sure "3.+1s" or "3. 1s" are not considered valid time specification
Indeed, strtoll() is super-hard to use properly! :-(

Also added more tests for those cases and copied the tests to parse_nsec as well.
2018-07-19 22:09:54 -07:00
Yu Watanabe 8b7140dbd0 timesync: voidify sd_event_add_signal() and sd_event_set_watchdog() 2018-07-20 11:30:11 +09:00
Yu Watanabe 1ae1729214 resolve: voidify sd_event_add_signal() and sd_event_set_watchdog() 2018-07-20 11:29:59 +09:00
Yu Watanabe 05e2162773 network: voidify sd_event_add_signal() and sd_event_set_watchdog() 2018-07-20 11:29:49 +09:00
Yu Watanabe e42699438a network: add missing sd_netlink_unref() 2018-07-20 11:23:24 +09:00
Zbigniew Jędrzejewski-Szmek 4fdf69078a udev-builtin-kmod: adjust logging
I guess the one about "execute" was from the time when modprobe was called
directly.
2018-07-19 18:28:21 +02:00
Zbigniew Jędrzejewski-Szmek 81d7c69657 core: use the generic module_load() function
This allows aliases to be used for the basic modules we load from pid1 before
udev is started. In #9501 the kernel renamed autofs4 to autofs, with "autofs4"
as alias, but we wouldn't load the module, because we didn't follow aliases.
The kernel change was reverted, but it's probably better to support aliases.
2018-07-19 18:28:21 +02:00
Zbigniew Jędrzejewski-Szmek 9b38ec87da shared/module-util: fix preexisting mixup with errno sign 2018-07-19 18:28:21 +02:00
Zbigniew Jędrzejewski-Szmek c3ad978633 udev-builtin-kmod: use the generic module_load() function
There should be no functional change.
2018-07-19 18:28:21 +02:00
Yu Watanabe 4b0051b1b6 resolve: drop unused slot 2018-07-19 11:28:42 +02:00
Filipe Brandenburger d9fb7afb48 coverity: Add custom assertion macros for Coverity
These custom macros make the expression go through a function, in order
to prevent ASSERT_SIDE_EFFECT false positives on our macros such as
assert_se() and assert_return() that cannot be disabled and will always
evaluate their expressions.

This technique has been described and recommended in:
https://community.synopsys.com/s/question/0D534000046Yuzb/suppressing-assertsideeffect-for-functions-that-allow-for-sideeffects

Tested by doing a local cov-build and uploading the resulting tarball to
scan.coverity.com, confirmed that the ASSERT_SIDE_EFFECT false positives
were gone.
2018-07-19 09:07:25 +02:00
Lennart Poettering 8b3169b9a1
Merge pull request #9600 from keszybz/systemctl-mask-check
Systemctl mask check
2018-07-18 21:03:02 +02:00
Lennart Poettering 8d568e8d3e
Merge pull request #9346 from keszybz/journald-exact2
Store a copy of the input message if any stripping or truncation occurs
2018-07-18 21:00:43 +02:00
Yu Watanabe 2e7e8e34aa sd-bus: make bus_slot_disconnect() also unref the slot object
This makes bus_slot_disconnect() unref the slot object from bus when
`unref == true` and it is floating, as the function removes the
reference from the relevant bus object.

This reverts 20d4ee2cbc, as it
introduces #9604.

Fixes #9604.
2018-07-18 20:54:19 +02:00
Lennart Poettering 3bdfea0820
Merge pull request #9643 from keszybz/two-meson-fixmes
Two meson fixmes
2018-07-18 20:32:28 +02:00
Lennart Poettering 900ae0d7ff
Merge pull request #9633 from yuwata/network-fix-memleak
network: fix memleak
2018-07-18 20:32:03 +02:00
Zbigniew Jędrzejewski-Szmek 1d7aedf11a meson: remove false check for key_serial_t
key_serial_t is defined in keyutil.h, which wasn't included in the header list
in the test, so the test always failed. We were always compiling stuff with
!HAVE_KEY_SERIAL_T.

We could try to add keyutil.h to the test, but then we'd have to first check if
it is available, which just doesn't seem worth the trouble.

key_serial_t should always be defined as int32_t. Let's keep the uncoditional
define, since repeated compatible typedefs are not a problem, and it allows us
to compile even if the header file is missing. If there's ever a change in the
definition, we'll have to adjust the code for the different type anyway, and
our compiler will tell us.
2018-07-18 17:46:33 +02:00
Zbigniew Jędrzejewski-Szmek 9c869d08d8 meson: unify linux/stat.h check with other checks and use _GNU_SOURCE
Using _GNU_SOURCE is better because that's how we include the headers in the
actual build, and some headers define different stuff when it is defined.
sys/stat.h for example defines 'struct statx' conditionally.
2018-07-18 17:40:41 +02:00
Zbigniew Jędrzejewski-Szmek 6d77a30c09 bus: add comment to explain assert 2018-07-18 16:36:37 +02:00
Zbigniew Jędrzejewski-Szmek 7ae8edcd03 bus: move BUS_DONT_DESTROY calls after asserts
It's not useful to bump the reference count before checking if the object is
NULL. Thanks to d40f5cc498 we can do this ;).

Related to https://bugzilla.redhat.com/show_bug.cgi?id=1576084,
https://bugzilla.redhat.com/show_bug.cgi?id=1575340,
https://bugzilla.redhat.com/show_bug.cgi?id=1575350. I'm not sure why those two
people hit this code path, while most people don't. At least we won't abort.
2018-07-18 12:16:33 +02:00
Yu Watanabe ddfc4f6e34 network: free routes assigned to link 2018-07-18 13:07:27 +09:00
Yu Watanabe 0ade014c8b network: simplify link_free() 2018-07-18 13:06:34 +09:00
Yu Watanabe 3534a04300 network: move sd_event initialization to manager_new() 2018-07-18 12:37:50 +09:00
Filipe Brandenburger 3f10c66270 bus-socket: Fix line_begins() to accept word matching full string
The switch to memory_startswith() changed the logic to only look for a space or
NUL byte after the matched word, but matching the full size should also be
acceptable.

This changed the behavior of parsing of "AUTH\r\n", where m will be set to 4,
since even though the word will match, the check for it being followed by ' '
or NUL will make line_begins() return false.

Tested:

- Using netcat to connect to the private socket directly:
  $ echo -ne '\0AUTH\r\n' | sudo nc -U /run/systemd/private
  REJECTED EXTERNAL ANONYMOUS

- Running the Ignition blackbox test:
  $ sudo sh -c 'PATH=$PWD/bin/amd64:$PATH ./tests.test'
  PASS

Fixes: d27b725abf
2018-07-17 21:42:20 +02:00
Lennart Poettering ed698d3028 sleep: tiny coding style updates
No change in behaviour
2018-07-17 21:41:56 +02:00
Filipe Brandenburger 06c28aa0d8 resolvectl: Take empty string argument to clear lists in "dns", "domain" and "nta" options
The current CLI does not support a way to clear these lists, since without any
additional arguments, the command will list the current values.

Introduce a new way to clear the lists by passing a single '' argument to these
subcommands.

Update the man page to document this.

Tested:
  $ build/resolvectl domain eth1
  Link 3 (eth1): ~.
  $ build/resolvectl domain eth1 ''
  $ build/resolvectl domain eth1
  Link 3 (eth1):
  $ build/resolvectl domain eth1 '~.' '~example.com'
  $ build/resolvectl domain eth1
  Link 3 (eth1): ~. ~example.com
  $ build/resolvectl domain eth1 ''
  $ build/resolvectl domain eth1
  Link 3 (eth1):
  $ build/resolvectl domain eth1 '~.'
  $ build/resolvectl domain eth1
  Link 3 (eth1): ~.

And similar for "dns" and "nta".
2018-07-17 21:20:52 +02:00
Lennart Poettering 5a9fb35843 parse-util: make sure "-0.-0s" is not considered a valid time specification
Did I mention that strtoll() is super-hard to use properly?
2018-07-17 13:01:46 +02:00
Lennart Poettering a7edb403e5
Merge pull request #9601 from yuwata/small-fixes
Small fixes
2018-07-17 12:40:52 +02:00
Yu Watanabe cad4359568 network: drop unused slots 2018-07-17 12:40:04 +02:00
Yu Watanabe 948f7ce4fb login: fix typo in log message
Reported in #9590.
2018-07-17 03:10:32 +09:00
Yu Watanabe 2bb8d8d9b2 process-util: do not hide global variable
Suggested by LGTM.
2018-07-17 03:06:45 +09:00
remueller 2667385b0e tmpfiles: set only default acls to folders #9545 (#9599)
Check if the fd is a folder before setting default acls

Tested:

Ubuntu 18.04.

test.conf: A+ /tmp/test - - - - u:user2:rw,d:u:user1:rwx

The folder /tmp/test looks like

    /tmp/test/file1
    /tmp/test/folder2

start systemd-tmpfiles manually

Fixes: #9545
2018-07-16 16:56:01 +02:00
Yu Watanabe 460d7ac3a2
Merge pull request #9550 from nosada/fix-9549
format-table: make all widths be set properly
2018-07-16 23:02:32 +09:00
Zbigniew Jędrzejewski-Szmek 86f004fbb5 systemctl: allow 'edit' to work on templates again
This got broken in 9d9dd746d4, because a template
is not a valid unit, so the check for being masked failed. Avoid this by
handling templates specially. Fixes #9554.

Also, this improves 'cat' with masked units:

(before) $ systemctl cat foofoofoo@.service
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument
Failed to derive unit name prefix from unit name: Invalid argument

(after) $ build/systemctl cat foofoofoo@.service

In check_triggering_units(), the call to unit_is_masked() is replaced with an
open-coded check. This is a bit unfortunate, but unit_is_masked() now requires
LookupPaths to be initialized, which we don't have or need in this case, so it
seems easiest to just accept this tiny code duplication.
2018-07-16 15:52:40 +02:00
Yu Watanabe 385b2eb262 sd-bus: make BUS_DEFAULT_TIMEOUT configurable
This adds sd_bus_{get,set}_method_call_timeout().
If the timeout is not set or set to 0, then the timeout value is
parsed from $SYSTEMD_BUS_TIMEOUT= environment variable. If the
environment variable is not set, then built-in timeout is used.
2018-07-16 15:11:50 +02:00
Lennart Poettering db9eee7e45
Merge pull request #9530 from keszybz/sd-bus-doc
More documentation for sd-bus
2018-07-16 15:01:12 +02:00
Zbigniew Jędrzejewski-Szmek 3cb9b42af3 Move module-util.h to src/shared/ and load_module() to libshared
Unfortunately this needs libshared to link to libkmod. Before it was linked
into systemd-udevd, udevadm, and systemd each seperately. On most systems this
doesn't make much difference, because at least systemd would be installed, but
it might not be in small chroots. It is a small library, so I hope this is not
a big issue.
2018-07-16 13:08:40 +02:00
Zbigniew Jędrzejewski-Szmek d35f51ea84 tree-wide: use "polkit" to refer to PolicyKit/polkit
Back in 2012 the project was renamed, see the release notes for v 0.105
[https://cgit.freedesktop.org/polkit/tree/NEWS#n754]. Let's update our
documentation and comments to do the same. Referring to PolicyKit is confusing
to users because at the time the polkit api changed too, and we support the new
version. I updated NEWS too, since all the references to PolicyKit there were
added after the rename.

"PolicyKit" is unchanged in various URLs and method call names.
2018-07-16 12:44:24 +02:00
Filipe Brandenburger 75720bff62 build-sys: Detect whether struct statx is defined in sys/stat.h
Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
definition for struct statx, in which case include file linux/stat.h should be
avoided, in order to prevent a duplicate definition.

    In file included from ../src/basic/missing.h:18,
		     from ../src/basic/util.h:28,
		     from ../src/basic/hashmap.h:10,
		     from ../src/shared/bus-util.h:12,
		     from ../src/libsystemd/sd-bus/bus-creds.c:11:
    /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’
     struct statx {
	    ^~~~~
    In file included from /usr/include/sys/stat.h:446,
		     from ../src/basic/util.h:19,
		     from ../src/basic/hashmap.h:10,
		     from ../src/shared/bus-util.h:12,
		     from ../src/libsystemd/sd-bus/bus-creds.c:11:
    /usr/include/bits/statx.h:36:8: note: originally defined here
     struct statx
	    ^~~~~

Extend our meson.build to look for struct statx when only sys/stat.h is
included and, in that case, do not include linux/stat.h anymore.

Tested that systemd builds correctly when using a glibc version that includes a
definition for struct statx.

glibc Fedora RPM update:
28cb5d31fc

glibc upstream commit:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
2018-07-16 11:14:29 +02:00
Yu Watanabe 86d18f3b09 login: use parse_uid() when unmounting user runtime directory
When unmounting user runtime directory, only UID is necessary,
and the corresponding user may not exist anymore.
This makes first try to parse the input by parse_uid(), and only if it
fails, prase the input by get_user_creds().

Fixes #9541.
2018-07-16 11:12:42 +02:00
Yu Watanabe 475d8599b0 format-table: fix typo in comment 2018-07-15 17:07:38 +09:00
Yu Watanabe a6e964712c test: add a reproducer of issue #9549 2018-07-15 17:07:18 +09:00
Michael Biebl ace5e3111c Do not apply uaccess tag for /dev/kvm if mode is 0666 2018-07-13 23:38:55 +02:00
Lennart Poettering 99352de644
Merge pull request #9462 from yuwata/strv_split
make strv_split() accept empty string and use it in pager_open()
2018-07-13 20:32:37 +02:00
Yu Watanabe 20d4ee2cbc sd-bus: unref slot->match_callback.install_slot when slot is disconnected
When a slot is disconnected, then slot->match_callback.install_slot
is also disconnected. So, bus_slot_disconnect() removes the install_slot
from the list of slots in bus, although it is a floating object.
This makes install_slot unreffed from bus when it is disconnected.

Fixes #9505 and #9510.
2018-07-13 20:07:43 +02:00
Yu Watanabe bd7d173274 machinectl: fix verbosity of import-raw or friends
This partially reverts 31d99bd172.

Fixes #9527.
2018-07-13 19:49:19 +02:00
Yu Watanabe eef836ed00 pull: initialize libgcrypt before calling any functions provided by libgcrypt
This fixes the following warning:
```
systemd-pull[4065]: Libgcrypt warning: missing initialization - please fix the application
```
2018-07-13 19:47:49 +02:00
Lennart Poettering 5901d89955
Merge pull request #9572 from yuwata/fix-9511
resolve: fix heap-use-after-free and uninitialized memory
2018-07-13 19:32:09 +02:00
Tejun Heo 4842263577 core: add MemoryMin
The kernel added support for a new cgroup memory controller knob memory.min in
bf8d5d52ffe8 ("memcg: introduce memory.min") which was merged during v4.18
merge window.

Add MemoryMin to support memory.min.
2018-07-12 08:21:43 +02:00
NOGISAKA Sadata a26db0bc5d format-table: make all widths be set properly
Fixes #9549.
2018-07-12 13:51:58 +09:00
Yu Watanabe 7b3bae217e resolve: use structured initializer
This fixes the following valgrind warning:
```
Syscall param sendmsg(msg.msg_name) points to uninitialised byte(s)
   at 0x6189CC1: sendmsg (in /usr/lib64/libpthread-2.27.so)
   by 0x153082: dns_stream_writev (resolved-dns-stream.c:235)
   by 0x153343: dns_stream_tls_writev (resolved-dns-stream.c:299)
   by 0x5B30343: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B3158F: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B33190: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B36307: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B37D47: gnutls_handshake (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x154591: dns_stream_connect_tls (resolved-dns-stream.c:596)
   by 0x13A889: dns_transaction_emit_tcp (resolved-dns-transaction.c:676)
   by 0x13D901: dns_transaction_go (resolved-dns-transaction.c:1761)
   by 0x1330C8: dns_query_candidate_go (resolved-dns-query.c:156)
 Address 0xa9ac268 is 312 bytes inside a block of size 592 alloc'd
   at 0x4C30B06: calloc (vg_replace_malloc.c:711)
   by 0x1541F8: dns_stream_new (resolved-dns-stream.c:545)
   by 0x13A662: dns_transaction_emit_tcp (resolved-dns-transaction.c:642)
   by 0x13D901: dns_transaction_go (resolved-dns-transaction.c:1761)
   by 0x1330C8: dns_query_candidate_go (resolved-dns-query.c:156)
   by 0x134E16: dns_query_go (resolved-dns-query.c:757)
   by 0x11F3FB: bus_method_resolve_hostname (resolved-bus.c:353)
   by 0x4F947A7: method_callbacks_run (bus-objects.c:402)
   by 0x4F97266: object_find_and_run (bus-objects.c:1260)
   by 0x4F978B1: bus_process_object (bus-objects.c:1376)
   by 0x4FAF82C: process_message (sd-bus.c:2661)
   by 0x4FAFA1B: process_running (sd-bus.c:2703)
```
2018-07-12 13:38:35 +09:00
Yu Watanabe 18df5fb017 resolve: unref stream after completion processes
Fixes #9511.
2018-07-12 12:57:55 +09:00
Sven Joachim 06bed19ea1 core: Fix grammar in error message 2018-07-11 12:38:36 +02:00
Michael Biebl fa53e24130 Re-add uaccess tag for /dev/kvm
If --dev-kvm-mode is set to something different then 0666, which we
explicitly support, it makes sense to still apply the uaccess tag to
/dev/kvm. For distros which opt to use the default 0666, this change is
a nop.

This partially reverts commit b8fd3d8220.
2018-07-10 14:51:50 +02:00
Dave Reisner 25ea58d373 network/link: Fix logic error in matching devices by MAC
Prior to this commit, a .link file with a [Match] section containing
MACAddress= would match any device without a MAC. This restores the
matching logic prior to e90d037.
2018-07-07 13:48:59 +02:00
Yu Watanabe 70d6e5bd99 systemctl: make variable which stores environment variable constant 2018-07-07 01:39:14 +09:00
Yu Watanabe 43942e8055 pager: split $PAGER or $SYSTEMD_PAGER and use execvp()
This makes pager_open() correctly handle e.g. PAGER='  ' or PAGER=' cat '.
2018-07-07 01:38:32 +09:00
Yu Watanabe 0745ce7565 strv: make strv_split() accept empty string 2018-07-07 01:34:18 +09:00
Tomsod M 8255430754 show-status: add newline to ephemeral messages
Fixes #6712.  The newline is later reversed, naturally.
2018-07-06 16:35:22 +02:00
Zbigniew Jędrzejewski-Szmek 6755bb5548 core/kmod-setup: restore comments
They were removed in 7491e6e7c5, but the
original version is more informative. Let's add them back.
2018-07-06 11:51:24 +02:00
Zbigniew Jędrzejewski-Szmek 7c30c3c44f journal: store the original timestamp as SYSLOG_TIMESTAMP=
This is useful if someone wants to recreate the original syslog datagram. We
already include timestamp information as _SOURCE_REALTIME_TIMESTAMP=, and in
normal use that timestamp, converted back to the form used by syslog
(Mth dd HH:MM:SS) would usually give the value. But there are various
circumstances where this might not be true. Most obviously, if the datagram is
sent a bit later after being prepared, the time is rounded to the nearest
second, and it might be off. This is especially bad around New Year when the
syslog timestamp wraps around. Then the same timezone and locale need to be
used to recreate the original timestamp. In the end doing this reliably is
complicated, and it seems much easier to just unconditionally include the
original timestamp.

If the original timestamp cannot be located, we store the full log line.
This way, it should be always possible to recreate the original input.

Example:
MESSAGE=x
SYSLOG_TIMESTAMP=Sep 15 15:07:58
SYSLOG_RAW
^]^@^@^@^@^@^@^@<13>Sep 15 15:07:58 HOST: x^@y
_PID=3318
_SOURCE_REALTIME_TIMESTAMP=1530743976393553

Fixes #2398.
2018-07-05 00:40:35 +02:00
Zbigniew Jędrzejewski-Szmek 855a86a349 systemctl: fix assert for failed mktime conversion
mktime returns -1 on error, so checking for != 0 is not useful.
2018-07-04 23:54:43 +02:00
Zbigniew Jędrzejewski-Szmek df8701a3f2 journal: store the original syslog input as SYSLOG_RAW=
This allows the original stream to be recreated and/or verified. The new field
is written if any stripping was done or if the input message contained embeded
NULs.

$ printf '<13>Sep 15 15:07:58 HOST: x\0y' | nc -w1 -u -U /run/systemd/journal/dev-log

$ journalctl -o json-pretty ...
{
  ...
  "MESSAGE" : "x",
  "SYSLOG_RAW" : [ 60, 49, 51, 62, 83, 101, 112, 32, 49, 53, 32, 49, 53, 58, 48, 55, 58, 53, 56, 32, 72, 79, 83, 84, 58, 32, 120, 0, 121 ]
}

$ journalctl -o export ... | cat -v
...
MESSAGE=x
SYSLOG_RAW
^]^@^@^@^@^@^@^@<13>Sep 15 15:07:58 HOST: x^@y

This mostly fixes #4863.
2018-07-04 18:18:04 +02:00
Zbigniew Jędrzejewski-Szmek c3950a9bbe journal: optimize the common case where whitespace stripping is not needed
If we can just use the original data, let's do that.
2018-07-04 18:02:50 +02:00
Lennart Poettering cfffa385a3
Merge pull request #9489 from keszybz/copyright-removal-3
Copyright header removal, part 3 (or 4?)
2018-07-03 16:55:01 +02:00
Zbigniew Jędrzejewski-Szmek be9bf171bb rpm: emit warning when macro with typo is used
Follow-up for a6bb550458. Suggested by @ignatenkobrain.

$ rpmbuild --eval %_environmentdir
/usr/lib/environment.d
$ rpmbuild --eval %_environmnentdir
warning: Use %_environmentdir instead
/usr/lib/environment.d
2018-07-03 16:54:02 +02:00
Zbigniew Jędrzejewski-Szmek 1235a7dc73
Merge pull request #9417 from Conan-Kudo/rpm-environmentdir-typo
rpm: Fix typo in %_environmentdir
2018-07-03 15:36:15 +02:00
Yu Watanabe 1e5f4e8ba2 conf-parser,login: logs description of error in parsing size 2018-07-03 15:18:04 +02:00
Lion Yang a9518dc369 seccomp: add swapcontext into @process for ppc32
There are some modern programming languages use userspace context switches
to implement coroutine features. PowerPC (32-bit) needs syscall "swapcontext" to get
contexts or switch between contexts, which is special.

Adding this rule should fix #9485.
2018-07-03 13:35:02 +02:00
Yu Watanabe db2f8a2e8a tree-wide: add a space after (void) 2018-07-03 10:44:28 +02:00
Zbigniew Jędrzejewski-Szmek 052a85d188 resolved: fix typo in log message
Follow-up for cc7d50a571.
2018-07-03 09:09:41 +09:00
Zbigniew Jędrzejewski-Szmek 6ae97a514b tree-wide: drop some leftover header for Lennart Poettering
Follow-up for 0c69794138.
2018-07-03 01:32:36 +02:00
Zbigniew Jędrzejewski-Szmek 90d75140c8 journald: drop copyright headers for Sebastian Thorarensen
For #9320.
2018-07-03 01:32:25 +02:00
Violet Halo 11ce0db2e2 sd-bus: publicize sd_bus_message_readv()
The D-Bus library supplies a va_list variant of
`sd_bus_message_append()` called `sd_bus_message_appendv()`,
but failed to provide a va_list variant of its opposite,
`sd_bus_message_read()`. This commit publicizes a previously static
function as `sd_bus_message_readv()`.
2018-06-29 11:45:40 +02:00
Yu Watanabe 545cdb90f3 tree-wide: use instead of #ifdef for HAVE_* 2018-06-29 11:40:15 +02:00
Yu Watanabe cc7d50a571 resolve: update log message
Follow-up for f43580f17d.
2018-06-29 11:37:07 +02:00
Lennart Poettering 0a2fcbd2ee
Merge pull request #9468 from yuwata/small-cleanups
small fixes and cleanups for comments
2018-06-29 11:35:57 +02:00
ChenQi1989 4f07ffa8f5 Use #if instead of #ifdef for ENABLE_GSHADOW
ENABLE_GSHADOW is defined to be 0 or 1. So #if should be used instead of #ifdef.
2018-06-29 10:27:51 +02:00
Yu Watanabe 825862972e bus-util: update comment
Originally, request_name_handler_may_reload_dbus() was written for
timesyncd. But now it is also called by networkd or resolved.
2018-06-29 12:35:49 +09:00
Yu Watanabe afb76fdbff tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
Yu Watanabe 8f5dd8c094 tree-wide: drop empty comments 2018-06-29 11:00:30 +09:00
Yu Watanabe 1e089bf805 tree-wide: drop empty lines in the begining of comments 2018-06-29 10:50:23 +09:00
Yu Watanabe 599c44e6e2 network: update log message
Closes #9396.
2018-06-29 10:38:38 +09:00
Yu Watanabe 031651a57a bus-util: drop unnecessary !! 2018-06-29 10:38:31 +09:00
Lennart Poettering ca285cdb40
Merge pull request #9422 from yuwata/conf-files
cleanups for default conf files
2018-06-28 10:17:54 +02:00
Yu Watanabe 845d247a3d tree-wide: use 'signed int' instead of 'int' for bit field variables
Suggested by LGTM: https://lgtm.com/rules/1506024027114/
2018-06-28 10:16:51 +02:00
Yu Watanabe f43580f17d resolve: warn when our stub listener is disabled but resolv.conf uses it
Closes #9450.
2018-06-28 10:06:15 +02:00
Evegeny Vereshchagin 283c265387 sd-bus: stop using the result of an assignment as an operand of &&
This makes OBJECT_PATH_FOREACH_PREFIX consistent with PATH_FOREACH_PREFIX
and also fixes 7 alerts reported by LGTM at
ac0a087003/files/src/libsystemd/sd-bus/bus-objects.c?sort=name&dir=ASC&mode=heatmap&showExcluded=true#V1383
2018-06-28 13:17:29 +09:00
Lennart Poettering 874b5ad248 core: tiny comment fix 2018-06-28 11:55:44 +09:00
Lennart Poettering a7e2e50d35 summary: update nspawn description string a bit
nspawn as it is now is a generally useful tool, hence let's drop the
comments about it being useful for debug and so on only.

The new wording just makes the first sentence of the main page also the
summary.
2018-06-28 11:55:44 +09:00
Filipe Brandenburger d7af62d52c sleep: fix one more printf format of a fiemap field
Use PRIu64 constant to get the format right on LP-64 architectures,
cast to (uint64_t) to solve incompatibility of __u64.

This was missed in ad4bc33522, so fix it
with this follow up.
2018-06-28 03:29:21 +09:00
Mike Gilbert 358248caa3 basic: add missing comma in raw_clone assembly for sparc
Fixes: 96f64eb574
Closes: https://github.com/systemd/systemd/issues/9444
2018-06-27 09:16:04 -07:00
Lorenz Hübschle-Schneider b90cbe6638 cryptsetup: Add dependency on loopback setup to generated units
For loopback volumes, the generated unit needs to depend on
systemd-tmpfiles-setup-dev.service to ensure that loopback
support is loaded.

Fixes #9308
2018-06-27 16:57:17 +02:00
Yu Watanabe 04e075b572 bus-util: make log level lower in request_name_destroy_callback()
Fixes #9442.
2018-06-27 16:56:50 +02:00
Lennart Poettering a5de5c43e6
Merge pull request #9440 from yuwata/fix-js
journal-gateway: update browse.html
2018-06-27 10:37:36 +02:00
Lennart Poettering 7f818901a2
Merge pull request #9438 from yuwata/lgtm-fixes-2
small fixes suggested by LGTM
2018-06-27 10:36:50 +02:00
Yu Watanabe a661dc36f6 resolve: reduce number of conversions between ifname and ifindex
This also fixes minor memleak introduced in
654457e560c5723b90b419f7651b87040aade07e.
2018-06-26 23:09:36 -07:00
Filipe Brandenburger 5a01b3f35d resolvconf: fixes for the compatibility interface
Also use compat_main() when called as `resolvconf`, since the interface
is closer to that of `systemd-resolve`.

Use a heap allocated string to set arg_ifname, since a stack allocated
one would be lost after the function returns. (This last one broke the
case where an interface name was suffixed with a dot, such as in
`resolvconf -a tap0.dhcp`.)

Tested:
  $ build/resolvconf -a nonexistent.abc </etc/resolv.conf
  Unknown interface 'nonexistent': No such device

Fixes #9423.
2018-06-26 23:09:36 -07:00
Yu Watanabe e68131526b analyze: actually select longest activated-time of services
Discovered by LGTM.
2018-06-27 14:54:19 +09:00
Yu Watanabe 944072fedd journal-gateway: use localStorage["cursor"] only when it has valid value
Discovered by LGTM.
2018-06-27 14:50:23 +09:00
Yu Watanabe c497e449f4 journal-gateway: explicitly declare local variables
Suggested by LGTM.
2018-06-27 14:22:28 +09:00
Yu Watanabe affaed1e55 sd-bus: fix implicit downcast of bitfield reported by LGTM 2018-06-27 13:28:28 +09:00
Filipe Brandenburger ad4bc33522 sleep: fix printf format of fiemap fields
Use PRIu64 and PRIu32 constants to also get the format right on LP-64
architectures.

For the 64-bit fields, we need a cast to (uint64_t), since __u64 is
defined as a `long long unsigned` and PRIu64 expects a `long unsigned`.
In practice, both are the same, so the cast should be OK.
2018-06-26 20:39:07 +02:00
Neal Gompa a6bb550458 rpm: Add misspelled %_environmentdir macro for temporary compatibility
This should be removed after systemd 240 is released.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2018-06-26 07:43:41 -04:00
Yu Watanabe e0f691e1fd tree-wide: use localtime_r() instead of localtime()
Follow-up for e46acb7950.
2018-06-26 14:26:39 +09:00
Yu Watanabe ad16158c10 netdev: do not assign unused values 2018-06-26 14:26:19 +09:00
Jan Janssen aa2cc005d7 crypt-util: Translate libcryptsetup log level instead of using log_debug()
This makes sure that errors reported by libcryptsetup are shown to the
user instead of getting swallowed up by log_debug().
2018-06-26 14:26:07 +09:00
Yu Watanabe e761599ffd core: add missing option and drop nonexistent option in system.conf 2018-06-26 04:07:19 +09:00
Yu Watanabe 2dcacc7363 journal: add missing option in journald.conf 2018-06-26 04:05:42 +09:00
Yu Watanabe a4d5708c79 journal-remote: add license and reference to man page in conf files 2018-06-26 04:04:45 +09:00
Yu Watanabe 3632149409 network: provide default networkd.conf 2018-06-26 03:34:49 +09:00
Lennart Poettering e46acb7950 timedate: use gmtime_r() and localtime_r()
gmtime() and localtime() operate on a static buffer. let's avoid this,
as we never know whether some library might use these calls in some
backrgound thread.

Discovered by lgtm:

https://lgtm.com/projects/g/systemd/systemd/
2018-06-25 19:20:34 +02:00
Zbigniew Jędrzejewski-Szmek e49807606d
Merge pull request #9411 from poettering/systemctl-is-running-fixes
tiny systemctl fixes
2018-06-25 19:03:31 +02:00
Neal Gompa 6ea4cb975f rpm: Fix typo in %_environmentdir
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2018-06-25 12:56:50 -04:00
Zbigniew Jędrzejewski-Szmek dfe23d4145
Merge pull request #4522 from lucaswerkmeister/unescape-template
escape: support --unescape with --template
2018-06-25 18:48:01 +02:00
Lennart Poettering 5e4c5bde5c busctl: make parameter const
it's initialized from an argv[] entry, hence let's be make it
non-writable by default.
2018-06-25 18:26:17 +02:00
Lennart Poettering bfeec178db systemctl: if we can't detect the system-is-running state, assume it's not running 2018-06-25 17:10:27 +02:00
Lennart Poettering e686a616e8 systemctl: log errors to LOG_DEBUG rather than eating them up entirely 2018-06-25 17:10:27 +02:00
Lennart Poettering 9897b09ba7 systemctl: add 'static' to constant state array 2018-06-25 17:10:27 +02:00
Filipe Brandenburger b02a7e1aea resolved: assert t->server is set in dns_transaction_emit_tcp.
Uncovered by Coverity. Fixes CID 1393390.
2018-06-25 13:17:25 +02:00
Filipe Brandenburger 53a2383b8b core/job: add check for return of job_type_merge_and_collapse()
Using an assertion is fine, since calls to job_merge_into_installed()
are protected by a check for job_type_is_conflicting().

Uncovered by Coverity, fixes CID 996307.
2018-06-25 13:16:38 +02:00
Lennart Poettering 2919425bab
Merge pull request #9398 from yuwata/lgtm-fixes
fixes error handlings and several cleanups suggested by LGTM
2018-06-25 13:12:44 +02:00
Michal Koutný 1e75824cb0 core/manager: Make sure jobs statistics are not double after daemon-reload
We add n_installed_jobs and n_failed_jobs to our inner state after
deserialization. This is fine during daemon-reexec when we start with clear
Manager (and some jobs possibly queued before deserialization), however,
daemon-reload works with the same manager and adding the values would
effectively double the counters. Reset the counters before we deserialize and
add their values again.
2018-06-25 11:18:44 +02:00
Lucas Werkmeister d936cddcb5 escape: add --instance option
Suggested by @keszybz in #4522.
2018-06-25 11:17:55 +02:00
Zbigniew Jędrzejewski-Szmek d3a27ed402 boot: do not assume the last character in cmdline is a newline
Fixes #9401.
2018-06-25 11:17:53 +02:00
Lucas Werkmeister e563e2534c escape: support --unescape with --template 2018-06-25 11:13:38 +02:00
Yu Watanabe fb14aa7ecc network: fix log message 2018-06-25 10:31:08 +02:00
Yu Watanabe a9061d97a7 timesync: update log message
Fixes #9388.
2018-06-25 10:27:18 +02:00
Yu Watanabe 75ca1621db timesync: changes type of drift_freq to int64_t
drift_freq is used for storing timex.freq, and is a 64bit integer.
To support x32 ABI, this changes the type of drift_freq to int64_t.

Fixes #9387.
2018-06-25 10:27:18 +02:00
Yu Watanabe d5c3091122 install: fix error handling in is_symlink_with_known_name() 2018-06-25 14:07:16 +09:00
Yu Watanabe 99c89da02d portable: fix error handling 2018-06-25 13:56:27 +09:00
Yu Watanabe d61b34f1b2 import: drop unnecessary condition 2018-06-25 13:54:44 +09:00
Yu Watanabe 712fdfd609 sd-dhcp: drop unnecessary condition 2018-06-25 13:51:34 +09:00
Yu Watanabe 8838f46f93 machine-pool: drop unnecessary condition 2018-06-25 13:49:56 +09:00
Yu Watanabe 6da95857c1 resolve: drop dead code 2018-06-25 13:46:52 +09:00
Yu Watanabe fa6a69d783 resolve: drop dead code 2018-06-25 13:42:31 +09:00
Yu Watanabe 33987ba0c2 bootctl: drop dead code 2018-06-25 13:40:36 +09:00
Yu Watanabe 29bfb683a8 journal: drop redundant condition 2018-06-25 13:36:49 +09:00
Yu Watanabe a5042ec4d7 resolve: fix return value type of dns_answer_has_dname_for_cname() 2018-06-25 13:25:42 +09:00
Yu Watanabe 86b112a315 resolve: dns_scope_network_good() does not returns negative errno 2018-06-25 13:25:34 +09:00
Yu Watanabe b4dec49f83 core/cgroup: drop unnecessary condition 2018-06-25 13:09:48 +09:00
Yu Watanabe 0ceff9068d bus-util: fix error handling 2018-06-25 13:08:02 +09:00
Yu Watanabe f18edd8a0a tree-wide: add multiple inclusion guard 2018-06-25 13:04:59 +09:00
Yu Watanabe 6302d1ea07 core: drop unused log message
temporary_filesystem_add() does not parse mount options.
2018-06-24 19:06:24 +02:00
YmrDtnJu a26fec2408 core: Actually use the resolved path for TemporaryFileSystem= (#9385)
The code already resolves specifiers using unit_full_printf() but then uses the
unresolved version again for temporary_filesystem_add().
2018-06-23 08:17:07 +09:00
Zbigniew Jędrzejewski-Szmek 25612ecba4 tree-wide: drop copyright lines for more authors
Acks in https://github.com/systemd/systemd/issues/9320.
2018-06-22 16:39:45 +02:00
Kevin Kuehler 321ed3643a journalctl: handle inotify exhaustion nicer
Instead of failing, log that inotify wds
are exhausted and fallback to -n switch.

Fixes #1296.
2018-06-21 14:46:53 +02:00
Roland Kammerer fee854ee8c udev: exclude DRBD from block device ownership event locking
It does not make sense for udev to even open DRBD block devices
(/dev/drbdX). It is on one hand not necessary as DRBD is controlled by
something else in the stack (e.g., pacemaker), and it even can get
cumbersome in various scenarios (e.g., DRBD9 auto-promote).

Closes: #9371

Signed-off-by: Roland Kammerer <roland.kammerer@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2018-06-21 14:46:27 +02:00
Lennart Poettering 88116909ec core: explicitly trigger changing udev SYSTEMD_WANTS properties
This compensates for the unsynchronized reload cycles of systemd and
udev: we manually trigger the deps listed in SYSTEMD_WANTS properties if
they change for device units that are already up. That way all deps
defined that way will be triggered at least once: the first time the
unit goes up by the usual dependency logic, and if it already is up by
the device.c specific logic.

Fixes: #9323
2018-06-20 23:59:29 +02:00
Lennart Poettering b5c9144cb7 analyze: use _cleanup_ for freeing the manager object 2018-06-20 23:59:29 +02:00
Lennart Poettering 4d2a7ffd5b analyze: use log_unit_error_errno()'s return value where we can 2018-06-20 23:59:29 +02:00
Lennart Poettering 7675251663 tree-wide: pass NULL arguments to manager_startup() directly, avoid declaring unneeded variables 2018-06-20 23:59:29 +02:00
Lennart Poettering 01d32c0030 core: use fflush_and_check() where appropriate 2018-06-20 23:59:29 +02:00
Zbigniew Jędrzejewski-Szmek fc65dabdb5 test-condition: extend tests to all ConditionSecurity= values
Also print out what we detect, for manual verification.
2018-06-20 22:46:18 +02:00
Lennart Poettering be405b909e condition: add new conditon ConditionSecurity=uefi-secureboot
We have the detector call for this anyway, and it's useful for
conditioning out dbxtool.service, hence let's add this tiny new option.
2018-06-20 22:33:47 +02:00
Zbigniew Jędrzejewski-Szmek 92963e74df
Merge pull request #9363 from yuwata/specifier-config-dir
core: add unit specifier for configuration directory root
2018-06-20 22:30:18 +02:00
Yu Watanabe 56ddbf1009 meson: make DNS-over-TLS support optional
This adds dns-over-tls option to meson. If set to 'false',
systemd-resolved is not linked with libgnutls.
2018-06-20 22:28:01 +02:00
Franck Bui 25c59b5d85 systemctl: mask always reports the same unit names when different unknown units are passed
Before this patch:

  # systemctl --runtime mask abuild.mount does-not-exist.mount does-also-not-exist.mount
  Unit abuild.mount does not exist, proceeding anyway.
  Unit abuild.mount does not exist, proceeding anyway.
  Unit abuild.mount does not exist, proceeding anyway.
  Created symlink /run/systemd/system/abuild.mount → /dev/null.
  Created symlink /run/systemd/system/does-not-exist.mount → /dev/null.
  Created symlink /run/systemd/system/does-also-not-exist.mount → /dev/null.

After this patch:

  # systemctl --runtime mask abuild.mount does-not-exist.mount does-also-not-exist.mount
  Unit abuild.mount does not exist, proceeding anyway.
  Unit does-not-exist.mount does not exist, proceeding anyway.
  Unit does-also-not-exist.mount does not exist, proceeding anyway.
  Created symlink /run/systemd/system/abuild.mount → /dev/null.
  Created symlink /run/systemd/system/does-not-exist.mount → /dev/null.
  Created symlink /run/systemd/system/does-also-not-exist.mount → /dev/null.
2018-06-20 21:53:23 +02:00
Yu Watanabe 969309c2b4 core: add unit specifier for configuration directory root
Follow-up for 14068e17f3.
2018-06-21 03:20:37 +09:00
Zbigniew Jędrzejewski-Szmek 54781addb7 test-sizeof: another aproach to _Float128 availability detection 2018-06-20 17:06:21 +02:00
Lennart Poettering a6887cc03e tree-wide: drop MSG_NOSIGNAL flag from recvmsg() invocations
MSG_NOSIGNAL is only defined for sendmsg(), not for recvmsg(), hence
let's drop it's use, in particular as it appears to create problems on
older kernels. See:

https://lists.freedesktop.org/archives/systemd-devel/2018-June/040869.html
2018-06-20 16:12:55 +02:00
Lennart Poettering 41145af8a9 Revert "mention alias for poweroff in machinectl --help"
This reverts commit bebd5382ba4c820377f05e1e518c6dfd96b278be.

For the reasoning, see: https://github.com/systemd/systemd/pull/9342#issuecomment-398715417
2018-06-20 13:25:42 +02:00
Lennart Poettering 6dd9477dde
Merge pull request #9348 from keszybz/copyright-removal
Copyright removal
2018-06-20 12:27:56 +02:00
Zbigniew Jędrzejewski-Szmek 68ad174eb8 Drop copyrights tags for "systemd authors" 2018-06-20 12:11:12 +02:00
Zbigniew Jędrzejewski-Szmek 5b4f9cc15b basic/bpf-program: drop obsolete comment
As far as I can see, nothing in that particular file is from the
kernel. Let's just drop the comment.
2018-06-20 12:07:38 +02:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Zbigniew Jędrzejewski-Szmek 3c47d50906 shared/path-lookup: remove unnecessary 'if' to help gcc
Fixes #9343.
2018-06-20 10:57:51 +02:00
Yu Watanabe d149a404b1 resolve: fix log message 2018-06-20 08:25:10 +02:00
Yu Watanabe e55fc5b094 resolve: do not log about negative cache for mdns packets
Fixes #9335.
2018-06-20 08:25:10 +02:00
Christian Rebischke 91fd39687a mention alias for poweroff in machinectl --help
This commit adds the stop alias to the output of `machinectl --help`.
In the past we only mention this in the man page. It's nice to mention
this in the output `machinectl --help` as well.
2018-06-20 08:11:03 +02:00
Susant Sahani 44b598a1c9 networkd: Unify set MTU
Now the setting MTU is embedded into the link_up message which makes it
incapable of setting MTU if link is up. MTU can be set while Link is up.

Closes #9254
2018-06-20 08:09:30 +02:00
Hannes Reinecke c0373eb019 scsi_id: Fixup prefix for pre-SPC inquiry reply
The prefix for EMC Symmetrix pre-SPC VPD inquiry reply
is always SCSI_ID_NAA, so we need to hardcode it to
avoid false values here.

Signed-off-by: Hannes Reinecke <hare@suse.com>
2018-06-19 12:46:24 +02:00
Jérémy Rosen 14c1abccf0 add _AUDIT_TYPE_NAME field to audit records in the journal 2018-06-19 10:48:38 +02:00
Zbigniew Jędrzejewski-Szmek 1183320594 resolved: move dot to end of sentence
Noticed in #9285.
2018-06-19 16:14:48 +09:00
Yu Watanabe 22509a8df0 sd-bus: fix typo in comment 2018-06-19 08:44:55 +02:00
Yu Watanabe 31d99bd172 tree-wide: do not assign values if not used 2018-06-19 08:44:55 +02:00
Zbigniew Jędrzejewski-Szmek 496ab389cc
Merge pull request #9330 from yuwata/ja-po-portable
portable: update polkit messages
2018-06-19 08:37:36 +02:00
Yu Watanabe 980982da62 mount: do not output (null) in option
Fixes #9327.
2018-06-19 08:27:47 +02:00
Yu Watanabe 9c7f1abbe2 portable: update polkit messages 2018-06-19 13:21:17 +09:00
Chris Lamb 3fe910794b Correct a number of trivial typos. 2018-06-18 22:44:44 +02:00
Jérémy Rosen ed563b609c do not filter out deprecated USER audit messages 2018-06-18 14:48:09 +02:00
Ronny Chevalier 98008caa94 shared: do not include ~ when appending syscall filters property
The method already uses a boolean argument to determine whether it is in
whitelist mode or not. The code that will parse the string of filters
does not expect the ~, since it already has the boolean argument. Thus,
it will fail to parse the list of filters.
2018-06-18 13:12:20 +02:00
Zbigniew Jędrzejewski-Szmek 88f375b8c2
Merge pull request #8766 from poettering/syscall-filter-service
add a new `@system-service` syscall group that is good as a starting point for whitelisting syscalls
2018-06-15 11:34:44 +02:00
Yu Watanabe 1e8c7bd55c namespace: drop protect_{home,system}_or_bool_from_string()
The functions protect_{home,system}_from_string() are not used
except for defining protect_{home,system}_or_bool_from_string().
This makes protect_{home,system}_from_string() support boolean
strings, and drops protect_{home,system}_or_bool_from_string().
2018-06-15 11:32:27 +02:00
Yu Watanabe 3177e14c4d
Merge pull request #9303 from poettering/busctl-fixlets
tiny busctl fixlets
2018-06-15 12:11:44 +09:00
Iwan Timmer f6c9c5f8ed resolved: fix error handling in resolved-dns-stream
During the transition from system functions using errno to our own read and write functions with negative return codes some errors where introduced. This patch correctly convert errno to negative return codes for read and write and fix checks still using errno instead of the return code.

Closes #9283
2018-06-14 20:01:03 +02:00
Lennart Poettering 6f659e5075 portable: add SystemCallFilter=@system-service to the three main portable service profiles
… but leave the "trusted" profile unmodified, it shall have full access
to all system calls, as before.
2018-06-14 17:44:20 +02:00
Lennart Poettering e05ee49b14 seccomp: explain why we use setuid rather than @setuid in @privileged 2018-06-14 17:44:20 +02:00
Lennart Poettering 705268414f seccomp: add new system call filter, suitable as default whitelist for system services
Currently we employ mostly system call blacklisting for our system
services. Let's add a new system call filter group @system-service that
helps turning this around into a whitelist by default.

The new group is very similar to nspawn's default filter list, but in
some ways more restricted (as sethostname() and suchlike shouldn't be
available to most system services just like that) and in others more
relaxed (for example @keyring is blocked in nspawn since it's not
properly virtualized yet in the kernel, but is fine for regular system
services).
2018-06-14 17:44:20 +02:00
Lennart Poettering 48956c396e busctl: make use of log_error_errno() where we can 2018-06-14 14:54:32 +02:00
Lennart Poettering 02bf91ee29 busctl: add 'const' where we can 2018-06-14 14:53:59 +02:00
Lennart Poettering 6b0f548498 busctl: use fflush_and_check() where appropriate 2018-06-14 14:53:46 +02:00
Zbigniew Jędrzejewski-Szmek 50d1760d26 Drop more license boilerplate
$ git grep -e 'This program is free software' -l |grep -v LICENSE | \
  xargs perl -i -0pe 's/ \* This program.*?for more details.\s*\*\n( \* You should have.*licenses.>.\n)?//gms'

For some reason they were missed previously. All those files seem to
have proper SDPX tags.
2018-06-14 13:05:41 +02:00
Zbigniew Jędrzejewski-Szmek 58f21e63b4 Fix SPDX license tags 2018-06-14 13:05:41 +02:00
Zbigniew Jędrzejewski-Szmek 0cd41d4dff Drop my copyright headers
perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
2018-06-14 13:03:20 +02:00
Zbigniew Jędrzejewski-Szmek b0450864f1
Merge pull request #9274 from poettering/comment-header-cleanup
drop "this file is part of systemd" and lennart's copyright from header
2018-06-14 11:26:50 +02:00
Zbigniew Jędrzejewski-Szmek 36ee2ececc
Merge pull request #9199 from poettering/copy-file-atomic
make copy_file_atomic() use O_TMPFILE to create the destination file
2018-06-14 11:19:22 +02:00
Jan Synacek 0722b35934 namespace: always use a root directory when setting up namespace
1) mv /var/tmp /var/tmp.old
2) mkdir /tmp/varrr
3) ln -s /tmp/varrr /var/tmp

Now, when a service has PrivateTmp=yes, during namespace setup,
/tmp is first mounted over with a new mount. Then, when /var/tmp
is being resolved, it points to /tmp/varrr, which by then doesn't
exist, because it had already been obscured.
2018-06-14 10:25:16 +02:00
Lennart Poettering c7e6744fa8
Merge pull request #9297 from yuwata/rfe-9296
timesync: ignore any errors related to timestamp file
2018-06-14 10:22:11 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering 0c69794138 tree-wide: remove Lennart's copyright lines
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
2018-06-14 10:20:20 +02:00
Lennart Poettering 2aafd60bee grypt-util: drop two emacs modelines
No idea why they didn't get removed earlier...
2018-06-14 10:20:20 +02:00
Lennart Poettering 810adae9e9 tree-wide: use proper unicode © instead of (C) where we can
Let's use a proper unicode copyright symbol where we can, it's prettier.

This important patch is very important.
2018-06-14 10:20:20 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Franck Bui 16dc38dd15 locale-util: on overlayfs FTW_MOUNT causes nftw(3) to not list *any* files
On overlayfs, FTW_MOUNT causes nftw to not list *any* files because the
condition used by glibc to verify that it's on the same mountpoint doesn't work
on overlayfs, see https://bugzilla.suse.com/show_bug.cgi?id=1096807 for the
details.

However using FTW_MOUNT doesn't seem to be really needed when walking through
the keymap directorie tree. So until the glibc or the kernel is fixed (which
might take some time), let's make localectl works with overlayfs.

There's a small side effect here, by which regular (non-directory) files with
bind mounts will be parsed while they were skipped by the previous logic.
2018-06-14 10:19:33 +02:00
Yu Watanabe ead0adb161 timedatectl: add 'show' command to display machine-readable output
Closes #9249.
2018-06-14 10:19:08 +02:00
Lennart Poettering 28e1a3ec44
Merge pull request #9193 from keszybz/coverity
Coverity support for glibc-2.27
2018-06-14 09:59:58 +02:00
Iwan Timmer c9299be2f5 resolve: rename PrivateDNS to DNSOverTLS
PrivateDNS is not considered a good name for this option, so rename it to DNSOverTLS
2018-06-14 09:57:56 +02:00
Zbigniew Jędrzejewski-Szmek d122ed1ba8
Merge pull request #9263 from poettering/log-serialize
save/restore log level across daemon reexec
2018-06-14 09:57:15 +02:00
Yu Watanabe 86aaccb020 timesync: ignore any errors related to timestamp file 2018-06-14 12:04:04 +09:00
Yu Watanabe c039af2388 sysusers: use fchmod_and_chown() 2018-06-14 12:03:49 +09:00
Yu Watanabe b8da477eaf fs-util: introduce fchmod_and_chown()
The new function fchmod_and_chown() is almost same as chmod_and_chown()
except it takes file descriptor instead of file path.
2018-06-14 11:47:57 +09:00
Lennart Poettering 08ebe56b2e
Merge pull request #9291 from poettering/nspawn-fixlets
tiny nspawn fixlets
2018-06-13 19:16:34 +02:00
Lennart Poettering f0d97606e9
Merge pull request #9290 from poettering/radv-fixlets
tiny sd-radv fixlets
2018-06-13 19:05:57 +02:00
Yu Watanabe 24f5a4c7c6 machine: ignore containers which disable private user namespace in MapToMachine{User,Group}
Fixes #9286.
2018-06-13 19:05:32 +02:00
Lennart Poettering b5752d2352 main: simplify arg_system initialization a bit
For both branches of the if check it's the first line, hence let's just
do it before.
2018-06-13 18:52:27 +02:00
Franck Bui bda7d78ba1 pid1: preserve current value of log target across re-{load,execution}
To make debugging easier, this patches allows one to change the log target and
do reload/reexec without modifying configuration permanently, which makes
debugging easier.

Indeed if one changed the log target at runtime (via the bus or via signals),
the change was lost on the next reload/reexecution.

In order to restore back the default value (set via system.conf, environment
variables or any other means ), the empty string in the "LogTarget" property is
now supported as well as sending SIGTRMIN+26 signal.
2018-06-13 18:52:27 +02:00
Franck Bui a6ecbf836c pid1: preserve current value of log level across re-{load,execution}
To make debugging easier, this patches allows one to change the log level and
do reload/reexec without modifying configuration permanently, which makes
debugging easier.

Indeed if one changed the log max level at runtime (via the bus or via
signals), the change was lost on the next daemon reload/reexecution.

In order to restore the original value back (set via system.conf, environment
variables or any other means), the empty string in the "LogLevel" property is
now supported as well as sending SIGRTMIN+23 signal.
2018-06-13 18:52:27 +02:00
Lennart Poettering df1fac6dea nspawn: free global variables before exiting
This doesn't really matter much, but is prettier for valgrind
2018-06-13 17:51:40 +02:00
Lennart Poettering 97d7974b18 sd-radv: use strv_isempty() where we can 2018-06-13 17:48:15 +02:00
Lennart Poettering f5a5706ace sd-radv: normalize function parameters a bit
Let's add "const" where we don't change structures passed.

Also, we generally use "unsigned char" for IP prefix length values, do
so here too. Previously different parts of the sd-radv.h API used
different types for this.
2018-06-13 17:48:15 +02:00
Lennart Poettering c4b6dda07f sd-radv: close fd when destroying object 2018-06-13 17:48:15 +02:00
Lennart Poettering 2f14e52f08 nspawn: drop unused parameter from one call 2018-06-13 17:42:16 +02:00
Susant Sahani 6f8a8b84f2 networkd: Don't try to close fd in sd_radv_stop if fd is closed.
sd_radv_stop is called from two places. if sd_radv_stop is alrady
success then just don't try to close it .
```
systemd-networkd[604]: RADV: Stopping IPv6 Router Advertisement daemon
systemd-networkd[604]: RADV: Unable to send last Router Advertisement with router lifetime set to zero: Bad file descriptor <==================HERE
systemd-networkd[604]: RADV: Updated prefix 2a0a:*:*:fc::/64 preferred 1h valid 2h
systemd-networkd[604]: RADV: Started IPv6 Router Advertisement daemon
```

Closes one of the issue #8960
2018-06-13 17:14:47 +02:00
Lennart Poettering cb8770ed21
Merge pull request #9261 from keszybz/drop-bool-casts
Drop bool casts
2018-06-13 16:19:24 +02:00