Commit graph

25388 commits

Author SHA1 Message Date
Lennart Poettering 167fc10cb3 test: add test case for restrict_suid_sgid() 2019-04-02 16:56:48 +02:00
Lennart Poettering 3c27973b13 seccomp: introduce seccomp_restrict_suid_sgid() for blocking chmod() for suid/sgid files 2019-04-02 16:56:48 +02:00
Lennart Poettering 9e6e543c17 seccomp: add debug messages to seccomp_protect_hostname() 2019-04-02 16:56:48 +02:00
Lennart Poettering 42561fc99c core: add a generic helper that forwards per-unit method calls from Manager
Quite often we have a method DoSomethingWithUnit() on the Manager object
that is the same as a function DoSomething() on a Unit object. Let's
shorten things by introducing a common function that forwards the
former to the latter, instead of writing this again and again.
2019-04-02 16:38:20 +02:00
Zbigniew Jędrzejewski-Szmek 237ebf61e2
Merge pull request #12013 from yuwata/fix-switchroot-11997
core: on switching root do not emit device state change based on enumeration results
2019-04-02 16:06:07 +02:00
Lennart Poettering 568ee8fc46 udev: use strempty() where appropriate 2019-04-02 14:54:42 +02:00
Lennart Poettering 02dab76e93 json: use SYNTHETIC_ERRNO() where appropriate 2019-04-02 14:54:42 +02:00
Lennart Poettering bab4820ee2 sd-event: use DIV_ROUND_UP where appropriate 2019-04-02 14:54:42 +02:00
Lennart Poettering 39f2bc6e7e sd-device: use xsprintf() where appropriate 2019-04-02 14:54:42 +02:00
Lennart Poettering c614711386 tree-wide: use SYNTHETIC_ERRNO() where appropriate 2019-04-02 14:54:42 +02:00
Lennart Poettering c1db999eb8 boot: use TAKE_PTR() where appropriate 2019-04-02 14:54:42 +02:00
Lennart Poettering a7798cd81b tree-wide: use reallocarray() where appropriate 2019-04-02 14:54:42 +02:00
Lennart Poettering 0c21dafb54 util-lib: use FLAGS_SET() where appropriate 2019-04-02 14:54:38 +02:00
Lennart Poettering d737b451fe analyze: use empty_or_root() where appropriate 2019-04-02 14:53:25 +02:00
Zbigniew Jędrzejewski-Szmek 84ce204a93
Merge pull request #12185 from poettering/login-unstore-fd
logind: remove unused fds from fdstore
2019-04-02 14:27:27 +02:00
Zbigniew Jędrzejewski-Szmek 8a306989b3
Merge pull request #12186 from poettering/lgtm-updates
lgtm ruleset updates
2019-04-02 14:19:27 +02:00
Zbigniew Jędrzejewski-Szmek 2356d683f8
Merge pull request #12183 from poettering/askpwargv
tty-ask-password: let's copy argv[] before forking
2019-04-02 13:50:14 +02:00
Frantisek Sumsal 1a862e2151 journal: LGTM doesn't recognize suppressions in /* */ 2019-04-02 12:47:14 +02:00
Lennart Poettering f71611fed2 test: stop using dup() needlessly 2019-04-02 12:45:46 +02:00
Lennart Poettering efc19ee485 logind: when we cannot attach a passed fd to a device, close it
Replaces: #8532
2019-04-02 11:52:58 +02:00
Lennart Poettering 883d1b01b0 logind: simplify removal of device fds
let's use sd_notifyf(). Let's also stop validating the session ID here.
This is the destructor. if it contains a dash, we are already too late
here anyway.
2019-04-02 11:51:50 +02:00
Chris Morin 924426a703 journal-remote: use source's boot-id
systemd-journal-remote always wrote the boot-id of the device it was running on
to the header of its journal files. When the source had a different boot-id
(because it was generated on a different boot, or a different device), the
boot-ids in the file were inconsistent. The _BOOT_ID field was that of the
source, but the journal file header and each entry object header were that of
the device systemd-journal-remote ran on. This breaks journalctl --list-boots
on any of these files.

