platform/upstream/systemd.git
5 years agonetwork,udev: explicitly declare 'conditions' is a list
Yu Watanabe [Sat, 23 Mar 2019 15:27:09 +0000 (00:27 +0900)]
network,udev: explicitly declare 'conditions' is a list

5 years agoutil: fix condition_free_list_type()
Yu Watanabe [Sat, 23 Mar 2019 15:22:38 +0000 (00:22 +0900)]
util: fix condition_free_list_type()

This fixes a bug introduced by c4f58deab56282cd438922203287cb073b861513.

Closes oss-fuzz#13878, oss-fuzz#13882, oss-fuzz#13884, oss-fuzz#13886, and
oss-fuzz#13888.

5 years agoMerge pull request #11602 from vesajaaskelainen/dbus-reboot-with-parameters
Lennart Poettering [Fri, 22 Mar 2019 20:07:47 +0000 (21:07 +0100)]
Merge pull request #11602 from vesajaaskelainen/dbus-reboot-with-parameters

dbus-manager: Add RebootWithParameters d-bus method

5 years agoMerge pull request #12079 from keszybz/fuzz-nspawn-oci
Lennart Poettering [Fri, 22 Mar 2019 20:06:17 +0000 (21:06 +0100)]
Merge pull request #12079 from keszybz/fuzz-nspawn-oci

Add fuzzer for nspawn-oci

5 years agologind: Add support for RebootParameter
Vesa Jääskeläinen [Sat, 9 Mar 2019 20:30:58 +0000 (22:30 +0200)]
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.

5 years agoMerge pull request #12075 from keszybz/two-docs
Lennart Poettering [Fri, 22 Mar 2019 17:11:59 +0000 (18:11 +0100)]
Merge pull request #12075 from keszybz/two-docs

Two small man page enhancements

5 years agonspawn: don't free "fds" twice
Lennart Poettering [Fri, 22 Mar 2019 14:22:45 +0000 (15:22 +0100)]
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

5 years agonspawn-oci: fix double free
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 16:23:49 +0000 (17:23 +0100)]
nspawn-oci: fix double free

Also rename function to make it clear that it also frees the array
object itself.

5 years agoudev/link-config: rename MACPolicy to MACAddressPolicy
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 16:16:17 +0000 (17:16 +0100)]
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.

5 years agoMerge pull request #12055 from poettering/save-argc-argv
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 15:58:18 +0000 (16:58 +0100)]
Merge pull request #12055 from poettering/save-argc-argv

main-func.h and systemctl argc/argv improvements

5 years agoMerge pull request #12072 from poettering/string-table-fixes
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 15:49:56 +0000 (16:49 +0100)]
Merge pull request #12072 from poettering/string-table-fixes

three small string table fixes

5 years agologind: relocate function return_test_polkit()
Vesa Jääskeläinen [Mon, 11 Mar 2019 21:18:29 +0000 (23:18 +0200)]
logind: relocate function return_test_polkit()

Relocate function return_test_polkit() upper in file for easier access from other functions.

5 years agosystemctl: restore "systemctl reboot ARG" functionality
Vesa Jääskeläinen [Sat, 9 Mar 2019 20:30:45 +0000 (22:30 +0200)]
systemctl: restore "systemctl reboot ARG" functionality

Commit d85515edcf9700dc068201ab9f7103f04f3b25b2 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

5 years agoNEWS: add missing word
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 15:26:05 +0000 (16:26 +0100)]
NEWS: add missing word

5 years agoman: clarify that ExecStop= is always called
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 12:23:02 +0000 (13:23 +0100)]
man: clarify that ExecStop= is always called

Fixes #11744.

5 years agoman: update description of initrd in bootup(7)
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 12:10:39 +0000 (13:10 +0100)]
man: update description of initrd in bootup(7)

Mention that initramfs is used, not initrd, even though we still call
it that. Also add links and clarify who loads the initramfs.

