Commit graph

26670 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 3a2acd9ee0
Merge pull request #13317 from ddstreet/werror
Fix build warnings, so Ubuntu CI can pass --werror to meson
2019-08-16 10:19:09 +02:00
Lennart Poettering 73fdd47940 unit-file: downgrade accidentaly high-prio debug log message 2019-08-16 07:44:20 +09:00
Lennart Poettering e226badc9c networkctl: avoid outputting '(null)' for LLDP ports without description 2019-08-16 07:43:34 +09:00
Dan Streetman 4d6c1fce0e src/boot/efi/meson.build: if meson --werror is true, set gcc -Werror
This part of the build does not use the normal meson parameters, so
we need to explicitly check for the meson --werror parameter, and if
it's true, set the gcc -Werror parameter for this subdir's build.
2019-08-15 17:46:58 -04:00
Dan Streetman 4287d0832c src/boot/efi/linux: elide __attribute__((regparm(0))) on non-i386
This attribute is x86_32-only, so when building on non-intel archs it
generates a compiler warning.  When building with -Werror this turns
into an error, so only include the attribute on i386 arch builds.
2019-08-15 16:36:10 -04:00
Dan Streetman 82a0fb328e src/boot/efi/shim: elide __attribute__((sysv_abi)) on non-intel archs
This attribute is x86-only, so when building on non-intel archs it
generates a compiler warning.  When building with -Werror this turns
into an error, so only include the attribute on intel archs.
2019-08-15 16:36:10 -04:00
Dan Streetman 9841802955 src/basic/missing_syscall: add comment lines for PR 13319 changes
Add a comment line explaining that the syscall defines might be
defined to invalid negative numbers, as libseccomp redefines them
to negative numbers if not defined by the kernel headers, which is
not obvious just from reading the code checking for defined && > 0
2019-08-15 19:36:50 +02:00
Tommi Rantala e57cd3fb88 update-utmp: fix assertion failure if rescue.target, multi-user.target and graphical.target are all inactive
If rescue.target, multi-user.target and graphical.target are all
inactive, get_current_runlevel() is not able to determine current
runlevel, and returns with zero. This zero runlevel value results to
assertion failure in utmp_put_runlevel().

 # systemctl stop rescue.target multi-user.target graphical.target
 # systemctl start systemd-update-utmp-runlevel.service

 systemd[1]: Stopped target Graphical Interface.
 systemd[1]: Stopped target Multi-User System.
 systemd[1]: Starting Update UTMP about System Runlevel Changes...
 systemd-update-utmp[67]: Assertion 'runlevel > 0' failed at src/shared/utmp-wtmp.c:275, function utmp_put_runlevel(). Aborting.
 systemd[1]: systemd-update-utmp-runlevel.service: Main process exited, code=dumped, status=6/ABRT
 systemd[1]: systemd-update-utmp-runlevel.service: Failed with result 'core-dump'.
 systemd[1]: Failed to start Update UTMP about System Runlevel Changes.

Let's just print a warning in this case and skip the utmp update, to
avoid systemd-update-utmp-runlevel.service failures.
2019-08-14 18:22:09 +02:00
Lennart Poettering 636e72bce6 sysusers: properly mark generated accounts as locked
Previously, we'd only set the shell to /usr/bin/nologin and lock the
password for system users. Let's go one step further and also lock the
whole account.

This is a paranoid safety precaution, since neither disabling the shell
like this nor disabling the password is sufficient to lock an account,
since remote shell tools generally allow passing different shells, and
logins into ftp or similar protocols don't know the shell concept anyway.
Moreover, in times of ssh authentication by password is just one
option of authentication among many.

Takes inspiration from the recommendations in usermod(8)'s -L switch:

    "Note: if you wish to lock the account (not only access with a
    password), you should also set the EXPIRE_DATE to 1."
2019-08-14 18:19:56 +02:00
Dan Streetman 59b657296a src/basic/missing_syscall: change #ifndef to #if ! (defined && > 0)
The #ifndef check used to work for missing __NR_* syscall defines, but
unfortunately libseccomp now redefines missing syscall number to negative
numbers, in their public header file, e.g.:
https://github.com/seccomp/libseccomp/blob/master/include/seccomp.h.in#L801

When systemd is built, since it includes <seccomp.h>, it pulls in the
incorrect negative value for any __NR_* syscall define that's included in
the seccomp.h header (for those syscalls that the kernel headers don't
yet define, e.g. when built with older/stable-distro kernels).  This leads
to bugs like:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1821625

This changes the check so that it can override the negative number that
libseccomp defines, instead of trying to use the negative syscall number.
To avoid gcc warnings (which are failures with meson --werror), this checks
without generating a redefinition gcc warning.

I have no idea why libseccomp decided to define missing syscalls
to negative numbers inside their *public* header file, causing
problems like this.
2019-08-14 18:09:47 +02:00
Zbigniew Jędrzejewski-Szmek b208cbe5b4 shared/unit-file: fix systemctl cat user@.service
I assumed that unit_name_to_instnace() returns NULL if there is no instance.
In fact it returns "", so the check for instance was wrong.

