Commit Graph

36316 Commits

Author SHA1 Message Date
Lennart Poettering 7685329311 TODO 2018-11-09 17:15:34 +01:00
Lennart Poettering bedea99dce core: expose bus client names currently reffing a unit as property
This is useful for debugging client-side ref counting of units: for each
ref taken on a unit the client's sender name is listed. If a client has
multiple refs on the same unit it is listed multiple times.
2018-11-09 17:15:34 +01:00
Lennart Poettering b92d0b4c5a machined: rework referencing of machine scopes from machined, too
When a machine scope is registered by machined, let's add a reference to
it, and change the GC mode so that the unit is cleaned up as soon as
machined drops the reference, regardless of the fail state.

Fixes: #2809
2018-11-09 17:15:34 +01:00
Lennart Poettering 1d78fea2d6 nspawn: rework how we allocate/kill scopes
Fixes: #6347
2018-11-09 17:08:59 +01:00
Lennart Poettering df61bc5e4a nspawn: merge two variable declaration lines 2018-11-09 17:08:59 +01:00
Lennart Poettering 11d81e506e nspawn: simplify machine terminate bus call
We have the machine name anyway, let's use TerminateMachine() on
machined's Manager object directly with it. That way it's a single
method call only, instead of two, to terminate the machine.
2018-11-09 17:08:59 +01:00
Lennart Poettering e5a2d8b5b5 nspawn: make use of the new sd_bus_set_close_on_exit() call in nspawn 2018-11-09 17:08:59 +01:00
Lennart Poettering c4e48030cf sd-bus: make "close+flush-on-exit" optional when using sd-event with sd-bus
This adds a new pair of API calls sd_bus_set_close_on_exit() and
sd_bus_get_close_on_exit(). They control whether an sd_bus object
attached to a an sd-event loop shall automatically be flushed/closed
when the event loop goes down. Usually that's a good thing, except for
very few cases where the bus connection is longer living than the event
loop it is attached on. Specifically, this is the case for nspawn, where
we run the event loop only while the container is up, but afterwards
still want to be able to use the bus connection.
2018-11-09 17:08:59 +01:00
Lennart Poettering e5c36295d8 unit: enqueue cgroup empty check event if the last ref on a unit is dropped 2018-11-09 17:08:59 +01:00
Lennart Poettering c20076a8c1 pid1: add a new AbandonScope() method call on the Manager object
This is the same as Abandon() on the Scope object, but saves clients
from first translating a unit name into a unit object path. This logic
matches how all the other unit methods have counterparts on the Manager
object too (e.g. StopUnit() on the Manager object matching Stop() on the
Unit object), this one was simply forgotten so far.
2018-11-09 17:08:59 +01:00
Frantisek Sumsal 7a30256588 tests: keep SYS_PTRACE when running under ASan 2018-11-09 16:26:19 +01:00
Lennart Poettering 3306711ffb
Merge pull request #10695 from yuwata/fuzz-network-fixes
network: fix recent issues found by oss-fuzz
2018-11-09 14:49:37 +01:00
Yu Watanabe 872faf59c0 fuzz: add testcases of recent issues 2018-11-09 11:45:43 +09:00
Yu Watanabe e512c6c1aa network: fix potential segfault in network_free() 2018-11-09 11:45:12 +09:00
Yu Watanabe d493d82647 network: fix offset for IPv6MTUByte=
Fixes oss-fuzz#11302 and oss-fuzz#11314.
2018-11-09 11:44:51 +09:00
Evgeny Vereshchagin 911efe0fbf
Merge pull request #10678 from evverx/more-travis-tweaks
travis: also rebuild everything with ASan and UBSan and install dependencies necessary for running parse-hwdb.py
2018-11-09 01:43:57 +03:00
Lennart Poettering c2baf11c36 cgroup: actually reset the cgroup invalidation mask after we made our changes
Previously we never unmasked the mask after it was set once. Let's fix
that.
2018-11-08 15:20:52 +01:00
Lennart Poettering 6529ccfa20 unit: replace three non-type-safe macros by type-safe inline functions
Behaviour is prett ymuch the same, but there's some additional type
checking done on the input parameters.

