Commit Graph

35488 Commits

Author SHA1 Message Date
Lennart Poettering 0f78c4dbe4 update TODO 2018-10-12 12:26:29 +02:00
Lennart Poettering 76137725f0
Merge pull request #10369 from yuwata/test-mempool
meson,test: mempool related fixes and add tests for 'thread safety'
2018-10-12 12:21:44 +02:00
Lennart Poettering 2aab8a1e04
Merge pull request #10201 from yuwata/fix-10196
sd-netlink: add destroy_callback to sd_netlink_call_async() and fix memleaks in networkd
2018-10-12 11:36:08 +02:00
Yu Watanabe eb43e8a76d test: sort included headers 2018-10-12 17:54:23 +09:00
Yu Watanabe be44b572f3 meson: fix '-Dstatic-libsystemd=true' or '-Dstatic-libudev=true'
Follow-up for a5d8835c78.
2018-10-12 17:54:23 +09:00
Yu Watanabe cb3e926a5d test: add test for 'thread safety' of libudev
This adds a test for 715a970548d03fed18dc66c411c8b42ff21029cf.
2018-10-12 17:54:23 +09:00
Yu Watanabe 5eddbba3a1 meson: do not use mempool from libudev.so
Follow-up for a5d8835c78.
2018-10-12 17:54:23 +09:00
Yu Watanabe a6ee01caf3 test: add test for 'thread safety' of sd-device
This adds a test for a5d8835c78.
2018-10-12 17:54:23 +09:00
Yu Watanabe 657ccaac1b sd-device: drop unnecessary header 2018-10-12 17:54:23 +09:00
Yu Watanabe 3ffd12bfbe test: add tests for $SYSTEMD_MEMPOOL=
This adds tests for b4f607433c and
205c085bc3 (#9792).
2018-10-12 17:54:23 +09:00
hellcp e7f7f19abc Add LOGO to os-release 2018-10-12 10:15:30 +02:00
Davide Cavalca ccac62563e tests: fix fallthrough condition for supplementary groups 2018-10-11 22:24:03 +02:00
Yu Watanabe 958b8c7bd7 core: fix member access within null pointer
config_parse_tasks_max() is also used for parsing system.conf or
user.conf. In that case, userdata is NULL.

Fixes #10362.
2018-10-11 22:23:39 +02:00
Lennart Poettering 8e04444385 journalctl: port JSON output mode to new JSON API
Also, while we are at it, beef it up, by adding json-seq support (i.e.
https://tools.ietf.org/html/rfc7464). This is particularly useful in
conjunction with jq's --seq switch.
2018-10-11 17:25:27 +02:00
Lennart Poettering 02619c033f
Merge pull request #10353 from keszybz/more-manager-reloading
More manager reloading cleanups
2018-10-11 17:25:03 +02:00
Zbigniew Jędrzejewski-Szmek 0e3cc902fa Revert "meson: use c_args in generator scripts (#10289)"
This reverts commit 56f56d5ad8.

This broke the compilation for coverity under travis. Our build script does
something like this:

$ CFLAGS='-D_Float128=long\ double -D_Float64=double -D_Float64x=long\ double -D_Float32=float -D_Float32x=double' meson cov-build -Dman=false
$ ninja -C build
...
[pid 27096] execve("/usr/bin/cc", ["/usr/bin/cc", "-D_Float128=long", "double", "-D_Float64=double", "-D_Float64x=long", "double", "-D_Float32=float", "-D_Float32x=double", "-E", "-dM", "-include", "linux/capability.h", "-include", "config.h", "-include", "../src/basic/missing.h", "-"], 0x55ab75ea4e80 /* 91 vars */) = 0
cc: error: double: No such file or directory
cc: error: double: No such file or directory
[pid 27096] +++ exited with 1 +++

I'm sure this could be fixed somehow, but since the original motivation for
56f56d5ad8 wasn't very strong, let's just revert
it as this seems to be the simplest solution.
2018-10-11 17:22:40 +02:00
Zbigniew Jędrzejewski-Szmek 05067c3c1f manager: simplify error handling in manager_deserialize()
If a memory error occurred, we would still go through the path which sets the
error on ferror(). It is unlikely that ferror() returns true, but it's seems
cleaner to just propagate the error we already have.

The handling of fgets() returning NULL is also simplified: according to the man
page, it returns NULL only on EOF or error. So if feof() returns true, I don't
think we should call ferror() again.

While at it, let's set errno to 0 and check that it is set before returning it
as an error. The man pages for fgets() and feof() do not say anything about
setting errno.
2018-10-11 14:34:02 +02:00
Zbigniew Jędrzejewski-Szmek 4df7d537c8 manager: also use the reloading "cleanup" function in manager_startup
Here the behaviour is nominally changed, because we will decrease the
counter on error. But the only caller quits the program if error occurs,
so this makes no practical difference.
2018-10-11 14:34:00 +02:00
Zbigniew Jędrzejewski-Szmek d147e2b66b manager: use the _cleanup_ mechanism to do n_reloading counter handling
No functional change.
2018-10-11 14:33:22 +02:00
Zbigniew Jędrzejewski-Szmek 3d7cf72070 manager: replace fake block with a strjoina
The block was created to avoid declaring variables in the middle of the block.
We could now do that, but it's easier to just use strjoina here.
2018-10-11 14:29:34 +02:00
Lennart Poettering 9cebb234b1 busctl: add a --json= output mode
A new switch "-j" or "--json=" is added which transforms dbus
marshalling into json. This is extremely useful in combination with
tools such as "jq" to process bus calls further.
2018-10-11 14:07:38 +02:00
Lennart Poettering 960d4b29d7
Merge pull request #10334 from keszybz/nomempool
Use mempool only in progs linked to libsystemd-shared.so
2018-10-11 13:44:34 +02:00
Lennart Poettering 2dde358e58
Merge pull request #10358 from yuwata/fix-10333
resolve: fix member access within null pointer
2018-10-11 13:32:15 +02:00
Yu Watanabe 25270cf3db resolve: fix member access within null pointer
Fixes #10333.
2018-10-11 18:36:21 +09:00
Yu Watanabe f55f2dce05 resolve: use structured initializers 2018-10-11 18:35:04 +09:00
Zbigniew Jędrzejewski-Szmek abc8caf76c meson: use vars we already have defined in status 2018-10-11 11:10:53 +02:00
Zbigniew Jędrzejewski-Szmek a5d8835c78 mempool: only enable mempool use when linked to libsystemd-shared.so
Mempool use is enabled or disabled based on the mempool_use_allowed symbol that
is linked in.

Should fix assert crashes in external programs caused by #9792.
Replaces #10286.

v2:
- use two different source files instead of a gcc constructor
2018-10-11 11:10:37 +02:00
Zbigniew Jędrzejewski-Szmek 7c48ea0280 Move use_pool() to mempool.c and rename to mempool_enabled()
The only user is in hashmap.c, but it's a mempool thing.
2018-10-11 10:55:41 +02:00
Zbigniew Jędrzejewski-Szmek 6939fb9eb4 meson: update bug reference
https://github.com/mesonbuild/meson/issues/1644 was resolved in 0.42:
be4428005d,
but still no-go.
2018-10-11 10:55:41 +02:00
Zbigniew Jędrzejewski-Szmek c42c981924 meson: remove old comment
The linked page is gone, and I can't quite remember what the
warning was about. Something about recursive copying... Everything
seems to work.
2018-10-11 10:55:41 +02:00
Zbigniew Jędrzejewski-Szmek 5dbf13fa6c meson: drop workaround
It was added way back, and seems to work fine now without it.
2018-10-11 10:55:41 +02:00
Evgeny Vereshchagin 2614d83aa0 tests: pass halt_on_error=1 to UBSan
By default, UBSan neither crashes nor exits with a non-zero exit code
when undefined behavior has been detected. This is problematic because
it makes it much harder to catch issues like https://github.com/systemd/systemd/issues/10346,
 https://github.com/systemd/systemd/issues/10347, and https://github.com/systemd/systemd/issues/10333.
In fact, those issue were found just because I decided to grep
the test log, which isn't something that I normally do :-)

As it turns out, the only way to make UBSan signal that something is wrong that works more or less
reliably everywhere is to pass halt_on_error=1 (though, it's probably worth noting that it's currently
not set for PID1 in order not to trigger kernel panics).

See https://reviews.llvm.org/D35085#804183 and https://chromium.googlesource.com/chromium/src/testing/libfuzzer/+/HEAD/reference.md
2018-10-11 08:55:04 +02:00
dana 3118a4cf17 man: clarify behaviour of RandomizedDelaySec= 2018-10-10 16:15:05 +02:00
Zbigniew Jędrzejewski-Szmek 2a56a88f46
Merge pull request #10316 from poettering/json-api
just the json stuff from #9762
2018-10-10 14:21:18 +02:00
Yu Watanabe 12a509e512
Merge pull request #10351 from keszybz/meson-cpp-fixups
Meson c++-related fixups
2018-10-10 19:50:35 +09:00
Zbigniew Jędrzejewski-Szmek f436470ae1
Merge pull request #10343 from poettering/manager-state-fix
various fixes for PID1's Manager object
2018-10-10 12:36:16 +02:00
Zbigniew Jędrzejewski-Szmek 98359a012a
Merge pull request #10349 from poettering/bus-creds-shift-overflow
sd-bus creds bitshift overflow fix
2018-10-10 12:04:33 +02:00
Lennart Poettering 65f95765d0 tree-wide: various ubsan zero size memory fixes
Fixes: #10346
2018-10-10 12:00:56 +02:00
Zbigniew Jędrzejewski-Szmek c09edc79ab meson: c++ is required for the fuzzer builds
The configuration would fail with an error about cpp being an unknown language
anyway, but it's nicer to fail early and explicitly.

https://github.com/systemd/systemd/pull/10339#issuecomment-428279175
2018-10-10 11:56:45 +02:00
Zbigniew Jędrzejewski-Szmek 9b0ca01903 meson: rename cpp_cmd to cxx_cmd
cpp is a really bad alias for c++ because it's also the name of the
preprocessor. Let's rename the variable.
2018-10-10 11:50:57 +02:00
Lennart Poettering 92a40e20bf sd-bus: call cap_last_cap() only once in has_cap()
Also, use the same type everywhere for dealing with it.
2018-10-10 11:13:00 +02:00
Lennart Poettering 3cae6c21e7 sd-bus: use size_t when dealing with memory offsets 2018-10-10 11:12:22 +02:00
Lennart Poettering 5f00c5684f capability: introduce CAP_TO_MASK_CORRECTED() macro replacing CAP_TO_MASK()
linux/capability.h's CAP_TO_MASK potentially shifts a signed int "1"
(i.e. 32bit wide) left by 31 which means it becomes negative. That's
just weird, and ubsan complains about it. Let's introduce our own macro
CAP_TO_MASK_CORRECTED which doesn't fall into this trap, and make use of
it.

Fixes: #10347
2018-10-10 11:11:48 +02:00
Evgeny Vereshchagin 6315d12bba tests: add a fuzzer for the json parser and dumper 2018-10-10 10:13:30 +02:00
Lennart Poettering 788c34be32 json: add test 2018-10-10 10:13:30 +02:00
Lennart Poettering cd0b6c5390 json: add a nice JSON parser
As preparation for OCI support in nspawn, let's add a JSON parser.

The json.h file contains an explanation why this is new code instead of
just us linking against an existing JSON library.
2018-10-10 10:13:30 +02:00
Asbjørn Apeland ca92fe36e0 man: fix typo 2018-10-10 09:57:57 +02:00
Yu Watanabe 0ae286e697 network: make netlink callbacks return 1
This is not necessary. But most of netlink callbacks in networkd
return 1.
2018-10-10 14:43:05 +09:00
Yu Watanabe c8ee637e7f network: use '_handler' suffix for netlink callbacks 2018-10-10 14:43:05 +09:00
Yu Watanabe c6de4729b1 network: rename ndisc_netlink_handler() to ndisc_route_handler() 2018-10-10 14:43:05 +09:00