Also avoid unnecessary call to unit_name_is_valid().
2019-08-14 16:20:49 +02:00
Lennart Poettering 24f36fb180
Merge pull request #13302 from yuwata/network-set-put-fixes
network: fixes related to set_put()
2019-08-14 16:18:06 +02:00
Lennart Poettering 87915c1c98
Merge pull request #13318 from ddstreet/s390_seccomp
add s390 pkey_mprotect syscall number, and s390 mmap syscall definitions
2019-08-14 16:13:58 +02:00
Mattias Jernberg a5a8776ae5 core: Avoid race when starting dbus services
In high load scenarios it is possible for services to be started
before the NameOwnerChanged signal is properly installed.

Emulate a callback by also queuing a GetNameOwner when the match is
installed.

Fixes: #12956
2019-08-14 16:12:31 +02:00
Dan Streetman 57311925aa src/shared/seccomp-util.c: Add mmap definitions for s390 2019-08-13 15:40:36 -04:00
Dan Streetman 4f6d0cf807 src/basic/missing_syscall: add s390 syscall number for __NR_pkey_mprotect
The syscall number for s390 was added to the kernel at:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b41c51c8e194c0bdfb4b1778a137aea8246c86cd
2019-08-13 15:40:29 -04:00
Frantisek Sumsal d397d2b220
Merge pull request #13303 from yuwata/bootctl-segfaults
bootctl: fix segfaults
2019-08-12 19:16:51 +00:00
William A. Kennington III d1bdafd214 networkd: Keep track of static neighbors
We need to keep track of the static neighbors that are configured on the
interface so that we can delete stale entries that were removed.
2019-08-12 20:28:19 +09:00
Yu Watanabe f8a2b09a18 bootctl: arg_dolloar_boot_path() may return NULL 2019-08-12 16:14:07 +09:00
Yu Watanabe a2ae0d4969 bootctl: clear arg_xbootldr_path when acquire_xbootldr() succeeds 2019-08-12 00:04:44 +09:00
Yu Watanabe 3dc2e7af5f network: add missing link_ref() 2019-08-11 09:11:25 +09:00
Yu Watanabe 75a302b561 network: fix potential memleaks related to set_put() 2019-08-11 08:57:01 +09:00
Lennart Poettering 3619634ca5 firstboot: drop duplicate trailing whitespace from root pw question
Since ask_password() (and related calls) already append one char, we
ended up appending two. That's not pretty. Let's fix this, and do it
like in all other cases ask_password() (or an equivalent function) is
called.
2019-08-11 06:13:57 +09:00
Johannes Christ 7f024cb211 Fix typo in analyze-security.c. 2019-08-11 06:08:42 +09:00
Lennart Poettering 3884274b15 logind: set description for inhibitor event source 2019-08-08 07:40:37 +09:00
William A. Kennington III 0b1cd3e25a networkd: Routes should take the gateway into account
Otherwise, changing the default gateway doesn't purge old gateway routes
left on the system during daemon restart. This also fixes removing other
foreign gateway routes that don't match the expected configuration.

Tested:
    Changed gateway addresses prior to the patch and they lingered on
    the system during each reconfiguration. Applied this patch and
    reconfigured gateways and other routes multiple times and it removed
    the foreign routes that had gateways that didn't match.

Signed-off-by: William A. Kennington III <william@wkennington.com>
2019-08-07 20:32:36 +09:00
Yu Watanabe 9f4f7fe3b5
Merge pull request #13265 from keszybz/timedated-ntp-logging
Timedated logging and service priority
2019-08-07 08:07:57 +09:00
Zbigniew Jędrzejewski-Szmek 0957790b5f timedated: always enable&start the service with highest priority
This removes a special case that was implemented before: if some service
was already enabled, we'd treat it as having higher priority.

From https://bugzilla.redhat.com/show_bug.cgi?id=1735584#c4:
> Setting ntp off and on should give the same result as just setting it
> on. There should be no stickiness (hidden state). It should behave like
> running an ansible role.
>
> The other service might have been enabled because no other was installed at
> the time. If I install a new NTP service with a higher priority, setting ntp
> on should enable and start the new service, and disable all other. Also, if
> for some reason multiple services are enabled, after setting ntp on there
> should be only one enabled to avoid systemd selecting between them randomly
> on the next boot.
2019-08-06 15:04:03 +02:00
Ronan Pigott 46ff70ca69 systemctl: Add unit file states to state help message 2019-08-06 08:38:43 +02:00
Zbigniew Jędrzejewski-Szmek ad7fb9434c timedated: log about unit enablement actions and enhance logs in general
The general idea is that for things which can occur repeatedly, like SetNTP
being called with the same argument, we only log at debug level. For things
which change state, like when we realize that a unit that wasn't enabled
before needs to be enabled, we log at info level.