5 years agoNEWS: prepare for v242
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 14:27:27 +0000 (15:27 +0100)]
NEWS: prepare for v242

5 years agonetwork: add missing nulstr terminator
Evgeny Vereshchagin [Fri, 22 Mar 2019 10:38:02 +0000 (11:38 +0100)]
network: add missing nulstr terminator

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13821

5 years agodbus-execute: don't needlessly override error code
Lennart Poettering [Fri, 22 Mar 2019 11:25:16 +0000 (12:25 +0100)]
dbus-execute: don't needlessly override error code

5 years agodbus-execute: lets use exec_directory_type_from_string() to simplify things
Lennart Poettering [Fri, 22 Mar 2019 11:14:09 +0000 (12:14 +0100)]
dbus-execute: lets use exec_directory_type_from_string() to simplify things

5 years agoudev: use string_table_lookup() where we can
Lennart Poettering [Fri, 22 Mar 2019 11:13:01 +0000 (12:13 +0100)]
udev: use string_table_lookup() where we can

5 years agostring-table: use string_table_lookup() in our own macros everywhere
Lennart Poettering [Fri, 22 Mar 2019 11:12:29 +0000 (12:12 +0100)]
string-table: use string_table_lookup() in our own macros everywhere

5 years agonspawn-oci: mount source is optional
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 11:04:32 +0000 (12:04 +0100)]
nspawn-oci: mount source is optional

5 years agonspawn-oci: use _cleanup_ in one more place
Zbigniew Jędrzejewski-Szmek [Fri, 22 Mar 2019 10:51:21 +0000 (11:51 +0100)]
nspawn-oci: use _cleanup_ in one more place

5 years agofuzz-nspawn-oci: add fuzzer for the oci bundle loader
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 22:16:56 +0000 (23:16 +0100)]
fuzz-nspawn-oci: add fuzzer for the oci bundle loader

5 years agomeson: add libseccomp as a nspawn dep (#12067)
Franck Bui [Fri, 22 Mar 2019 10:09:08 +0000 (11:09 +0100)]
meson: add libseccomp as a nspawn dep (#12067)

Due to this specific change: d0b6a10#diff-0203416587516c224c8fcfe8129e7caeR8,
systemd-nspawn uses libseccomp now if it is available. We we need to pass -I/usr/include
/libseccomp (or wherever seccomp.h is located) when compiling systemd-nspawn because
nspawn-settings.h does #include <seccomp.h>.

Fixes: #12060

5 years agonspawn: conditionalize libseccomp use
Lennart Poettering [Thu, 21 Mar 2019 17:53:46 +0000 (18:53 +0100)]
nspawn: conditionalize libseccomp use

We support compilation without libseccomp, hence don't rely on its
symbols.

5 years agoMerge pull request #12066 from yuwata/fix-network-tunnel-12041
Yu Watanabe [Thu, 21 Mar 2019 20:57:38 +0000 (05:57 +0900)]
Merge pull request #12066 from yuwata/fix-network-tunnel-12041

network: fix netdev_tunnel_verify()

5 years agohwdb: make ids_parser.py compatible with pyparsing-2.3.0+
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 16:11:31 +0000 (17:11 +0100)]
hwdb: make ids_parser.py compatible with pyparsing-2.3.0+

https://github.com/pyparsing/pyparsing/blob/master/CHANGES#L175
says something about fixing erroneously created levels in the hierarchy.
I don't have the faintest idea what this means, but with the change in
this patch we generate output that is unchanged from pre-2.3.0 versions.

Tested with python3-pyparsing-2.3.1-1.fc30.noarch and
python3-pyparsing-2.2.0-3.fc29.noarch.

Fixes #12021.

5 years agoman: mention that Tunnel.Local= and Tunnel.Remote= can take 'any'
Yu Watanabe [Thu, 21 Mar 2019 16:54:27 +0000 (01:54 +0900)]
man: mention that Tunnel.Local= and Tunnel.Remote= can take 'any'

5 years agoman: do not wrap line in the table
Yu Watanabe [Thu, 21 Mar 2019 16:53:46 +0000 (01:53 +0900)]
man: do not wrap line in the table

5 years agotest-network: add more tests for tunneling devices
Yu Watanabe [Thu, 21 Mar 2019 16:48:49 +0000 (01:48 +0900)]
test-network: add more tests for tunneling devices

5 years agoMerge pull request #12046 from keszybz/simplify-invocation-id-check
Lennart Poettering [Thu, 21 Mar 2019 18:15:49 +0000 (19:15 +0100)]
Merge pull request #12046 from keszybz/simplify-invocation-id-check

sd-id128: look for invocation id in environment first, keyring second

5 years agoMerge pull request #11931 from yuwata/condition-test-list
Yu Watanabe [Thu, 21 Mar 2019 17:30:57 +0000 (02:30 +0900)]
Merge pull request #11931 from yuwata/condition-test-list

split static condition tests from net_match_config()

5 years agoMerge pull request #12020 from mrc0mmand/test-functions-interactive-debug
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 17:15:04 +0000 (18:15 +0100)]
Merge pull request #12020 from mrc0mmand/test-functions-interactive-debug