Set the boot-id in the header to be that of the source. This also fixes the
entry object headers.
2019-04-02 10:32:21 +02:00
Yu Watanabe 52cf2b13a0 ipv4ll: do not reset seed generation counter on restart
Fixes #12145.
2019-04-02 10:27:30 +02:00
Lennart Poettering 189b03779e tty-ask-password: re-break comment 2019-04-02 10:19:23 +02:00
Lennart Poettering d850296466 tty-ask-password: simplify signal handler installation 2019-04-02 10:19:22 +02:00
Lennart Poettering 7452917740 tty-ask-password: no need to initialize something already NUL initialized to NUL 2019-04-02 10:19:22 +02:00
Lennart Poettering 4bec7f09f8 tty-ask-password: drop redundant local variable 2019-04-02 10:19:22 +02:00
Lennart Poettering ed179fd710 tty-ask-password: copy argv[] before forking child
Another fix in style of bd169c2be0.

Let's also avoid strjoina() in a loop (i.e. stack allocation). While in
this specific caseone could get away with it (since we'd immediately
afterwards leave the loop) it's still ugly, and every static checker
would be totally within its rights to complain.

Also, let's simplify things by not relying on argc, since it's redundant
anyway, and it's nicer to just treat things as NULL terminated strv
array.

Fixes: #12180
2019-04-02 10:19:17 +02:00
Lennart Poettering efebb613c7 core: optionally, trigger .timer units on timezone and clock changes
Fixes: #6228
2019-04-02 08:20:10 +02:00
Lennart Poettering 787be190a8 run: rename with_timer → arg_with_timer
The value is directly initialized from cmdline args, hence let's name it
so, following our usual naming style.
2019-04-02 08:19:35 +02:00
Lennart Poettering 7dd1e315b2 core: use more structured initialization 2019-04-02 08:19:35 +02:00
Topi Miettinen 509276f2b7 build: install /etc/systemd/{system,user}-generators
Manual page systemd.generators refers to /etc/systemd/{system,user}-generators,
but the paths do not exist, so let's install them.
2019-04-02 07:53:32 +02:00
Yu Watanabe 3f8f021541
Merge pull request #12030 from poettering/condition-memory
add ConditionCPUs= + ConditionMemory=
2019-04-02 08:01:42 +09:00
Lennart Poettering ca006fc640 core: refactor transaction.c to use fewer gotos
In particular, let's not use gotos that jump up, i.e. are loops. gotos
that jump down for the purpose of clean-up are cool, but using them for
loops is evil.

No change in behaviour, just some refactoring.
2019-04-02 07:28:58 +09:00
Yu Watanabe dd09a9ec0f
Merge pull request #12160 from yuwata/wait-online-allow-configuring
wait-online: add --any option
2019-04-02 06:10:36 +09:00
Yu Watanabe 7a24df5ecc
Merge pull request #12155 from yuwata/network-fix-and-extend-foo-over-udp-support
network: fix and extend Foo over UDP
2019-04-02 06:10:07 +09:00
Lennart Poettering d2e1b2fd67 systemctl: print a more accurate error message when we can 2019-04-02 05:44:12 +09:00
Lennart Poettering c2f64c07c1 rm-rf: refuse combining REMOVE_ONLY_DIRECTORIES and REMOVE_SUBVOLUME for now
It's not easy to implement such a combined operation race-freely since
dropping a subvolume will drop all its contents, including any
non-directories.

Hence, let's just not support this combination for now. Which isn't much
of a loss, since we never combine these flags anyway.
2019-04-02 05:40:05 +09:00
Lennart Poettering ebf8d79a58 core: export ReloadResult value on the bus
We keep track of it, but never exposed it. Let's fix that.
2019-04-02 05:39:05 +09:00
Lennart Poettering c25c118710 shared: add some minor comments 2019-04-02 05:34:53 +09:00
Lennart Poettering 4659bf6f76 core: add a common function for bus calls that return unit dbus path
Let's shorten the code a bit by using a single function for similar
cases.