(In the case of UNIT_WRITE_FLAGS_NOOP() the C compiler won't actually do
the type checking necessarily, but static chckers at least could)
2018-11-08 13:55:25 +01:00
Evgeny Vereshchagin cdd116b4e1 travis: use 3 times the normal timeout when the tests are run under ASan+UBSan 2018-11-08 13:49:46 +01:00
Evgeny Vereshchagin 993476841a travis.yml: replace test-capability with a script exiting with 77
The test is currently failing when run under ASan in a docker container:
```
--- command ---
SYSTEMD_KBD_MODEL_MAP='/build/src/locale/kbd-model-map' PATH='/build/build:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' SYSTEMD_LANGUAGE_FALLBACK_MAP='/build/src/locale/language-fallback-map' /build/build/test-capability
--- stderr ---
have ambient caps: yes
Capabilities:= cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,cap_audit_read+eip
Capabilities:= cap_dac_override,cap_net_raw+ep
==7021==LeakSanitizer has encountered a fatal error.
==7021==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
==7021==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
Assertion 'WIFEXITED(status) && WEXITSTATUS(status) == 0' failed at ../src/test/test-capability.c:71, function fork_test(). Aborting.
-------
```

https://api.travis-ci.org/v3/job/452349948/log.txt
2018-11-08 13:49:46 +01:00
Frantisek Sumsal 6c8a51ed78 travis: run ASan job in parallel with the standard one 2018-11-08 13:49:46 +01:00
Evgeny Vereshchagin 6dfe7f43d0 travis: UBSan should be every C programmer's friend so let's build systemd with it too 2018-11-08 13:49:45 +01:00
Evgeny Vereshchagin 86f4edef54 test: initialize hwdb so that the test won't try to free memory it has never allocated
See https://github.com/systemd/systemd/pull/10678#issuecomment-436790906.
2018-11-08 13:49:45 +01:00
Evgeny Vereshchagin 79f6178ee1 travis: move the ASan part into a separate stage 2018-11-08 13:49:45 +01:00
Evgeny Vereshchagin 1667d63acc travis: also rebuild everything with ASan
It should help to catch issues like https://github.com/systemd/systemd/issues/10677.
2018-11-08 13:49:45 +01:00
Evgeny Vereshchagin e4f8f99c6f travis: install dependencies necessary for running parse-hwdb.py 2018-11-08 13:49:45 +01:00
Zbigniew Jędrzejewski-Szmek abdcb688a8
Merge pull request #10676 from poettering/rdrand-everywhere
prefer RDRAND over getrandom() and /dev/urandom when we don't need the very best randomness
2018-11-08 13:33:02 +01:00
Lennart Poettering 010c9a247d
Merge pull request #10651 from yuwata/fix-10598
conf-parser: ignore trailing back-slash in comment
2018-11-08 12:36:06 +01:00
Lennart Poettering 2cf6db4fb5
Merge pull request #10687 from mrc0mmand/fix-test-capabilities
Fix test-capability
2018-11-08 12:35:39 +01:00
Frantisek Sumsal 731555601c travis: drop the workaround for test-capability 2018-11-08 11:07:27 +01:00
Frantisek Sumsal c446b8486d tests: drop the precondition check for inherited flag
Docker's default capability set has the inherited flag already
set - that breaks tests which expect otherwise. Let's just
drop the check and run the test anyway.