Also, don't return success if there are no units loaded.
2019-08-05 21:27:00 +02:00
Zbigniew Jędrzejewski-Szmek 4c071d7f2a meson: create (empty) /etc/systemd/system during installation
We explicitly create /etc/systemd/user and other parts of the basic directory
tree. I think we should create /etc/systemd/system too. (The alternative would
be to not create those other directories too, but I think it's nice to have
the basic directory structure in place after installation.)

https://bugzilla.redhat.com/show_bug.cgi?id=1737362
2019-08-06 03:11:09 +09:00
Frantisek Sumsal 94595525af
Merge pull request #12884 from mrc0mmand/numapolicy-test
test: introduce TEST-36-NUMAPOLICY
2019-08-05 18:02:40 +00:00
Zbigniew Jędrzejewski-Szmek aa39b24a86 shared/exit-status: fix off-by-one in comment 2019-08-05 16:38:20 +02:00
Zbigniew Jędrzejewski-Szmek 00d27e5dd7 shared/exit-status: fix lookup
FLAGS_SET() is the wrong operator here, because we want to see if
*any* bits are set. Add test.

https://github.com/systemd/systemd/pull/12884#issuecomment-518238410
2019-08-05 16:38:17 +02:00
Zbigniew Jędrzejewski-Szmek 77a5ae188b
Merge pull request #13258 from yuwata/login-revert-handle-ignore-assertion
Revert "logind: remove unused check"
2019-08-05 15:43:23 +02:00
Yu Watanabe 41c81c4a62 udev: do not try to import properties on commented out lines
Fixes #13257.
2019-08-04 14:41:47 +02:00
Zbigniew Jędrzejewski-Szmek d9cb4bba20 timedated: minor code simplifications 2019-08-04 11:06:33 +02:00
Yu Watanabe 18f689b1fa Revert "logind: remove unused check"
This reverts commit f2330acda4.

Fixes #13255.
2019-08-04 05:44:36 +09:00
Yu Watanabe b518e02661 login: drop space in empty line 2019-08-04 05:44:36 +09:00
Zbigniew Jędrzejewski-Szmek a4fc96c823 pid1: replace asprintf() with strjoin()
It's nicer. And coverity doesn't need to complain about unchecked return
value (CID#1401780).
2019-08-03 17:46:56 +02:00
Zbigniew Jędrzejewski-Szmek 5d276aa201 sd-hwdb: use return value from ordered_hashmap_iterate()
Why not? Coverity CID#1402329.
2019-08-03 17:43:51 +02:00
Zbigniew Jędrzejewski-Szmek bc67342e94 libsystemd-network: make option_append() atomic and make the code a bit clearer
Comparisons are done in the normal order (if (need > available), not if (available < need)),
variables have reduced scope and are renamed for clarity.

The only functional change is that if we return -ENAMETOOLONG, we do that
without modifying the options[] array.

I also added an explanatory comment. The use of one offset to point into three
buffers is not obvious.

Coverity (in CID#1402354) says that sname might be accessed at bad offset, but
I cannot see this happening. We check for available space before writing anything.
2019-08-03 17:36:38 +02:00
Yu Watanabe 20f45f4bb6 udev-node: fix misleading log messages
This fixes the following logs:
```
drm_dp_aux2: Handling device node '/dev/drm_dp_aux2', devnum=c238:2, mode=037777777777, uid=4294967295, gid=4294967295
drm_dp_aux2: Preserve permissions of /dev/drm_dp_aux2, 037777777777, uid=4294967295, gid=4294967295
```
2019-08-03 06:04:40 +09:00
Yu Watanabe 88d566aa23 udev-event: log device name on spawning commands 2019-08-03 05:38:27 +09:00
Miroslav Lichvar bca5a0eacc time-util: improve detection of synchronized clock
Instead of checking for the STA_UNSYNC flag in the timex status, check
the maximum error. It is updated by the kernel, increasing at a rate of
500 ppm. The maximum value is 16 seconds, which triggers the STA_UNSYNC
flag.

This follows timedatex and allows timedated to correctly detect a clock
synchronized by chronyd when configured to not synchronize the RTC.
2019-08-01 17:32:36 +02:00
Zbigniew Jędrzejewski-Szmek 1888e5bec6
Merge pull request #13243 from keszybz/two-cryptsetup-quickfixes
Two cryptsetup quickfixes
2019-08-01 17:31:12 +02:00
Zbigniew Jędrzejewski-Szmek fef716b28b cryptsetup: don't assert on variable which is optional
50d2eba27b (commitcomment-34519739)

In add_crypttab_devices() split_keyspec is called on the keyfile argument,
which may be NULL.
2019-08-01 09:49:24 +02:00
Zbigniew Jędrzejewski-Szmek 5d2100dc4c cryptsetup: use unabbrieviated variable names
Now that "ret_" has been added to the output variables, we can name
the internal variables without artificial abbrevs.
2019-08-01 08:13:13 +02:00
Jan Synacek 28a06f5abe analyze-security: move assert above first use of the variable (#13238) 2019-07-31 16:13:35 +02:00
Lennart Poettering 735a8b6d38 job: fix coverity issue
Fixes coverity issue 1403550
2019-07-31 09:45:03 +02:00