No change in behaviour, just some refactoring and shortening.
2019-04-02 05:34:03 +09:00
Yu Watanabe 6872bd4721
Merge pull request #12167 from poettering/timer-parse-tweak
two tweaks for timer expression parsing
2019-04-02 05:29:53 +09:00
Lennart Poettering b6cceaae30 fs-util: suppress world-writable warnings if we read /dev/null
Fixes: #12165
2019-04-01 22:07:41 +02:00
Lennart Poettering c0b471e197 sd-bus: add missing empty line 2019-04-01 20:56:19 +02:00
Yu Watanabe 2f9859baa8 wait-online: add --any option
When this option is specified, wait-online exits with success even
when several interfaces are in configuring state.

Closes #9714.
2019-04-02 03:37:50 +09:00
Yu Watanabe 7df5c6ba90 network: make FooOverUDP.Protocol= support name of ipproto 2019-04-02 03:29:41 +09:00
Yu Watanabe 881c74bd64 network: use asynchronous call for creating FOU tunnels
Otherwise, multiple FOU tunnels cannot be created correctly.
2019-04-02 03:08:49 +09:00
Yu Watanabe 3abf950fdb network: do not ignore FooOverUDP.Encapsulation= setting
Previously the setting is ignored and always FOU_ENCAP_GUE is sent.
2019-04-02 03:07:42 +09:00
Yu Watanabe a27a0ad641 network: merge ipip_init() and sit_init() 2019-04-02 03:07:08 +09:00
Yu Watanabe 4799d932b5 network: add FooOverUDP support for SIT and GRE tunnels 2019-04-02 03:07:08 +09:00
Lennart Poettering dc44c96d97 core: pass parse error to log functions when parsing timer expressions 2019-04-01 18:25:43 +02:00
Lennart Poettering 25a04ae55e core: simply timer expression parsing by using ".ltype" field of conf-parser logic
No change of behaviour. Let's just not parse the lvalue all the time
with timer_base_from_string() if we can already pass it in parsed.
2019-04-01 18:25:43 +02:00
Yu Watanabe 76e62a4d22 udev: move udev_ctrl_cleanup() into manager_free() 2019-04-01 15:20:03 +02:00
Lennart Poettering 245d386a03
Merge pull request #12157 from yuwata/network-netdev-name-conflict
network: handle NetDev.Name= conflict nicely
2019-04-01 15:17:07 +02:00
Yu Watanabe 4b4a6c9b41 udev: shorten code a bit 2019-04-01 10:30:31 +09:00
Yu Watanabe c6e77d7b22 network: add '=' to config key names in log
Also, long lines are wrapped.
2019-04-01 10:30:31 +09:00
Yu Watanabe b519908cac network: do not abort execution when NetDev.Name= conflicts
This also changes that .netdev files are loaded in ascending order.
Otherwise, when NetDev.ifname= setting conflicts with other .netdev file,
then .netdev file with large prefix number wins.
2019-04-01 10:30:31 +09:00
Yu Watanabe 18268197fa bootspec: fix memleak caused by setting invalid cleanup function 2019-03-31 23:31:29 +09:00
Yu Watanabe 7226337574 bootspec: add missing free() in boot_config_free() 2019-03-31 23:30:30 +09:00
Yu Watanabe b07b19dff8
Merge pull request #12147 from yuwata/network-gre-key-12144
network: make GRE and GRETAP support Key= or friends
2019-03-31 22:12:34 +09:00
Yu Watanabe a8b9a65c50 network: make GRE and GRETAP support Key=, InputKey=, OutputKey=, and SerializeTunneledPackets=
This also merge netdev_gre_fill_message_create() and netdev_erspan_fill_message_create().
2019-03-30 21:16:03 +09:00
Zbigniew Jędrzejewski-Szmek d923021aeb
Merge pull request #12048 from jengelh/master
rpm: avoid hiding errors from systemd commands
2019-03-29 22:27:31 +01:00
Yu Watanabe 9282f75bf4 network: make erspan netdev can be specified in Network.Tunnel= 2019-03-30 03:52:25 +09:00
Yu Watanabe 1a9bc3d8f6 network: do not continue when appending data to netlink message fails 2019-03-30 03:52:21 +09:00
Zbigniew Jędrzejewski-Szmek 6ea07d4fb4
Merge pull request #12140 from poettering/copy-early
chattr/copy.c fixes
2019-03-29 15:02:50 +01:00
Zbigniew Jędrzejewski-Szmek 983616735e
Merge pull request #12137 from poettering/socket-var-run
warn about sockets in /var/run/ too
2019-03-29 15:00:25 +01:00
Zbigniew Jędrzejewski-Szmek 2818ddc8f4
Merge pull request #12133 from poettering/rseq-whitelist
whitelist rseq() system call in `@default` syscall group
2019-03-29 14:59:00 +01:00
Lennart Poettering 196f306795 analyze: check both possible mount points of tracefs
Let's try the new one first, the old one second.
2019-03-29 14:57:37 +01:00
Lennart Poettering bd169c2be0 fsck: copy out device argument from argv[] before forking
We nowadays rename our child processes, hence argv[] will be clobbered,
let's hence copy the device path to dynamic memory before forking.