test: test-functions improvements for debugging

5 years agosystemctl: make a copy of the "verb" from argv[] before forking off a child
Lennart Poettering [Thu, 21 Mar 2019 17:07:21 +0000 (18:07 +0100)]
systemctl: make a copy of the "verb" from argv[] before forking off a child

5 years agomain-func: make sure we destruct memory and stuff last
Lennart Poettering [Thu, 21 Mar 2019 16:57:16 +0000 (17:57 +0100)]
main-func: make sure we destruct memory and stuff last

Let's terminate pagers and agents before releasing all memory.

5 years agosystemctl: tiny optimization
Lennart Poettering [Thu, 21 Mar 2019 16:51:08 +0000 (17:51 +0100)]
systemctl: tiny optimization

5 years agosystemctl: add missing OOM check
Lennart Poettering [Thu, 21 Mar 2019 16:44:30 +0000 (17:44 +0100)]
systemctl: add missing OOM check

5 years agosystemctl: document argv[] array
Lennart Poettering [Thu, 21 Mar 2019 16:44:09 +0000 (17:44 +0100)]
systemctl: document argv[] array

5 years agosystemctl: use saved_argv where we can
Lennart Poettering [Fri, 15 Mar 2019 09:47:19 +0000 (10:47 +0100)]
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.

5 years agomain-func: implicitly save argc/argv in DEFINE_MAIN_FUNCTION() functions
Lennart Poettering [Fri, 15 Mar 2019 13:49:43 +0000 (14:49 +0100)]
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.

5 years agoutil: introduce save_argc_argv() helper
Lennart Poettering [Fri, 15 Mar 2019 09:46:54 +0000 (10:46 +0100)]
util: introduce save_argc_argv() helper

5 years agoMerge pull request #12062 from poettering/nspawn-main-func
Lennart Poettering [Thu, 21 Mar 2019 17:08:27 +0000 (18:08 +0100)]
Merge pull request #12062 from poettering/nspawn-main-func

nspawn: port to DEFINE_MAIN_FUNCTION()

5 years agonetwork: fix netdev_tunnel_verify()
Yu Watanabe [Thu, 21 Mar 2019 16:47:35 +0000 (01:47 +0900)]
network: fix netdev_tunnel_verify()

Fixes #12041.

5 years agonspawn: add --no-pager switch
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 14:24:50 +0000 (15:24 +0100)]
nspawn: add --no-pager switch

It only matters for --help.

5 years agoMerge pull request #12014 from poettering/systemctl-exit-fix
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 16:37:09 +0000 (17:37 +0100)]
Merge pull request #12014 from poettering/systemctl-exit-fix

systemctl fallback error propagation fix

5 years agoMerge pull request #12052 from poettering/systemctl-fixlets
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 16:33:44 +0000 (17:33 +0100)]
Merge pull request #12052 from poettering/systemctl-fixlets

