Commit Graph

22298 Commits

Author SHA1 Message Date
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
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 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
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 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 2a56a88f46
Merge pull request #10316 from poettering/json-api
just the json stuff from #9762
2018-10-10 14:21:18 +02: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
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
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
Yu Watanabe 26d6b2147e network: drop break line in comment 2018-10-10 14:43:05 +09:00
Yu Watanabe e6bf77744a network: make netlink callback not return negative value
Fixes #10320.
2018-10-10 14:43:05 +09:00
Yu Watanabe e8d1666687 network: drop route_expire_callback() as it is duplicate of link_route_remove_handler() 2018-10-10 14:43:05 +09:00
Yu Watanabe fdb20b7c59 network: make manager_dhcp6_prefix_remove() static 2018-10-10 14:43:05 +09:00
Yu Watanabe 09dd32eea7 network: make netdev_enslave() static 2018-10-10 14:43:05 +09:00
Yu Watanabe 17e57d3cae networkd: drop unused element from AddressLabel struct 2018-10-10 14:43:05 +09:00
Yu Watanabe 9bcb210ebc network: add missing set_free() for Manager.dirty_links 2018-10-10 14:43:05 +09:00
Yu Watanabe 1046bf9b1a network: add destroy callbacks for asynchronous netlink calls 2018-10-10 14:43:05 +09:00
Yu Watanabe 0d0f02cd15 test: add tests for destroy callback of asynchronous netlink call 2018-10-10 14:43:05 +09:00
Yu Watanabe 545bab1f0a sd-netlink: add destroy_callback argument to sd_netlink_call_async() 2018-10-10 14:43:05 +09:00
Yu Watanabe 2fea60901d sd-netlink: use structured initializers 2018-10-10 14:43:05 +09:00
Yu Watanabe f6bdbd9e00 sd-netlink: fix error handling in sd_netlink_call_async() 2018-10-10 14:43:05 +09:00
Lennart Poettering 3316429f19
Merge pull request #10062 from rgushchin/device
Support cgroup v2 bpf-based device controller
2018-10-09 23:29:27 +02:00
Lennart Poettering 13711093ef bpf-firewall: always use log_unit_xyz() insteadof log_xyz()
That way it's easier to figure out what the various messages belong to
2018-10-09 21:11:41 +02:00
Lennart Poettering 4cf997befa device: clean up DeviceFound flags set
No need to avoid bit 0. Also the U suffix has no effect, don't use it.
2018-10-09 21:11:22 +02:00