1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 14:55:37 +03:00
Commit Graph

25388 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
6e5dcce4b1 Voidify more mkdir_p calls 2019-03-27 11:53:12 +01:00
Zbigniew Jędrzejewski-Szmek
ca78ad1de9 headers: remove unneeded includes from util.h
This means we need to include many more headers in various files that simply
included util.h before, but it seems cleaner to do it this way.
2019-03-27 11:53:12 +01:00
Zbigniew Jędrzejewski-Szmek
b45556375e test-fileio: do not use variable before checking return value
Coverity is unhappy because we use "line" in the assert that checks
the return value. It doesn't matter much, but let's clean this up.
Also, let's not assume that /proc/cmdline contains anything.

CID #1400219.
2019-03-27 11:52:54 +01:00
Lennart Poettering
49bd196d69
Merge pull request #12110 from keszybz/sysv-compat-fix
Sysv-compat compilation fix
2019-03-27 09:29:13 +01:00
Lennart Poettering
175b43cb8e
Merge pull request #12116 from keszybz/mock-compilation-fixes
Fixes for compilation in Fedora 30 mock
2019-03-27 09:27:20 +01:00
Zbigniew Jędrzejewski-Szmek
10fd1d46fc shared/install: try even harder to make sure variable is initalized
Apparently the fix in a05294ff05 was
not sufficient. Let's declare the two arrays as static variables.
2019-03-26 19:58:17 +01:00
Zbigniew Jędrzejewski-Szmek
be3f37528e util-lib: fix sentence in comment 2019-03-26 19:06:48 +01:00
Zbigniew Jędrzejewski-Szmek
2771aaf571 systemctl: define less stuff when !HAVE_SYSV_COMPAT
We'd translate our action to sysv runlevel action, only to discard the result
in talk_initctl(). Let's just ifdef the whole thing away.

Fixes #12103.
2019-03-26 19:06:48 +01:00
Zbigniew Jędrzejewski-Szmek
9ca5828475 test-execute: skip flaky test when we can't unshare namespaces
When running in Fedora "mock", / is a tmpfs and /home is not mounted. The test
assumes that /home will be a tmpfs only and only if we can unshare. Obviously,
this does not hold in this case, because unsharing is not possible, but /home
is still a tmpfs. Let's just skip the test, since it's fully legitimate to
mount either or both of / and /home as tmpfs.
2019-03-26 18:53:53 +01:00
Zbigniew Jędrzejewski-Szmek
6aed6a1157 test-execute: provide custom failure message
test_exec_ambientcapabilities: exec-ambientcapabilities-nobody.service: exit status 0, expected 1

Sometimes we get just the last line, for example from the failure summary,
so make it as useful as possible.
2019-03-26 18:53:53 +01:00
Lennart Poettering
aed9834289 sleep: (void)ify some call 2019-03-26 11:17:23 +01:00
Lennart Poettering
427646ea9d sleep: use negative_errno() where appropriate 2019-03-26 11:17:23 +01:00
Lennart Poettering
adca059d55
Merge pull request #12044 from keszybz/ttyname-malloc-simplification
util-lib: use a fixed buffer size for terminal path
2019-03-26 10:05:29 +01:00
Lennart Poettering
0d53f53bbd tests: add simple testcase for getttyname_malloc() 2019-03-26 09:10:21 +01:00
Zbigniew Jędrzejewski-Szmek
e1af3bc62a
Merge pull request #12106 from poettering/nosuidns
add "nosuid" flag to exec directory mounts of DynamicUser=1 services
2019-03-26 08:58:00 +01:00
Zbigniew Jędrzejewski-Szmek
83eee14f46 logind: reword the polkit prompt for reboot parameter
Let's opt for the simplest description possible so that users actually
understand what we have in mind.
2019-03-26 08:52:18 +01:00
Zbigniew Jędrzejewski-Szmek
99f57a4fea
Merge pull request #12105 from poettering/api-vfs-mount-flags
some API VFS mount flag tweaks
2019-03-26 08:32:53 +01:00
Lennart Poettering
607b358ef2 core: drop suid/sgid bit of files/dirs when doing recursive chown
This adds some extra paranoia: when we recursively chown a directory for
use with DynamicUser=1 services we'll now drop suid/sgid from all files
we chown().

Of course, such files should not exist in the first place, and noone
should get access to those dirs who isn't root anyway, but let's better
be safe than sorry, and drop everything we come across.
2019-03-26 08:29:37 +01:00
Lennart Poettering
25e68fd397 nspawn: minor improvements to --help text 2019-03-26 08:06:00 +01:00
Lennart Poettering
9ce4e4b0f6 namespace: when DynamicUser=1 is set, mount StateDirectory= bind mounts "nosuid"
Add even more suid/sgid protection to DynamicUser= envionments: the
state directories we bind mount from the host will now have the nosuid
flag set, to disable the effect of nosuid on them.
2019-03-25 19:57:15 +01:00
Lennart Poettering
849b9b85b8 nspawn: mount mqueue with nodev,noexec,nosuid, too
The host mounts it like that, nspawn hence should do too.

Moreover, mount the file system after doing CLONEW_NEWIPC so that it
actually reflects the right mqueues. Finally, mount it wthout
considering it fatal, since POSIX mqueue support is little used and it
should be fine not to support it in the kernel.
2019-03-25 19:53:05 +01:00
Lennart Poettering
64e82c1976 mount-util: beef up bind_remount_recursive() to be able to toggle more than MS_RDONLY
The function is otherwise generic enough to toggle other bind mount
flags beyond MS_RDONLY (for example: MS_NOSUID or MS_NODEV), hence let's
beef it up slightly to support that too.
2019-03-25 19:33:55 +01:00
Lennart Poettering
f0a95a2c6d mount-util: use set_put_strdup() where appropriate 2019-03-25 19:33:55 +01:00
Lennart Poettering
f8b1904f96 mount-util: don't clobber return value in umount_recursive()
We shouldn't override 'r' with the result of cunescape(), since we use
it to return the last error of umount().
2019-03-25 19:33:55 +01:00
Lennart Poettering
867189b545 namespace: get rid of {} around single-line if blocks 2019-03-25 19:33:55 +01:00
Lennart Poettering
39e91a2777 namespace: get rid of local variable 2019-03-25 19:33:55 +01:00
Lennart Poettering
1019a48f40 namespace: (void)ify a number of syscalls 2019-03-25 19:33:55 +01:00
Lennart Poettering
5f7a690aaa namespace: replace one case of stack allocation with heap allocation
The list of mounts might grow quite large, let's avoid the stack for
this. Better safe than sorry.
2019-03-25 19:33:55 +01:00
Lennart Poettering
1d52a931c6 systemctl: move --failed close to --state= in help text 2019-03-25 15:25:58 +01:00
Lennart Poettering
8e54300425 systemctl: underline sections in help text
Taking inspiration from the recent commit that added that to nspawn's
help text.
2019-03-25 15:25:58 +01:00
Lennart Poettering
3bfa8668b0 systemctl: use structured initialization 2019-03-25 15:25:57 +01:00
Lennart Poettering
2f50e59f2b systemctl: use SYNTHETIC_ERRNO everywhere 2019-03-25 15:23:08 +01:00
Lennart Poettering
63a3b3cb70 systemctl: split out some SysV compat stuff into its own C file
systemctl.c is way to large already. Let's split out some stuff out that
is easy to split out.
2019-03-25 15:23:08 +01:00
Lennart Poettering
b82f71c7ff tree-wide: constify a few static string tables 2019-03-25 14:04:34 +01:00
Lennart Poettering
ebfb1b5724 dbus-unit: remove redundant check
We checked this with an assert() a few lines up aleady, no need to check
this again.
2019-03-25 13:48:53 +01:00
Lennart Poettering
e59ba56d78 core: remove unnecessary heap allocation 2019-03-25 13:48:53 +01:00
Yu Watanabe
1beabe08d6 network,udev: explicitly declare 'conditions' is a list 2019-03-24 00:35:39 +09:00
Yu Watanabe
7bb55ed099 util: fix condition_free_list_type()
This fixes a bug introduced by c4f58deab5.