systemctl refactorings

5 years agoMerge pull request #12057 from poettering/chown-tty
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 16:31:19 +0000 (17:31 +0100)]
Merge pull request #12057 from poettering/chown-tty

chown TTY back to root:tty after a service terminates that used them

5 years agonspawn: voidify sd_notify() calls
Lennart Poettering [Thu, 21 Mar 2019 15:32:31 +0000 (16:32 +0100)]
nspawn: voidify sd_notify() calls

5 years agonspawn: port to static destructors
Lennart Poettering [Thu, 21 Mar 2019 12:49:42 +0000 (13:49 +0100)]
nspawn: port to static destructors

5 years agonspawn: port to main-func.h logic
Lennart Poettering [Thu, 21 Mar 2019 12:35:45 +0000 (13:35 +0100)]
nspawn: port to main-func.h logic

5 years agoman: mention that conditions in [Match] section support negation
Yu Watanabe [Fri, 8 Mar 2019 06:51:17 +0000 (15:51 +0900)]
man: mention that conditions in [Match] section support negation

5 years agoman: use literal tag
Yu Watanabe [Fri, 8 Mar 2019 06:37:10 +0000 (15:37 +0900)]
man: use literal tag

5 years agonetwork,udev: split static condition tests from net_match_config()
Yu Watanabe [Fri, 8 Mar 2019 06:20:01 +0000 (15:20 +0900)]
network,udev: split static condition tests from net_match_config()

5 years agonetwork: drop unnecessary strdup()
Yu Watanabe [Fri, 8 Mar 2019 05:42:42 +0000 (14:42 +0900)]
network: drop unnecessary strdup()

5 years agocore/unit: use condition_test_list()
Yu Watanabe [Fri, 8 Mar 2019 05:23:03 +0000 (14:23 +0900)]
core/unit: use condition_test_list()

5 years agocondition: introduce condition_test_list()
Yu Watanabe [Fri, 8 Mar 2019 05:22:31 +0000 (14:22 +0900)]
condition: introduce condition_test_list()

5 years agolog: expose log_object_internalv()
Yu Watanabe [Fri, 8 Mar 2019 05:21:15 +0000 (14:21 +0900)]
log: expose log_object_internalv()

5 years agoMerge pull request #12059 from poettering/nspawn-typos
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 14:14:11 +0000 (15:14 +0100)]
Merge pull request #12059 from poettering/nspawn-typos

some typo and other fixes result of the OCI nspawn merge

5 years agoman: make separate "Errors" sections subsection of "Return value"
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 13:53:00 +0000 (14:53 +0100)]
man: make separate "Errors" sections subsection of "Return value"

Logically, this is better, because we're describing a subset of possible
return values. Visually this also looks quite good because groff renders
refsect2 much less prominently.

Also rewrap things, add <constant> in various places, fix some typos.

5 years agoman: document error values for sd_id128_get_*()
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 13:08:34 +0000 (14:08 +0100)]
man: document error values for sd_id128_get_*()

5 years agoMerge pull request #12058 from keszybz/oci-simplifications
Lennart Poettering [Thu, 21 Mar 2019 12:55:09 +0000 (13:55 +0100)]
Merge pull request #12058 from keszybz/oci-simplifications

Follow-ups for nspawn-oci review

5 years agonspawn: add a few missing flags from --help text
Lennart Poettering [Thu, 21 Mar 2019 12:31:09 +0000 (13:31 +0100)]
nspawn: add a few missing flags from --help text

5 years agoman: adjust nspawn man page to follow same section/order as --help text
Lennart Poettering [Thu, 21 Mar 2019 12:27:48 +0000 (13:27 +0100)]
man: adjust nspawn man page to follow same section/order as --help text

No other changes, just some reshuffling and adding of section headers
(well, admittedly, I changed some "see above" and "see below" in the
text to match the new order.)