This is fall-out from 60ffa37a65 since we
now a lot more often end up overriding the argv[] buffer than before,
simple because we know what to override.

These kind of bugs kinda suck. THere are only two options here: stop
overriding argv[] for all cases (or just these cases) or explicitly
copying out everything we need in child processes before forking. With
this patch I opt for the latter, though I am not 100% convinced this is
a great solution. Just a better solution than everything else, i.e.
allowing argv[] to remain out of sync with what others see.

Fixes: #12135
2019-03-29 08:18:25 +01:00
Jörg Thalheim 7232c1f9da wireguard: fix exponential backoff when resolving hosts
It should stop at 25s, not start.
Fixes #12134
2019-03-28 20:00:19 +01:00
Zbigniew Jędrzejewski-Szmek f2dc22b447 headers: add missing includes
Fixes #12125.
2019-03-28 19:59:56 +01:00
Lennart Poettering b8a736d7a0 sd-bus: change "int" → "signed int" on bitfield
Apparently by the C standard "int" bitfields can have any signedness
(unlike non-bitfield declarations which are "signed" if the signedness
is not specified).

Let's fix the LGTM warning about this hence and be explicit that we mean
"signed" here.
2019-03-28 19:07:51 +01:00
Lennart Poettering d629ba7045 tmpfiles: move full chattr flag set to chattr-util.h
It's a pretty generic concept and fits will there, hence let's move it.
2019-03-28 18:43:05 +01:00
Lennart Poettering 75006470ce tmpfiles: support the FS_PROJINHERIT_FL chattr flag 2019-03-28 18:43:04 +01:00
Lennart Poettering 8a016c746e util-lib: when copying files make sure to apply some chattrs early, some late
Some chattrs only work sensible if you set them right after opening a
file for create (think: FS_NOCOW_FL). Others only work when they are
applied when the file is fully written (think: FS_IMMUTABLE_FL). Let's
take that into account when copying files and applying a chattr to them.
2019-03-28 18:43:04 +01:00
Lennart Poettering c3272fd4df missing: add FS_PROJINHERIT_FL
It's available since kernel 4.5, but not in older kernels.
2019-03-28 18:43:04 +01:00
Lennart Poettering 4a66b5c9bf core: complain and correct /var/run/ → /run/ for listening sockets
We already do that for PIDFile= paths, and for tmpfiles.d/ snippets,
let's also do this for .socket paths.
2019-03-28 16:59:57 +01:00
Lennart Poettering 7d2c9c6b50 load-fragment: use TAKE_PTR() where we can 2019-03-28 16:46:27 +01:00
Michal Sekletar 48da47eeca cryptsetup-generator: set high OOM score for systemd-cryptsetup instances
With new LUKS2 header format it is possible to use Argon2 key derivation
function. This function is "memory-hard" hence keyslot unlocking can
potentially use a lot of RAM as this increases resistance to massively
parallel GPU based password cracking.

However, when multiple systemd-cryptsetup binaries run at the same
time it is very likely that system using Argon2 (e.g. Fedora 30)
will encounter memory-pressure during early boot, following OOM killing
spree.

This patch aims to lower the damage done by OOM killer and sets OOMScore
for systemd-cryptsetup units to 500. Hopefully OOM killer will then
shoot us down and leave rest of the system services alone.
2019-03-28 15:52:41 +01:00
Lennart Poettering e8413b651b
Merge pull request #12130 from keszybz/fix-ndebug-builds
Fix ndebug builds
2019-03-28 15:52:27 +01:00
Lennart Poettering 6fee3be0b4 seccomp: add rseq() to default list of syscalls to whitelist
Apparently glibc is going to call this implicitly soon, hence let's
whitelist this by default.