Fixes #10663
2018-11-08 11:07:21 +01:00
Yu Watanabe 64af816228 core/device: use LIST_FOREACH_AFTER() or friend 2018-11-08 10:58:25 +01:00
Lennart Poettering bbf1120623 unit: make UNIT() cast function deal with NULL pointers
Fixes: #10681
2018-11-08 10:47:08 +01:00
Zbigniew Jędrzejewski-Szmek 2ca4d779e0 man: document the details of continuations and comments 2018-11-08 18:09:04 +09:00
Yu Watanabe 9adbfeb38a conf-parser: ignore trailing back-slash in comment
Fixes #10598.
2018-11-08 18:09:04 +09:00
Lennart Poettering cc83d5197c random-util: optionally allow randomness to be generated via RDRAND
We only use this when we don't require the best randomness. The primary
usecase for this is UUID generation, as this means we don't drain
randomness from the kernel pool for them. Since UUIDs are usually not
secrets RDRAND should be goot enough for them to avoid real-life
collisions.
2018-11-08 09:44:27 +01:00
Lennart Poettering 6fb6f13896 random-util: introduce RANDOM_DONT_DRAIN
Originally, the high_quality_required boolean argument controlled two
things: whether to extend any random data we successfully read with
pseudo-random data, and whether to return -ENODATA if we couldn't read
any data at all.

The boolean got replaced by RANDOM_EXTEND_WITH_PSEUDO, but this name
doesn't really cover the second part nicely. Moreover hiding both
changes of behaviour under a single flag is confusing. Hence, let's
split this part off under a new flag, and use it from random_bytes().
2018-11-08 09:44:27 +01:00
Lennart Poettering 776cf7461f random-util: if zero random bytes are requested we can always fulfill the request 2018-11-08 09:44:27 +01:00
Lennart Poettering 68534345b8 random-util: optionally enable blocking getrandom() behaviour
When generating the salt for the firstboot password logic, let's use
getrandom() blocking mode, and insist in the very best entropy.
2018-11-08 09:44:27 +01:00
Lennart Poettering 94d457e8d9 random-util: change high_quality_required bool parameter into a flags parameter
No change in behaviour, just some refactoring.
2018-11-08 09:44:27 +01:00
Lennart Poettering afff8f16ae random-util: fix indentation 2018-11-08 09:44:27 +01:00
Lennart Poettering d68ccc0841 random-util: handle if getrandom() returns 0
This should normally not happen, but given that the man page suggests
something about this in the context of interruption, let's handle this
and propagate an I/O error.
2018-11-08 09:44:27 +01:00
Lennart Poettering 3335dc2d75 random-util: rename acquire_random_bytes() → genuine_random_bytes()
It's more descriptive, since we also have a function random_bytes()
which sounds very similar.

Also rename pseudorandom_bytes() to pseudo_random_bytes(). This way the
two functions are nicely systematic, one returning genuine random bytes
and the other pseudo random ones.
2018-11-08 09:44:27 +01:00
Lennart Poettering 8d2411f693
Merge pull request #10682 from yuwata/fix-oss-fuzz-network-issues
network: fix memleak
2018-11-08 09:37:35 +01:00
Yu Watanabe b9c04eafb8 core: introduce exec_params_clear()
Follow-up for 1ad6e8b302.

Fixes #10677.
2018-11-08 09:36:37 +01:00
Matthew Leeds 0ccc48b5b8 man: Fix implicit dep info for timer units (#10679)
This reorganizes the systemd.timer man page so that it doesn't claim
there are no implicit dependencies right after specifying the implicit
dependencies, and so that it matches the other man pages for units. This
fixes a mistake introduced by commit aed5cb03db.
2018-11-08 12:41:06 +09:00
Yu Watanabe d571998498 fuzz: add a testcase for oss-fuzz#11285 2018-11-08 12:31:02 +09:00
Yu Watanabe 28c3428df0 network: adds missing strv_free()
Fixes oss-fuzz#11285.
2018-11-08 12:30:03 +09:00
Yu Watanabe 7a99f98b50 network: make config_parse_radv_search_domains() log error in dns_name_apply_idna() 2018-11-08 12:29:38 +09:00
Yu Watanabe 9f7d3db3ed fuzz: add more testcases of already fixed issue about multiple netdev kind
This adds testcases of oss-fuzz#11286, oss-fuzz#11287, oss-fuzz#11296,
oss-fuzz#11297, and oss-fuzz#11299.

The issue was fixed by 62facba19a.
2018-11-08 12:16:13 +09:00