5 years agonspawn: reorder --help text, and add section
Lennart Poettering [Thu, 21 Mar 2019 12:27:19 +0000 (13:27 +0100)]
nspawn: reorder --help text, and add section

The list is so long, let's add a bit of structure and order things a
bit.

5 years agomount: when we fail to establish an inaccessible mount gracefully, undo the mount
Lennart Poettering [Thu, 21 Mar 2019 11:41:02 +0000 (12:41 +0100)]
mount: when we fail to establish an inaccessible mount gracefully, undo the mount

5 years agocapability: add a test that fails if we ever enter > 64bit capability territory
Lennart Poettering [Thu, 21 Mar 2019 11:38:18 +0000 (12:38 +0100)]
capability: add a test that fails if we ever enter > 64bit capability territory

5 years agocapability: also cap CAP_LAST_CAP at 63
Lennart Poettering [Thu, 21 Mar 2019 11:37:30 +0000 (12:37 +0100)]
capability: also cap CAP_LAST_CAP at 63

5 years agocapability: typo fix
Lennart Poettering [Thu, 21 Mar 2019 11:31:36 +0000 (12:31 +0100)]
capability: typo fix

5 years agocapability: use UINT64_C() where appropriate
Lennart Poettering [Thu, 21 Mar 2019 11:31:29 +0000 (12:31 +0100)]
capability: use UINT64_C() where appropriate

5 years agocapability: minimize scope of a few variables
Lennart Poettering [Thu, 21 Mar 2019 11:31:14 +0000 (12:31 +0100)]
capability: minimize scope of a few variables

5 years agocapability: minor coding style updates
Lennart Poettering [Thu, 21 Mar 2019 11:30:49 +0000 (12:30 +0100)]
capability: minor coding style updates

5 years agocapability: add missing ')'
Lennart Poettering [Thu, 21 Mar 2019 11:29:18 +0000 (12:29 +0100)]
capability: add missing ')'

As pointed out by @polarina

https://github.com/systemd/systemd/commit/d0b6a10c005ab1fff44d032be995e3f2bcfba225#commitcomment-32857641

5 years agosd-id128: look for invocation id in environment first, keyring second
Zbigniew Jędrzejewski-Szmek [Wed, 20 Mar 2019 09:01:32 +0000 (10:01 +0100)]
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.

5 years agoutil-lib: get rid of a helper variable
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 10:08:09 +0000 (11:08 +0100)]
util-lib: get rid of a helper variable

5 years agonspawn-oci: add helper function for free_and_strdup with oom check
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 09:54:24 +0000 (10:54 +0100)]
nspawn-oci: add helper function for free_and_strdup with oom check

5 years agoMerge pull request #9762 from poettering/nspawn-oci
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 10:01:53 +0000 (11:01 +0100)]
Merge pull request #9762 from poettering/nspawn-oci

OCI runtime support for nspawn

5 years agonspawn-oci: use SYNTHETIC_ERRNO
Zbigniew Jędrzejewski-Szmek [Thu, 21 Mar 2019 09:50:59 +0000 (10:50 +0100)]
nspawn-oci: use SYNTHETIC_ERRNO

5 years agoupdate TODO
Lennart Poettering [Wed, 20 Mar 2019 20:49:33 +0000 (21:49 +0100)]
update TODO

5 years agocore: rework how we reset the TTY after use by a service
Lennart Poettering [Wed, 20 Mar 2019 20:28:02 +0000 (21:28 +0100)]
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.

5 years agoexecute: split check if we might touch a tty out of exec_context_may_touch_console()
Lennart Poettering [Wed, 20 Mar 2019 20:20:00 +0000 (21:20 +0100)]
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.

5 years agoexecute: use path_equal() to compare tty names
Lennart Poettering [Wed, 20 Mar 2019 20:18:59 +0000 (21:18 +0100)]
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.