Closes oss-fuzz#13878, oss-fuzz#13882, oss-fuzz#13884, oss-fuzz#13886, and
oss-fuzz#13888.
2019-03-24 00:34:33 +09:00
Lennart Poettering
16b4623620
Merge pull request #11602 from vesajaaskelainen/dbus-reboot-with-parameters
dbus-manager: Add RebootWithParameters d-bus method
2019-03-22 21:07:47 +01:00
Lennart Poettering
83276695c6
Merge pull request #12079 from keszybz/fuzz-nspawn-oci
Add fuzzer for nspawn-oci
2019-03-22 21:06:17 +01:00
Jan Engelhardt
b0ca726585 rpm: avoid hiding errors from systemd commands
Humans are susceptible to making orthographic errors sometimes. A
misspelled "%systemd_post caek.service" would go unnoticed due to all
output from systemctl being discarded if and when %post runs.

To alleviate this, cease hiding outputs. Then, to account for the
potential absence of systemd from the system, add file checks so as
to not generate a "command not found" error.
2019-03-22 20:54:59 +01:00
Vesa Jääskeläinen
428b296a59 logind: Add support for RebootParameter
This adds support for user to set & get reboot parameter for reboot.

As callee would be next issuing Reboot call same policy checks are being used.

If unit file issuing the reboot action defines RebootArgument (or similar) that
setting takes precedence.
2019-03-22 20:30:33 +02:00
Lennart Poettering
e4077ff6f3 nspawn: don't free "fds" twice
Previously both run() and run_container() would free 'fds'. Let's fix
that, and let run() free it but make run_container() already remove all
fds from it, because that's what we actually want to do.

Fixes: #12073
2019-03-22 18:11:27 +01:00
Zbigniew Jędrzejewski-Szmek
b2645747b7 nspawn-oci: fix double free
Also rename function to make it clear that it also frees the array
object itself.
2019-03-22 17:39:12 +01:00
Zbigniew Jędrzejewski-Szmek
54ed9f88dc udev/link-config: rename MACPolicy to MACAddressPolicy
Things are clearer if the same name is used everywhere, and we don't gain
much by saving a few bytes.
2019-03-22 17:16:17 +01:00
Zbigniew Jędrzejewski-Szmek
094eecd29d
Merge pull request #12055 from poettering/save-argc-argv
main-func.h and systemctl argc/argv improvements
2019-03-22 16:58:18 +01:00
Zbigniew Jędrzejewski-Szmek
4210e60eb6
Merge pull request #12072 from poettering/string-table-fixes
three small string table fixes
2019-03-22 16:49:56 +01:00
Vesa Jääskeläinen
ce7f10707d logind: relocate function return_test_polkit()
Relocate function return_test_polkit() upper in file for easier access from other functions.
2019-03-22 17:38:54 +02:00
Vesa Jääskeläinen
77defcf538 systemctl: restore "systemctl reboot ARG" functionality
Commit d85515edcf changed logic how reboot is
executed. That commit changed behavior to use emergency action reboot code path
to perform the reboot.

This inadvertently broke rebooting with argument:
$ systemctl reboot custom-reason

Restore original behavior so that if reboot service unit similar to
systemd-reboot.service is executed it is possible to override reboot reason
with "systemctl reboot ARG".

When "systemctl reboot ARG" is executed ARG is placed in file
/run/systemd/reboot-param and reboot is issued using logind's Reboot
dbus-service.

If RebootArgument is specified in systemd-reboot.service it takes precedence
over what systemctl sets.

Fixes: #11828
2019-03-22 17:38:54 +02:00
Evgeny Vereshchagin
53294d9496 network: add missing nulstr terminator
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13821
2019-03-22 13:25:42 +01:00
Lennart Poettering
c425c7c245 dbus-execute: don't needlessly override error code 2019-03-22 12:25:16 +01:00
Lennart Poettering
b1ea85dc08 dbus-execute: lets use exec_directory_type_from_string() to simplify things 2019-03-22 12:25:03 +01:00
Lennart Poettering
0f4b93c4b5 udev: use string_table_lookup() where we can 2019-03-22 12:21:12 +01:00
Lennart Poettering
63c691c648 string-table: use string_table_lookup() in our own macros everywhere 2019-03-22 12:21:12 +01:00
Zbigniew Jędrzejewski-Szmek
b1f13b0e75 nspawn-oci: mount source is optional 2019-03-22 12:04:32 +01:00
Zbigniew Jędrzejewski-Szmek
b2e07b1a02 nspawn-oci: use _cleanup_ in one more place 2019-03-22 11:51:21 +01:00
Zbigniew Jędrzejewski-Szmek
9ddd62cda1 fuzz-nspawn-oci: add fuzzer for the oci bundle loader 2019-03-22 11:09:52 +01:00
Lennart Poettering
ae408d77a9 nspawn: conditionalize libseccomp use
We support compilation without libseccomp, hence don't rely on its
symbols.
2019-03-22 11:07:03 +01:00
Yu Watanabe
3f4c9bc04c
Merge pull request #12066 from yuwata/fix-network-tunnel-12041
network: fix netdev_tunnel_verify()
2019-03-22 05:57:38 +09:00
Lennart Poettering
e947830460
Merge pull request #12046 from keszybz/simplify-invocation-id-check
sd-id128: look for invocation id in environment first, keyring second
2019-03-21 19:15:49 +01:00
Jan Engelhardt
085f826676 rpm: check argument counts for systemd macros
Invoking %systemd_tmpfiles (in %post) without any arguments, while
possible, will cause systemd-tmpfiles to process the entire system
configuration, rather than just the newly installed configuration
files. In https://github.com/systemd/systemd/pull/12048, it was
established that processing everything constitutes unusual practice,
and should be flagged as a mistake at build time.