Fixes: #12127
2019-03-28 12:09:38 +01:00
Lennart Poettering acd142af79 core: break overly long line 2019-03-28 12:09:38 +01:00
Lennart Poettering 2f6b9110fc core: parse '@default' seccomp group permissively
We are about to add system calls (rseq()) not available on old
libseccomp/old kernels, and hence we need to be permissive when parsing
our definitions.
2019-03-28 12:09:38 +01:00
Zbigniew Jędrzejewski-Szmek c6335c3b51
Merge pull request #12115 from poettering/verbose-job-enqueue
add "systemctl --show-transaction start" as a more verbose "systemctl start" that shows enqueued jobs
2019-03-28 11:04:26 +01:00
Zbigniew Jędrzejewski-Szmek ee36fed438 core: avoid unnecessary cast 2019-03-28 09:45:19 +01:00
Zbigniew Jędrzejewski-Szmek 3b1e405f36 test-terminal-util: fix sigsegv when compiled without asserts
I couldn't figure out what is going on here, because LTO inlines everything and
then the backtrace reported a different spot. But when compiled with NDEBUG but
no LTO, it's fairly obvious ;)

C.f. #12008.
2019-03-28 09:45:19 +01:00
Zbigniew Jędrzejewski-Szmek 10c353e1c5 Remove variable only used for an assert
When compiled with -DNDEBUG, we get warnings about set-but-unused variables.
In general, it's not something we care about, but since removing those
variables arguably makes the code nicer, let's just to it in this case.
2019-03-28 09:03:06 +01:00
Zbigniew Jędrzejewski-Szmek 4e494d17db test-terminal-util: add function logging 2019-03-28 09:03:06 +01:00
Lennart Poettering 0a6991e0bb tree-wide: reorder various structures to make them smaller and use fewer cache lines
Some "pahole" spelunking.
2019-03-27 18:11:11 +01:00
Lennart Poettering 6990fb6bc6 tree-wide: (void)ify a few unlink() and rmdir()
Let's be helpful to static analyzers which care about whether we
knowingly ignore return values. We do in these cases, since they are
usually part of error paths.
2019-03-27 18:09:56 +01:00
Lennart Poettering 36dbf97170
Merge pull request #12119 from keszybz/voidify-mkdir-p
Voidify mkdir_p() and normalize util.h includes
2019-03-27 15:05:51 +01:00
Zbigniew Jędrzejewski-Szmek 330b8fb379 journalctl: voidify mkdir_p() call and unify two similar code paths
Let's unify the two similar code paths to watch /run/systemd/journal.
The code in manager.c is similar, but it uses mkdir_p_label(), and unifying
that would be too much trouble, so let's just adjust the error messages to
be the same.

CID #1400224.
2019-03-27 13:01:44 +01:00
Lennart Poettering 1fd4c4edce terminal-util: add paranoid overflow check 2019-03-27 12:43:34 +01:00
Lennart Poettering f171decd3f terminal-util: modernize things with TAKE_PTR a bit 2019-03-27 12:43:34 +01:00
Lennart Poettering 85d9b5981b systemctl: add new --show-transaction switch
This new switch uses the new method call EnqueueUnitJob() for enqueuing
a job and showing the jobs it enqueued.

Fixes: #2297
2019-03-27 12:37:37 +01:00
Lennart Poettering 94369fc066 systemctl: split out extra args generation into helper function of its own 2019-03-27 12:37:37 +01:00
Lennart Poettering 5fd77930ad systemctl: reindent table 2019-03-27 12:37:37 +01:00
Lennart Poettering ee4296496f systemctl: more SYNTHETIC_ERRNO() conversion 2019-03-27 12:37:37 +01:00
Lennart Poettering c45e5fb877 systemctl: replace switch statement by table of structures 2019-03-27 12:37:37 +01:00
Lennart Poettering 50cbaba4fe core: add new API for enqueing a job with returning the transaction data 2019-03-27 12:37:37 +01:00
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