5 years agoMerge pull request #12049 from keszybz/assorted-fixups
Lennart Poettering [Wed, 20 Mar 2019 17:27:34 +0000 (18:27 +0100)]
Merge pull request #12049 from keszybz/assorted-fixups

Assorted fixups

5 years agoshared/install: Preserve escape characters for escaped unit names
David Michael [Wed, 20 Mar 2019 15:14:32 +0000 (15:14 +0000)]
shared/install: Preserve escape characters for escaped unit names

Since switching to extract_first_word with no flags for parsing
unit names in 4c9565eea534cd233a913c8c21f7920dba229743, 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.

5 years agosystemctl: start_unit() returns > 0 on error, let's catch that properly
Lennart Poettering [Fri, 15 Mar 2019 14:05:01 +0000 (15:05 +0100)]
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

5 years agosystemctl: use strv_consume() where we can
Lennart Poettering [Fri, 15 Mar 2019 09:42:46 +0000 (10:42 +0100)]
systemctl: use strv_consume() where we can

5 years agosystemctl: port to static destructors
Lennart Poettering [Fri, 15 Mar 2019 09:42:32 +0000 (10:42 +0100)]
systemctl: port to static destructors

5 years agotest-fileio: avoid warning about ineffective comparison
Zbigniew Jędrzejewski-Szmek [Wed, 20 Mar 2019 12:43:35 +0000 (13:43 +0100)]
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.

5 years agosd-bus: reduce scope of variable
Zbigniew Jędrzejewski-Szmek [Wed, 20 Mar 2019 12:34:35 +0000 (13:34 +0100)]
sd-bus: reduce scope of variable

5 years agosd-bus: avoid IN_SET() invocation with two identical values
Zbigniew Jędrzejewski-Szmek [Wed, 20 Mar 2019 12:28:29 +0000 (13:28 +0100)]
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

5 years agotest-alloc-util: add a smoke test for greedy_realloc
Zbigniew Jędrzejewski-Szmek [Wed, 20 Mar 2019 10:30:34 +0000 (11:30 +0100)]
test-alloc-util: add a smoke test for greedy_realloc

5 years agoTODO: add some bootctl items
Zbigniew Jędrzejewski-Szmek [Wed, 20 Mar 2019 10:28:35 +0000 (11:28 +0100)]
TODO: add some bootctl items

5 years agoMerge pull request #12033 from fbuihuu/watched-process-improvments
Zbigniew Jędrzejewski-Szmek [Wed, 20 Mar 2019 12:03:06 +0000 (13:03 +0100)]
Merge pull request #12033 from fbuihuu/watched-process-improvments

Watched process improvments

5 years agoMerge pull request #12047 from poettering/cryptsetup-fixlets
Zbigniew Jędrzejewski-Szmek [Wed, 20 Mar 2019 12:02:34 +0000 (13:02 +0100)]
Merge pull request #12047 from poettering/cryptsetup-fixlets

some small cryptsetup, ask-password and allocation fixlets

5 years agojournal-file: handle SIGBUS on offlining thread
Chris Morin [Wed, 20 Mar 2019 08:34:23 +0000 (01:34 -0700)]
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

5 years agoMerge pull request #12024 from poettering/bindtoifindex
Zbigniew Jędrzejewski-Szmek [Wed, 20 Mar 2019 10:16:51 +0000 (11:16 +0100)]
Merge pull request #12024 from poettering/bindtoifindex

use SO_BINDTOIFINDEX where appropriate

5 years agoscope: tiny cleanup: UNIT(s) -> u
Franck Bui [Wed, 20 Mar 2019 07:06:09 +0000 (08:06 +0100)]
scope: tiny cleanup: UNIT(s) -> u

No functional changes.

5 years agocore: only watch processes when it's really necessary
Franck Bui [Tue, 19 Mar 2019 09:59:26 +0000 (10:59 +0100)]
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.

5 years agocore: reduce the number of stalled PIDs from the watched processes list when possible
Franck Bui [Mon, 18 Mar 2019 19:59:36 +0000 (20:59 +0100)]
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.