Furthermore, invoking %systemd_post without any arguments will cause
the underlying `systemctl preset` to outright return an error ("Too
few arguments") when run. This can be flagged during build time in
the same manner.

As I have found no ways to successfully nest %if clauses inside a
macro[1], I am helping myself by reusing the recursive variable
expansion technique pioneered in [2].

Now, when %systemd_post or %systemd_tmpfiles is incorrectly used,
rpm gives accurate line number reporting, too:

	error: This macro requires some arguments
	error: line 11: %{systemd_post}

	error: This macro requires two arguments
	error: line 13: %{tmpfiles_create_package meh more more}

[1] what has been tried: %{expand:%%if "%#" == 0 \\\
    %%{error:you have given me %# args} \\\
    %%endif}

[2] http://git.savannah.gnu.org/cgit/automake.git/commit/?id=e0bd4af16da88e4c2c61bde42675660eff7dff51
2019-03-21 19:01:33 +01:00
Yu Watanabe
b239288f72
Merge pull request #11931 from yuwata/condition-test-list
split static condition tests from net_match_config()
2019-03-22 02:30:57 +09:00
Lennart Poettering
8d1ee64829 systemctl: make a copy of the "verb" from argv[] before forking off a child 2019-03-21 18:10:06 +01:00
Lennart Poettering
a0c6f3cb66 main-func: make sure we destruct memory and stuff last
Let's terminate pagers and agents before releasing all memory.
2019-03-21 18:10:06 +01:00
Lennart Poettering
290cb8e883 systemctl: tiny optimization 2019-03-21 18:10:06 +01:00
Lennart Poettering
b1dffbb91b systemctl: add missing OOM check 2019-03-21 18:10:06 +01:00
Lennart Poettering
3483460cb8 systemctl: document argv[] array 2019-03-21 18:10:06 +01:00
Lennart Poettering
d86e4c979a systemctl: use saved_argv where we can
No need to have another variable where we keep the original argv[].
Let's juse reuse the one DEFINE_MAIN_FUNCTION() stores for us anyway.
2019-03-21 18:10:06 +01:00
Lennart Poettering
60ffa37a65 main-func: implicitly save argc/argv in DEFINE_MAIN_FUNCTION() functions
Let's remove the risk of forgetting to save argc/argv if
DEFINE_MAIN_FUNCTION() is used.
2019-03-21 18:10:06 +01:00
Lennart Poettering
36fea15565 util: introduce save_argc_argv() helper 2019-03-21 18:08:56 +01:00
Lennart Poettering
c82cfae00b
Merge pull request #12062 from poettering/nspawn-main-func
nspawn: port to DEFINE_MAIN_FUNCTION()
2019-03-21 18:08:27 +01:00
Yu Watanabe
bb9683e096 network: fix netdev_tunnel_verify()
Fixes #12041.
2019-03-22 01:47:38 +09:00
Zbigniew Jędrzejewski-Szmek
bb068de080 nspawn: add --no-pager switch
It only matters for --help.
2019-03-21 17:42:43 +01:00
Zbigniew Jędrzejewski-Szmek
9dd6ccf7c0
Merge pull request #12014 from poettering/systemctl-exit-fix
systemctl fallback error propagation fix
2019-03-21 17:37:09 +01:00
Zbigniew Jędrzejewski-Szmek
05a8a7a0fb
Merge pull request #12052 from poettering/systemctl-fixlets
systemctl refactorings
2019-03-21 17:33:44 +01:00
Zbigniew Jędrzejewski-Szmek
c8c194a982
Merge pull request #12057 from poettering/chown-tty
chown TTY back to root:tty after a service terminates that used them
2019-03-21 17:31:19 +01:00
Lennart Poettering
04f590a4a4 nspawn: voidify sd_notify() calls 2019-03-21 16:32:46 +01:00
Lennart Poettering
6145bb4f78 nspawn: port to static destructors 2019-03-21 16:32:46 +01:00
Lennart Poettering
44dbef90f1 nspawn: port to main-func.h logic 2019-03-21 16:32:46 +01:00
Yu Watanabe
c4f58deab5 network,udev: split static condition tests from net_match_config() 2019-03-21 23:37:39 +09:00
Yu Watanabe
2bd0da7a05 network: drop unnecessary strdup() 2019-03-21 23:37:39 +09:00
Yu Watanabe
f9f88198ce core/unit: use condition_test_list() 2019-03-21 23:37:39 +09:00
Yu Watanabe
828fa6108b condition: introduce condition_test_list() 2019-03-21 23:37:39 +09:00
Yu Watanabe
f6d6d53237 log: expose log_object_internalv() 2019-03-21 23:37:39 +09:00
Zbigniew Jędrzejewski-Szmek
fa28e4e377
Merge pull request #12059 from poettering/nspawn-typos
some typo and other fixes result of the OCI nspawn merge
2019-03-21 15:14:11 +01:00
Lennart Poettering
c3d13d2ad5
Merge pull request #12058 from keszybz/oci-simplifications
Follow-ups for nspawn-oci review
2019-03-21 13:55:09 +01:00
Lennart Poettering
f4e803c809 nspawn: add a few missing flags from --help text 2019-03-21 13:31:09 +01:00
Lennart Poettering
2514865391 nspawn: reorder --help text, and add section
The list is so long, let's add a bit of structure and order things a
bit.
2019-03-21 13:27:19 +01:00
Lennart Poettering
2c9b7a7e62 mount: when we fail to establish an inaccessible mount gracefully, undo the mount 2019-03-21 12:41:02 +01:00
Lennart Poettering
74b6ce90a0 capability: add a test that fails if we ever enter > 64bit capability territory 2019-03-21 12:38:18 +01:00
Lennart Poettering
46eda04373 capability: also cap CAP_LAST_CAP at 63 2019-03-21 12:37:30 +01:00
Lennart Poettering
664ff517d3 capability: typo fix 2019-03-21 12:31:36 +01:00
Lennart Poettering
246bb37044 capability: use UINT64_C() where appropriate 2019-03-21 12:31:29 +01:00
Lennart Poettering
bff749416e capability: minimize scope of a few variables 2019-03-21 12:31:14 +01:00
Lennart Poettering
15ce3f2664 capability: minor coding style updates 2019-03-21 12:30:49 +01:00
Lennart Poettering
d09a25855f capability: add missing ')'
As pointed out by @polarina

d0b6a10c00 (commitcomment-32857641)
2019-03-21 12:29:18 +01:00
Zbigniew Jędrzejewski-Szmek
c924888ffd sd-id128: look for invocation id in environment first, keyring second
As general principle, we generally check command line args first, the
enviroment second, and external configuration and system state only later.
In case of the invocation ID, checking the keyring before the environment
was implemented as a poor-man's security measure. But this is not really
useful, since we're moving within the same security boundary. So let's just
do the expected thing, and check environment first.

Prompted by https://github.com/systemd/systemd/pull/11991#issuecomment-474647652.
2019-03-21 12:06:15 +01:00
Zbigniew Jędrzejewski-Szmek
6757a01356 util-lib: get rid of a helper variable 2019-03-21 11:08:58 +01:00
Zbigniew Jędrzejewski-Szmek
f1531db5af nspawn-oci: add helper function for free_and_strdup with oom check 2019-03-21 11:08:58 +01:00
Zbigniew Jędrzejewski-Szmek
d0b6a10c00
Merge pull request #9762 from poettering/nspawn-oci
OCI runtime support for nspawn
2019-03-21 11:01:53 +01:00
Zbigniew Jędrzejewski-Szmek
19130626a0 nspawn-oci: use SYNTHETIC_ERRNO 2019-03-21 10:51:43 +01:00
Lennart Poettering
6f765baf23 core: rework how we reset the TTY after use by a service
This makes two changes:

1. Instead of resetting the configured service TTY each time after a
   process exited, let's do so only when the service goes back to "dead"
   state. This should be preferable in case the started processes leave
   background child processes around that still reference the TTY.

2. chmod() and chown() the TTY at the same time. This should make it
   safe to run "systemd-run -p DynamicUser=1 -p StandardInput=tty -p
   TTYPath=/dev/tty8 /bin/bash" without leaving a TTY owned by a dynamic
   user around.
2019-03-20 21:28:02 +01:00
Lennart Poettering
6c0ae73956 execute: split check if we might touch a tty out of exec_context_may_touch_console()
Some simple refactoring that'll come handy in a later commit.
2019-03-20 21:20:00 +01:00
Lennart Poettering
955f1c852e execute: use path_equal() to compare tty names
After all they might be strings such as pts/1 which we really should
consider the same as pts//1.
2019-03-20 21:18:59 +01:00
Lennart Poettering
4bf953d91b
Merge pull request #12049 from keszybz/assorted-fixups
Assorted fixups
2019-03-20 18:27:34 +01:00
David Michael
82bd4da71e shared/install: Preserve escape characters for escaped unit names
Since switching to extract_first_word with no flags for parsing
unit names in 4c9565eea5, escape
characters will be stripped from escaped unit names such as
"mnt-persistent\x2dvolume.mount" resulting in the unit not being
configured as defined.  Preserve escape characters again for
compatibility with existing preset definitions.
2019-03-20 18:26:24 +01:00
Lennart Poettering
2e13c0c354 systemctl: start_unit() returns > 0 on error, let's catch that properly
Let's make sure we fall back correctly to initctl when start_unit()
returns an error > 0.

Fixes: #11546
2019-03-20 15:05:27 +01:00
Lennart Poettering
9dccc6d3ae systemctl: use strv_consume() where we can 2019-03-20 14:53:07 +01:00
Lennart Poettering
61ff45db95 systemctl: port to static destructors 2019-03-20 14:53:07 +01:00
Zbigniew Jędrzejewski-Szmek
d3bdba3816 test-fileio: avoid warning about ineffective comparison
On arm64 with gcc-8.2.1-5.fc29.aarch64:
../src/test/test-fileio.c:645:29: warning: comparison is always false due to limited range of data type [-Wtype-limits]
                 assert_se(c == EOF || safe_fgetc(f, &c) == 1);
                             ^~

Casting c to int is not enough, gcc is able to figure out that the original
type was unsigned and still warns. So let's just silence the warning like
in test-sizeof.c.
2019-03-20 14:00:12 +01:00
Zbigniew Jędrzejewski-Szmek
afd5c1e373 sd-bus: reduce scope of variable 2019-03-20 13:34:35 +01:00
Zbigniew Jędrzejewski-Szmek
96d2e0978d sd-bus: avoid IN_SET() invocation with two identical values
Fixes #12036.

../../../src/systemd/src/libsystemd/sd-bus/bus-objects.c: In function ‘add_object_vtable_internal’:
../../../src/systemd/src/basic/macro.h:423:19: error: duplicate case value
2019-03-20 13:28:29 +01:00
Zbigniew Jędrzejewski-Szmek
cc99274d7d test-alloc-util: add a smoke test for greedy_realloc 2019-03-20 13:17:27 +01:00
Zbigniew Jędrzejewski-Szmek
a49945e663
Merge pull request #12033 from fbuihuu/watched-process-improvments
Watched process improvments
2019-03-20 13:03:06 +01:00
Zbigniew Jędrzejewski-Szmek
ec7b77642c
Merge pull request #12047 from poettering/cryptsetup-fixlets
some small cryptsetup, ask-password and allocation fixlets
2019-03-20 13:02:34 +01:00
Chris Morin
08f9e80b3f journal-file: handle SIGBUS on offlining thread
The thread launched in journal_file_set_offline() accesses a memory
mapped file, so it needs to handle SIGBUS. Leave SIGBUS unblocked on the
offlining thread so that it uses the same handler as the main thread.

The result of triggering SIGBUS in a thread where it's blocked is
undefined in Linux. The tested implementations were observed to cause
the default handler to run, taking down the whole journald process.

We can leave SIGBUS unblocked in multiple threads since it's handler is
thread-safe. If SIGBUS is sent to the journald process asynchronously
(i.e. with kill, sigqueue, or raise), either thread handling it will
result in the same behavior: it will install the default handler and
reraise the signal, killing the process.

Fixes: #12042
2019-03-20 13:02:04 +01:00
Zbigniew Jędrzejewski-Szmek
45ce112002
Merge pull request #12024 from poettering/bindtoifindex
use SO_BINDTOIFINDEX where appropriate
2019-03-20 11:16:51 +01:00
Franck Bui
01542056aa scope: tiny cleanup: UNIT(s) -> u
No functional changes.
2019-03-20 10:51:49 +01:00
Franck Bui
846a07b505 core: only watch processes when it's really necessary
If we know that main pid is our child then it's unnecessary to watch all
other processes of a unit since in this case we will get SIGCHLD when the main
process will exit and will act upon accordingly.

So let's watch all processes only if the main process is not our child since in
this case we need to detect when the cgroup will become empty in order to
figure out when the service becomes dead. This is only needed by cgroupv1.
2019-03-20 10:51:49 +01:00
Franck Bui
f75f613d25 core: reduce the number of stalled PIDs from the watched processes list when possible
Some PIDs can remain in the watched list even though their processes have
exited since a long time. It can easily happen if the main process of a forking
service manages to spawn a child before the control process exits for example.

However when a pid is about to be mapped to a unit by calling unit_watch_pid(),
the caller usually knows if the pid should belong to this unit exclusively: if
we just forked() off a child, then we can be sure that its PID is otherwise
unused. In this case we take this opportunity to remove any stalled PIDs from
the watched process list.

If we learnt about a PID in any other form (for example via PID file, via
searching, MAINPID= and so on), then we can't assume anything.
2019-03-20 10:51:49 +01:00
Franck Bui
4d05154600 process-util: introduce pid_is_my_child() helper
No functional changes.
2019-03-20 10:51:49 +01:00
Lennart Poettering
054b6be05b ask-password: add extra paranoid overflow check 2019-03-20 10:48:33 +01:00
Lennart Poettering
32ae18206f alloc-util: typo fix 2019-03-20 10:48:33 +01:00
Lennart Poettering
d4b604baea alloc-util: use malloc_usable_size() to determine allocated size
It's a glibc-specific API, but supported on FreeBSD and musl too at
least, hence fairly common. This way we can reduce our calls to
realloc() as much as possible.
2019-03-20 10:48:33 +01:00
Lennart Poettering
23964f7faf alloc-util: add extra overflow checks to GREEDY_REALLOC() 2019-03-20 10:48:33 +01:00
Lennart Poettering
e5e21a0507 alloc-util: extra paranoid overflow check 2019-03-20 10:48:33 +01:00
Lennart Poettering
e1ed99c8c8 ask-password: erase character read with _cleanup_
This is much nicer, since it means we erase the character regardless how
we exit the scope.
2019-03-20 10:48:33 +01:00
Lennart Poettering
d5d1ae153f cryptsetup: small refactoring 2019-03-20 10:48:33 +01:00
Zbigniew Jędrzejewski-Szmek
dc502f8916
Merge pull request #12034 from poettering/stdio-bridge-fixes
small stdio-bridge and errno-util.h improvements and fixes
2019-03-20 10:46:32 +01:00
Zbigniew Jędrzejewski-Szmek
30222f4b2c util-lib: use a fixed buffer size for terminal path
The loop around ttyname_r() makes it look like we use unbounded stack
allocations. We know that that paths have a maximum size, so let's simplify
the whole thing.

Replaces #12043.
2019-03-20 09:36:45 +01:00
Lennart Poettering
08f6769675 execute: generalize uid/gid handling in two cases for any kind of uid/gid 2019-03-19 16:57:33 +01:00
Lennart Poettering
206e9864de core: change ownership/mode of the execution directories also for static users
It's probably unexpected if we do a recursive chown() when dynamic users
are used but not on static users.

hence, let's tweak the logic slightly, and recursively chown in both
cases, except when operating on the configuration directory.

Fixes: #11842
2019-03-19 16:57:33 +01:00
Lennart Poettering
d484580ca6 execute: remove one redundant comparison check 2019-03-19 16:52:28 +01:00
Lennart Poettering
40cd2ecc26 execute: also do the private/ symlink dance when runtime dir preservation is requested
In that case it's not safe to leave a regular dir around, hence, move it
to private/ too.
2019-03-19 16:52:28 +01:00
Lennart Poettering
edbfeb1204 execute: use path_join() where appropriate 2019-03-19 16:52:28 +01:00
Lennart Poettering
30ff18d8a2 fs-util: change chmod_and_chown() to not complain if stat data already matches
Let's reduce the chance of failure: if we can't apply the chmod/chown
requested, check if it's applied anyway, and if so, supress the error.

This is even race-free since we operate on an O_PATH fd anyway.
2019-03-19 16:52:28 +01:00
Lennart Poettering
a70984c049 tests: add tests for ConditionMemory= + ConditionCPUs 2019-03-19 15:55:08 +01:00
Lennart Poettering
754f719af2 condition: add ConditionMemory= and ConditionCPUs=
We have all the building blocks in place already, let's add this.

Fixes: #8990
2019-03-19 15:55:08 +01:00
Lennart Poettering
2877d42870 condition: for completenes sake at != comparator for ConditionKernelVersion= 2019-03-19 15:55:08 +01:00
Lennart Poettering
78d7652549 condition: use structured initialization 2019-03-19 15:55:07 +01:00
Lennart Poettering
20ee849d57 process-util: add new helper cpus_in_affinity_mask()
Let's add a new helper for determining how many CPUs are configured for
us
2019-03-19 15:55:07 +01:00
Lennart Poettering
ba22ff13a0 condition: split out kernel version comparison steps
Let's split out the operator parsing and the final verdict
determination. That way we can reuse this logic for other purposes later
on.
2019-03-19 15:55:07 +01:00
Lennart Poettering
f60a028a4e tree-wide: use ERRNO_IS_DISCONNECT() at more places 2019-03-19 15:41:30 +01:00
Lennart Poettering
dd90e39cb6 util: add one more disconnect errno code 2019-03-19 15:39:07 +01:00
Lennart Poettering
d1ded478ee stdio-bridge: slightly optimize formatting of structure 2019-03-19 15:29:44 +01:00
Lennart Poettering
451e16e0cb stdio-bridge: use SYNTHETIC_ERRNO() where appropriate 2019-03-19 15:29:44 +01:00
Lennart Poettering
b6056ea37c stdio-bridge: tweak getopt() case statement a bit 2019-03-19 15:29:44 +01:00
Lennart Poettering
578e95de48 stdio-bridge: fix getopt() parameter list to match reality 2019-03-19 15:29:44 +01:00
Lennart Poettering
4e17e5c2bf stdio-bridge: use ERRNO_IS_DISCONNECT() to detect disconnects
Let's use the macro we already have to make this safer. Moreover log
about all other errors.
2019-03-19 15:29:44 +01:00
Lennart Poettering
c3fecddf0d util: move ERRNO_IS_xyz macros to errno-util.h
It's where they fit much better.
2019-03-19 15:29:44 +01:00
Lennart Poettering
594da0a3e1 fd-util: beef up ERRNO_IS_xyz() macros a bit
Let's implicit drop the negation if there is one, to simplify things a
bit, similar how we do it in log_xyz()...
2019-03-19 15:29:44 +01:00
Zbigniew Jędrzejewski-Szmek
17b70256f2
Merge pull request #12028 from poettering/start-limit-hit
core: some start limit checking improvements + refactoring
2019-03-19 13:40:55 +01:00
dana
4890482531 journalctl: support -b all to negate effect of -b
Also fix an issue where -b without argument didn't always behave as -b0
2019-03-19 10:48:26 +01:00
Hugo Kindel
b5587fa994 systemd-cgls: typo error in help command
Correct a small typo error happening on two lines of the help command:
"specifified" instead of "specified".
2019-03-19 10:27:28 +01:00
Lennart Poettering
9adb695987 core: split error list in comment for unit_start() in two 2019-03-18 16:06:36 +01:00
Lennart Poettering
36c4dc089e core: change emergency_action() to return void
The function so far always returned -ECANCELLED, which is ignored in all
cases the function is invoked, except one: in unit_test_start_limit()
where -ECANCELLED is returned when the start limit is hit, which is part
of unit_start()'s protocol of return values.

Since the emergency_action() logic should be relatively generic and is
used in many places, let's drop the return value from it, since it's
constant anyway, and in alll cases useless. Instead, let's return it in
unit_test_start_limit(), where it's part of the protocol.

No change in behaviour.
2019-03-18 16:06:36 +01:00
Lennart Poettering
2de9b9793b core: check start limit on condition checks too
Let's add a safety precaution: if the start condition checks for a unit
are tested too often and fail each time, let's rate limit this too.

This should add extra safety in case people define .path, .timer or
.automount units that trigger a service that as a conditoin that always
fails.
2019-03-18 16:06:36 +01:00
Lennart Poettering
5766aca8d2 core: modernize unit_start() a bit
No change in behaviour, just a re-line-breaking of the various comments
to our current coding style, and some use of SYNTHETIC_ERRNO().
2019-03-18 16:06:36 +01:00
Lennart Poettering
a4191c9fb5 core: unify code for checking whether unit to trigger is loaded 2019-03-18 16:06:36 +01:00
Lennart Poettering
97a3f4ee05 core: rename unit_{start_limit|condition|assert}_test() to unit_test_xyz()
Just some renaming, no change in behaviour.

Background: I'd like to add more functions unit_test_xyz() that test
various things, hence let's streamline the naming a bit.
2019-03-18 16:06:36 +01:00
Lennart Poettering
9e30cf74ce core: add comment explaining ECOMM return value of unit_start()
we explain all other return values, explain these ones too.
2019-03-18 16:06:36 +01:00
Zbigniew Jędrzejewski-Szmek
3dec520197 bus: fix memleak on invalid message
Introduced in 6d586a1371.
Reported by Felix Riemann in https://bugzilla.redhat.com/show_bug.cgi?id=1685286.

Reproducer:
for i in `seq 1 100`; do gdbus call --session -d org.freedesktop.systemd1 -m org.freedesktop.systemd1.Manager.StartUnit -o "/$(for x in `seq 0 28000`; do echo -n $x; done)" & done
2019-03-18 15:25:26 +01:00
Topi Miettinen
ebcf697685 tree-wide: fix false search hits with ppp (typos) 2019-03-18 14:25:56 +01:00
Lennart Poettering
953a02d11b tree-wide: port various users over to socket_bind_to_ifindex() 2019-03-18 12:02:32 +01:00
Lennart Poettering
5d594d012d socket-util: add wrappers for binding socket to ifindex/ifname
socket_bind_to_ifindex() uses the the SO_BINDTOIFINDEX sockopt of kernel
5.0, with a fallback to SO_BINDTODEVICE on older kernels.

socket_bind_to_ifname() is a trivial wrapper around SO_BINDTODEVICE, the
only benefit of using it instead of SO_BINDTODEVICE directly is that it
determines the size of the interface name properly so that it also works
for unbinding. Moreover, it's an attempt to unify our invocations of the
sockopt with a size of strlen(ifname) rather than strlen(ifname)+1...
2019-03-18 12:02:32 +01:00
Zbigniew Jędrzejewski-Szmek
bcaabf481d fuzz-calendarspec: actually run the second part of the fuzzer
https://github.com/systemd/systemd/pull/11975#issuecomment-473467475
2019-03-16 18:13:17 +01:00
Lennart Poettering
d449d63a0d
Merge pull request #11975 from keszybz/fuzzer-fixes-n
Fixes for a few fuzzer issues
2019-03-15 17:34:37 +01:00
Lennart Poettering
95658673a0
Merge pull request #12016 from yuwata/fix-two-memleaks-found-by-oss-fuzz
Fix two memleaks found by oss fuzz
2019-03-15 17:33:48 +01:00
Yu Watanabe
50969cff60 network: clear previous assignment
Prompted by oss-fuzz#13719.
2019-03-16 00:12:25 +09:00
Yu Watanabe
1d0c1146ea nspawn: fix memleak
Fixes oss-fuzz#13691.
2019-03-15 23:53:05 +09:00
Zbigniew Jędrzejewski-Szmek
7acf581a58 Handle or voidify all calls to close_all_fds()
In activate, it is important that we close the fds. In other cases, meh.
2019-03-15 15:46:41 +01:00
Zbigniew Jędrzejewski-Szmek
054d871d41 test-execute: block /sys not /proc
As explained in the previous commit, blocking /proc can cause us
to go into a long loop or fail the test.
2019-03-15 15:46:41 +01:00
Zbigniew Jędrzejewski-Szmek
6a461d1f59 basic/fd-util: refuse "infinite" loop in close_all_fds()
I had a test machine with ulimit -n set to 1073741816 through pam
("session required pam_limits.so set_all", which copies the limits from PID 1,
left over from testing of #10921).

test-execute would "hang" and then fail with a timeout when running
exec-inaccessiblepaths-proc.service. It turns out that the problem was in
close_all_fds(), which would go to the fallback path of doing close()
1073741813 times. Let's just fail if we hit this case. This only matters
for cases where both /proc is inaccessible, and the *soft* limit has been
raised.

  (gdb) bt
  #0  0x00007f7e2e73fdc8 in close () from target:/lib64/libc.so.6
  #1  0x00007f7e2e42cdfd in close_nointr ()
     from target:/home/zbyszek/src/systemd-work3/build-rawhide/src/shared/libsystemd-shared-241.so
  #2  0x00007f7e2e42d525 in close_all_fds ()
     from target:/home/zbyszek/src/systemd-work3/build-rawhide/src/shared/libsystemd-shared-241.so
  #3  0x0000000000426e53 in exec_child ()
  #4  0x0000000000429578 in exec_spawn ()
  #5  0x00000000004ce1ab in service_spawn ()
  #6  0x00000000004cff77 in service_enter_start ()
  #7  0x00000000004d028f in service_enter_start_pre ()
  #8  0x00000000004d16f2 in service_start ()
  #9  0x00000000004568f4 in unit_start ()
  #10 0x0000000000416987 in test ()
  #11 0x0000000000417632 in test_exec_inaccessiblepaths ()
  #12 0x0000000000419362 in run_tests ()
  #13 0x0000000000419632 in main ()
2019-03-15 15:46:41 +01:00
Zbigniew Jędrzejewski-Szmek
9efb96315a test-execute: allow filtering test cases by pattern
When debugging failure in one of the cases, it's annoying to have to wade
through the output from all the other cases. Let's allow picking select
cases.
2019-03-15 15:46:41 +01:00
Zbigniew Jędrzejewski-Szmek
67fb5f338f seccomp: allow shmat to be a separate syscall on architectures which use a multiplexer
After
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0d6040d46817,
those syscalls have their separate numbers and we can block them.
But glibc might still use the old ones. So let's just do a best-effort
block and not assume anything about how effective it is.
2019-03-15 15:46:41 +01:00
Yu Watanabe
5f07d640ca network: clear previous assignment
Fixes oss-fuzz#13719.
2019-03-15 23:44:51 +09:00
Lennart Poettering
a3fc6b55ac nspawn: mask out CAP_NET_ADMIN again if settings file turns off private networking
Fixes: #11755
2019-03-15 15:42:21 +01:00
Lennart Poettering
bd4b15f274 nspawn: use right constant for shifting for uint64_t caps 2019-03-15 15:42:20 +01:00
Lennart Poettering
de40a3037a nspawn: add support for executing OCI runtime bundles with nspawn
This is a pretty large patch, and adds support for OCI runtime bundles
to nspawn. A new switch --oci-bundle= is added that takes a path to an
OCI bundle. The JSON file included therein is read similar to a .nspawn
settings files, however with a different feature set.

Implementation-wise this mostly extends the pre-existing Settings object
to carry additional properties for OCI. However, OCI supports some
concepts .nspawn files did not support yet, which this patch also adds:

1. Support for "masking" files and directories. This functionatly is now
   also available via the new --inaccesible= cmdline command, and
   Inaccessible= in .nspawn files.

2. Support for mounting arbitrary file systems. (not exposed through
   nspawn cmdline nor .nspawn files, because probably not a good idea)

3. Ability to configure the console settings for a container. This
   functionality is now also available on the nspawn cmdline in the new
   --console= switch (not added to .nspawn for now, as it is something
   specific to the invocation really, not a property of the container)

4. Console width/height configuration. Not exposed through
   .nspawn/cmdline, but this may be controlled through $COLUMNS and
   $LINES like in most other UNIX tools.

5. UID/GID configuration by raw numbers. (not exposed in .nspawn and on
   the cmdline, since containers likely have different user tables, and
   the existing --user= switch appears to be the better option)

6. OCI hook commands (no exposed in .nspawn/cmdline, as very specific to
   OCI)

7. Creation of additional devices nodes in /dev. Most likely not a good
   idea, hence not exposed in .nspawn/cmdline. There's already --bind=
   to achieve the same, which is the better alternative.

8. Explicit syscall filters. This is not a good idea, due to the skewed
   arch support, hence not exposed through .nspawn/cmdline.

9. Configuration of some sysctls on a whitelist. Questionnable, not
   supported in .nspawn/cmdline for now.

10. Configuration of all 5 types of capabilities. Not a useful concept,
    since the kernel will reduce the caps on execve() anyway. Not
    exposed through .nspawn/cmdline as this is not very useful hence.

Note that this only implements the OCI runtime logic itself. It does not
provide a runc-compatible command line tool. This is left for a later
PR. Only with that in place tools such as "buildah" can use the OCI
support in nspawn as drop-in replacement.

Currently still missing is OCI hook support, but it's already parsed and
everything, and should be easy to add. Other than that it's OCI is
implemented pretty comprehensively.

There's a list of incompatibilities in the nspawn-oci.c file. In a later
PR I'd like to convert this into proper markdown and add it to the
documentation directory.
2019-03-15 15:41:28 +01:00
Lennart Poettering
5ef4cb7ad0 nspawn: (void)ify more stuff 2019-03-15 15:33:09 +01:00
Lennart Poettering
61b4443361 nspawn: refactor setuid code a bit
Let's separate out the raw uid_t/gid_t handling from the username
handling. This is useful later on.

Also, let's use the right gid_t type for group types wherever
appropriate.
2019-03-15 15:33:09 +01:00
Lennart Poettering
5211445eae capability: let's protect against the kernel eventually doing more than 64 caps
Everyone will be in trouble then (as quite widely caps are store in
64bit fields). But let's protect ourselves at least to the point that we
ignore all higher caps for now.
2019-03-15 15:33:09 +01:00
Lennart Poettering
248dd94171 capability: deal with libcap being older than kernel 2019-03-15 15:33:09 +01:00
Lennart Poettering
c8a79aa812 capability: add a way to get a uint64_t with all caps set 2019-03-15 15:33:09 +01:00
Lennart Poettering
9a2c59119c capability: keep CAP_SETPCAP while dropping bounding caps
The kernel only allows dropping bounding caps as long as we have
CAP_SETPCAP. Hence, let's keep that before dropping the bounding caps,
and afterwards drop them too.
2019-03-15 15:33:09 +01:00
Zbigniew Jędrzejewski-Szmek
e55bdf9b6c seccomp: shm{get,at,dt} now have their own numbers everywhere
E.g. on i686:

(previously)
arch x86: SCMP_SYS(mmap) = 90
arch x86: SCMP_SYS(mmap2) = 192
arch x86: SCMP_SYS(shmat) = -221
arch x86: SCMP_SYS(shmat) = -221
arch x86: SCMP_SYS(shmdt) = -222

(now)
arch x86: SCMP_SYS(mmap) = 90
arch x86: SCMP_SYS(mmap2) = 192
arch x86: SCMP_SYS(shmat) = 397
arch x86: SCMP_SYS(shmat) = 397
arch x86: SCMP_SYS(shmdt) = 398

The relevant commit seems to be
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0d6040d46817.
2019-03-15 15:28:43 +01:00
Zbigniew Jędrzejewski-Szmek
a75fcef8fb shared/bootspec: avoid signed-unsigned comparison
../src/shared/bootspec.c: In function ‘find_sections’:
../src/shared/bootspec.c:425:23: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘int’} and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
  425 |                 if (n != size)
      |                       ^~
2019-03-15 15:28:43 +01:00
Lennart Poettering
75910ed9f4
Merge pull request #12012 from keszybz/generator-man-docs
Generator and documentation improvements
2019-03-15 14:45:00 +01:00
Yu Watanabe
c6e892bc0e core: add Manager::honor_device_enumeration flag
When system manager is started first time or after switching root,
then the udev's device tag data do not exist yet.
So, let's not honor the enumeration results.

Fixes #11997.
2019-03-15 19:47:43 +09:00
Yu Watanabe
49052946c9 core: use TAKE_PTR() at few more places 2019-03-15 19:01:12 +09:00
Yu Watanabe
87a19bfedc core: use _cleanup_free_ attribute and free_and_replace() macro in method_switch_root() 2019-03-15 18:59:31 +09:00
Yu Watanabe
8efb042e0c sd-id128: split the logic obtaining invocation ID from sd_id128_get_invocation() 2019-03-15 18:53:23 +09:00
Yu Watanabe
9363e2f499 id128: no command accepts additional arguments 2019-03-15 18:53:23 +09:00
Zbigniew Jędrzejewski-Szmek
2fffb93b32 analyze: reword explanation in critical-chain header
Let's try to make it a bit clearer.
2019-03-15 10:17:46 +01:00
Zbigniew Jędrzejewski-Szmek
00068caf36 fstab-generator: do not print double header
$ /run/systemd/generator/dev-mapper-fedora_krowka\x2dswap.swap
  # Automatically generated by systemd-fstab-generator

  # Automatically generated by systemd-fstab-generator

  [Unit]
  ...
2019-03-15 08:04:54 +01:00
Lennart Poettering
beb6196982
Merge pull request #11785 from dvdhrm/implicit-sasl
sd-bus: allow cross-uid-namespace connections
2019-03-14 15:42:03 +01:00
David Rheinsberg
1ed4723d38 sd-bus: skip sending formatted UIDs via SASL
The dbus external authentication takes as optional argument the UID the
sender wants to authenticate as. This uid is purely optional. The
AF_UNIX socket already conveys the same information through the
auxiliary socket data, so we really don't have to provide that
information.

Unfortunately, there is no way to send empty arguments, since they are
interpreted as "missing argument", which has a different meaning. The
SASL negotiation thus changes from:

    AUTH EXTERNAL <uid>
    NEGOTIATE_UNIX_FD                   (optional)
    BEGIN

to:

    AUTH EXTERNAL
    DATA
    NEGOTIATE_UNIX_FD                   (optional)
    BEGIN

And thus the replies we expect as a client change from:

    OK <server-id>
    AGREE_UNIX_FD                       (optional)

to:

    DATA
    OK <server-id>
    AGREE_UNIX_FD                       (optional)

Since the old sd-bus server implementation used the wrong reply for
"AUTH" requests that do not carry the arguments inlined, we decided to
make sd-bus clients accept this as well. Hence, sd-bus now allows
"OK <server-id>\r\n" replies instead of "DATA\r\n" replies.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2019-03-14 13:34:13 +01:00
David Rheinsberg
2010873b4b sd-bus: fix SASL reply to empty AUTH
The correct way to reply to "AUTH <protocol>" without any payload is to
send "DATA" rather than "OK". The "DATA" reply triggers the client to
respond with the requested payload.

In fact, adding the data as hex-encoded argument like
"AUTH <protocol> <hex-data>" is an optimization that skips the "DATA"
roundtrip. The standard way to perform an authentication is to send the
"DATA" line.

This commit fixes sd-bus to properly send the "DATA" line. Surprisingly
no existing implementation depends on this, as they all pass the data
directly as argument to "AUTH". This will not work if we want to pass
an empty argument, though.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2019-03-14 13:33:28 +01:00
David Rheinsberg
3cacdab925 sd-bus: avoid magic number in SASL length calculation
Lets avoid magic numbers and use a constant `strlen()` instead.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2019-03-14 13:31:14 +01:00
Lennart Poettering
c3b6a348c0 main: use _exit() rather than exit() in code potentially caled from signal handler 2019-03-14 13:25:52 +01:00
Lennart Poettering
d8b4d14df4 util: split out nulstr related stuff to nulstr-util.[ch] 2019-03-14 13:25:52 +01:00
Lennart Poettering
090a9c1eba util: move some raw memory functions from string-util.h → memory-util.h 2019-03-14 13:25:51 +01:00
Lennart Poettering
cfb4a84942 util: don't include util.h from def.h
Nothing it defines is used in it.
2019-03-14 13:25:51 +01:00
Lennart Poettering
47094ce067 util: move dbus specific definition into bus-internal.h
It shouldn't be defined globally, since it's pretty much an
implementation detail of DBus.
2019-03-14 13:25:51 +01:00
Lennart Poettering
f05e1d0d9f util: split out kbd related stuff
This stuff is neither generic enough to be in def.h, nor really has much
to do with locale, hence give it its own .c/.h file pair.
2019-03-14 13:25:51 +01:00
Lennart Poettering
ecd5f1a9e0 util: move display_is_local() to pam_systemd.c, its only user
It's quite specific anyway, hence let's move this where it's used
2019-03-14 13:25:51 +01:00
Lennart Poettering
2b2fec7db0 util: split out errno related stuff 2019-03-14 13:25:51 +01:00
Lennart Poettering
e56f9ffe51 util: split out plymouth related stuff 2019-03-14 13:25:51 +01:00
Zbigniew Jędrzejewski-Szmek
94dfd646b3
Merge pull request #11985 from poettering/clean-dir
some rafactoring in systemctl/bus-unit-util
2019-03-14 12:21:53 +01:00
Zbigniew Jędrzejewski-Szmek
7b7426506a
Merge pull request #11993 from poettering/resolved-stub-edns-size
some resolved stub dns reply fixes
2019-03-14 11:10:38 +01:00
Michael Biebl
055a083a47 Re-add uaccess tag for /dev/dri/renderD*
Setting an access mode != 0666 is explicitly supported via -Dgroup-render-mode
In such a case, re-add the uaccess tag.

This is basically the same change that was done for /dev/kvm in
commit fa53e24130 and
ace5e3111c
and partially reverts the changes from
4e15a7343c
2019-03-14 11:08:58 +01:00
Lennart Poettering
d55e43344b
Merge pull request #11971 from keszybz/kernel-install-directory
Make kernel-install create entry directory
2019-03-14 10:51:55 +01:00
Zbigniew Jędrzejewski-Szmek
e2600fd582 bootctl: use path_join() to join paths
We would say "/boot/efi//loader/entries"...
2019-03-14 08:28:18 +01:00
Yu Watanabe
3a27af62b5 network: wait for L2TP tunnel to be created before creating sessions
And if failed to create L2TP tunnel, then do not try to create sessions.
2019-03-14 10:57:41 +09:00
Yu Watanabe
0aa2fe6f9b netlink: support NLMSG_ERROR message in genl
This resolves the following log message after L2TP tunnel or session is
created:
```
sd-netlink: ignored message with unknown type: 2
```
2019-03-14 10:57:41 +09:00
Yu Watanabe
d053d08a37 network: automatically pick an address on link when L2TP.Local= is not specified
This makes L2TP.Local= support an empty string, 'auto', 'static', and
'dynamic'. When one of the values are specified, a local address is
automatically picked from the local interface of the tunnel.
2019-03-14 10:57:41 +09:00
Susant Sahani
3a56e697c8 networkd: Introduce l2tp tunnel
This works allows networkd to configure l2tp tunnel.
See http://man7.org/linux/man-pages/man8/ip-l2tp.8.html
2019-03-14 10:57:41 +09:00
Yu Watanabe
7033af49df network: introduce new netdev create type NETDEV_CREATE_AFTER_CONFIGURED
It will be used to support L2TP tunnel in later commits.
2019-03-14 10:57:41 +09:00
Yu Watanabe
859e9c0487 network: introduce netdev_get_create_type() helper function 2019-03-14 10:57:41 +09:00
Yu Watanabe
2b6db913e2 network: do not call link_joined() when not all netdevs are configured
If some of stacked netdevs are already configured, then link_joined()
is called before netdevs are fully configured.
2019-03-14 10:57:41 +09:00
Lennart Poettering
ff4caaaeba resolved: if we can't append EDNS OPT RR, then indicate truncation to stub client
We do so for any other RR we can't add, do this here too.

Fixes: #11625
2019-03-13 19:38:14 +01:00
Lennart Poettering
acd74d61d2 resolved: don't let EDNS0 OPT dgram size affect TCP
Fixes: #11884
2019-03-13 19:34:05 +01:00
Lennart Poettering
aa11cab98c resolved: don't follow cnames if we already noticed truncation 2019-03-13 19:34:05 +01:00
Balint Reczey
6c8a2c6793 virt: detect WSL environment as a container (id: wsl) 2019-03-13 18:42:27 +01:00
Lennart Poettering
1b63cc6ea9 bus-unit-procs: use empty_or_root() where appropriate 2019-03-13 17:44:11 +01:00
Lennart Poettering
25b1d72dcc bus-unit-util: split out code that shows a unit's process tree
The code is complex enough to deserve its own .c file. Let's split this
out.
2019-03-13 17:41:41 +01:00
Lennart Poettering
e45c81b8bc shared: split out code to wait for jobs to complet into its own source file
It's complex enough and quite a few functions. Let's hence split this
out.

No code change, just some rearranging of source files.
2019-03-13 17:39:24 +01:00
Lennart Poettering
aee7082fbd systemctl: drop unnecessary {} 2019-03-13 17:38:43 +01:00
Lennart Poettering
96e895efaf systemctl: use strv_consume() where appropriate 2019-03-13 17:38:43 +01:00
Lennart Poettering
fb1ac50e4e systemctl: minimize scope of 'p' 2019-03-13 17:38:43 +01:00
Lennart Poettering
7bc4bf4a69 execute: use path_join() where appropriate 2019-03-13 17:38:43 +01:00
Lennart Poettering
db7091dca2 bus-unit-util: insist on full initialization 2019-03-13 17:38:43 +01:00
Lennart Poettering
2cdb2c2dc3 bus-unit-util: never call into log_job_error_with_service_result() if we are not a service
The call can't handle non-services, hence don't bother.
2019-03-13 17:38:43 +01:00
Lennart Poettering
61e209eb3a bus-unit-util: move explanations array to inner scope
It's specific to service units, hence let's minimize the scope since it
has no validity outside of the log message generation for service units.
2019-03-13 17:38:43 +01:00
Lennart Poettering
190c22189d bus-unit-util: use structure initialization 2019-03-13 17:38:43 +01:00
Lennart Poettering
1c070ea086 bus-unit-util: use free_and_strdup() where we can 2019-03-13 17:38:43 +01:00
Lennart Poettering
9a1996455e systemctl: refactor code to watch unit ActiveState a bit
let's split out one function, to make this reusable
2019-03-13 17:38:43 +01:00
Lennart Poettering
ef9fafbd91 tests: add tests for embedded newlines in /proc/cmdline
Prompted by: #7097
2019-03-13 17:07:02 +01:00
Lennart Poettering
cc5957dca0 bootspec: don't log in boot_entries_load_config_auto() about no ESP
Let's do it in the caller instead. That way, logind can stay silent
about it.

Fixes: #11950
2019-03-13 17:06:24 +01:00
Zbigniew Jędrzejewski-Szmek
a3b1790c1a
Merge pull request #11986 from poettering/util-split
some splitting up of util.[ch]
2019-03-13 17:02:14 +01:00
Tobias Jungel
7f15b71460 networkd: Add bridge port capabilities
This PR adds the configuration switches for multicast flooding, neighbor
suppression and learning of a bridge port.
2019-03-13 16:27:22 +01:00
Adam Jackson
183e8c0bea login: mark nomodeset fb devices as master-of-seat
When 'nomodeset' is specified, there's no DRM driver to take over from
efifb. This means no device will be marked as a seat master, so gdm will
never find a sufficiently active seat to start on.

I'm not aware of an especially good way to detect this through a proper
kernel API, so check for the word 'nomodeset' on the command line and
allow fbdev devices to be seat masters if found.

For https://bugzilla.redhat.com/show_bug.cgi?id=1683197.
2019-03-13 12:17:34 +01:00
Lennart Poettering
760877e90c util: split out sorting related calls to new sort-util.[ch] 2019-03-13 12:16:43 +01:00
Lennart Poettering
0a9707187b util: split out memcmp()/memset() related calls into memory-util.[ch]
Just some source rearranging.
2019-03-13 12:16:43 +01:00
Lennart Poettering
eefc66aa8f util: split out some stuff into a new file limits-util.[ch] 2019-03-13 12:16:43 +01:00
Lennart Poettering
0cb8e3d118 util: split out namespace related stuff into a new namespace-util.[ch] pair
Just some minor reorganiztion.
2019-03-13 12:16:38 +01:00
Lennart Poettering
96c45cc697
Merge pull request #11861 from yuwata/network-verify-2
network: config parser updates and wireguard refactoring
2019-03-13 10:15:27 +01:00
Lennart Poettering
3cca6cfd41
Merge pull request #11893 from yuwata/wait-online-take-operstate
wait-online: optionally take required minimum operational state
2019-03-13 10:10:43 +01:00
Lennart Poettering
58fa7019a5
Merge pull request #11283 from yuwata/fix-11276
core/namespace: introduce new mount mode READWRITE_IMPLICIT
2019-03-13 09:57:18 +01:00
Yu Watanabe
2c65512ee7 cryptsetup: add same-cpu-crypt and submit-from-crypt-cpus options
Closes #11946.
2019-03-13 09:48:50 +01:00