1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 20:25:38 +03:00
Commit Graph

38840 Commits

Author SHA1 Message Date
Lennart Poettering
38ba8c8874
Merge pull request #11888 from keszybz/non-atomic
Drop unused atomic operations
2019-03-04 19:03:46 +01:00
Zbigniew Jędrzejewski-Szmek
f27abfccd0 fuzz-dns-packet: add test case with lots of labels
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13422
2019-03-04 15:53:37 +01:00
Zbigniew Jędrzejewski-Szmek
dffb827772 resolved: when adding RR to an answer, avoid comparing keys twice
We'd call dns_resource_record_equal(), which calls dns_resource_key_equal()
internally, and then dns_resource_key_equal() a second time. Let's be
a bit smarter, and call dns_resource_key_equal() only once.

(before)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=275
dns_resource_key_equal_count=62371
4.13s user 0.01s system 99% cpu 4.153 total

(after)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=276
dns_resource_key_equal_count=31337
2.13s user 0.01s system 99% cpu 2.139 total
2019-03-04 15:53:37 +01:00
Zbigniew Jędrzejewski-Szmek
51969a5893 resolve: split the RR comparison function in two
No functional change.
2019-03-04 15:53:37 +01:00
Zbigniew Jędrzejewski-Szmek
2d34cf0c16 resolved: use a temporary Set to speed up dns question parsing
This doesn't necessarily make things faster, because we still spend more time
in dns_answer_add(), but it improves the compuational complexity of this part.
If we even make dns_resource_key_equal_faster, this will become worthwhile.
2019-03-04 15:53:37 +01:00
Yu Watanabe
305a285092 systemctl: format LogExtraFields= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe
4c787df72f systemctl: format BindPaths= or TemporaryFileSystems= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe
04749e4003 systemctl: print RestrictAddressFamilies= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe
48d3358db1 systemctl: show nothing if no LoadError= 2019-03-04 23:45:07 +09:00
Yu Watanabe
56c6b69007 systemctl: format IPIngressBytes= or friends nicely 2019-03-04 23:45:07 +09:00
Yu Watanabe
9c1f946566 systemctl: show IPAddressAllow= and IPAddressDeny= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe
9201eea137 test: add tests for test_in_addr_prefix_to_string() 2019-03-04 23:45:07 +09:00
Yu Watanabe
146cf7f05b test: move tests for in_addr_prefix_from_string() 2019-03-04 23:45:07 +09:00
Yu Watanabe
d9143dac3e util: introduce in_addr_prefix_to_string() 2019-03-04 23:45:07 +09:00
Yu Watanabe
81260be12e util: use _cleanup_ attributes 2019-03-04 23:45:07 +09:00
Yu Watanabe
a672f4fe8d core: fix received size of signal or status size
sd_bus_message_read_array() returns size of array in bytes, not number
of elements.

This also convert int to int32_t, as the dbus type 'i' is int32_t.
2019-03-04 23:44:29 +09:00
Zbigniew Jędrzejewski-Szmek
756479043d sd-hwdb: fix off_t vs. size_t confusion in cast
> on 32bit, size_t is 32bit, but .st_size is off_t hence 64bit
2019-03-04 15:42:58 +01:00
Yu Watanabe
4a22071201 systemctl: show SuccessExitStatus= and friends 2019-03-04 23:35:56 +09:00
Yu Watanabe
8e066ef316 systemctl: use streq() if arguments must be non-NULL 2019-03-04 23:35:56 +09:00
Yu Watanabe
a3ddd4571d systemctl: do not show negative values in {Success,Failure}ActionExitStatus= 2019-03-04 23:35:56 +09:00
Yu Watanabe
102b021460 bus-util: drop unnecessary re-formatting 2019-03-04 23:35:46 +09:00
INSUN PYO
c7bb2fec78 systemctl: show SELinuxContext=, AppArmorProfile= and SmackProcessLabel=
Run: systemctl show -a dbus.service | grep -E "SELinuxContext|AppArmorProfile|SmackProcessLabel"

Before patch:
  SELinuxContext=[unprintable]
  AppArmorProfile=[unprintable]
  SmackProcessLabel=[unprintable]

After patch:
  SELinuxContext=[""|"value of context"]
  AppArmorProfile=[""|"value of context"]
  SmackProcessLabel=[""|"value of context"]
2019-03-04 15:27:30 +01:00
Martin Pitt
0d427d377a semaphoreci: caching and more robust creation of container image
lxc-create in semaphore sometimes fails with

    ERROR: Unable to fetch GPG key from keyserver

Which often happens behind proxies. As the default key server is a load
balancer, retry a few times.

Also, cache the container image between runs, and only recreate it when
it is older than a week.
2019-03-04 15:05:14 +01:00
Davide Cavalca
4d97f5a09e test: do not assume test-chown-rec is running as root 2019-03-04 14:40:17 +01:00
Zbigniew Jędrzejewski-Szmek
311b63fef8 Remove now-unused refcnt.h 2019-03-04 14:16:39 +01:00
Zbigniew Jędrzejewski-Szmek
f23ab4dc3c sd-netlink: do not use atomic reference counters
Same as with the other users, any non-trivial use of the objects requires
use from a single thread only or external locking. Using atomic operations
just for reference counts is not useful.
2019-03-04 14:16:39 +01:00
Zbigniew Jędrzejewski-Szmek
af40711050 sd-hwdb: some minor logging and style updates 2019-03-04 14:16:39 +01:00
Zbigniew Jędrzejewski-Szmek
468905cac8 sd-hwdb: use non-atomic reference counters
The sd-hwdb objects cannot be used concurrently from two threads in any
meaningful way, because query and iteration operations modify the object.
Thus atomic reference counts are pointless.
2019-03-04 14:16:39 +01:00
Zbigniew Jędrzejewski-Szmek
42541a71a2 bus: make reference counting non-atomic
We had atomic counters, but all other operations were non-serialized. This
means that concurrent access to the bus object was only safe if _all_ threads
were doing read-only access. Even sending of messages from threads would not be
possible, because after sending of the message we usually want to remove it
from the send queue in the bus object, which would race. Let's just kill this.
2019-03-04 14:16:24 +01:00
Zbigniew Jędrzejewski-Szmek
f68a26221c tests: use the test helpers in more places
This is mostly cosmetic. It makes those test binaries support SYSTEMD_LOG_*
environment variables.
2019-03-04 14:15:38 +01:00
Lennart Poettering
46d4d67d79
Merge pull request #11820 from dm0-/chase
Allow tmpfiles to create files in a root under an unprivileged directory
2019-03-04 13:04:45 +01:00
Lennart Poettering
d8a23f5e4f
Merge pull request #11770 from yuwata/fix-9955
network: rework address pool
2019-03-04 12:11:07 +01:00
Mike Lothian
17f377efd0 login: HyperV requires master-of-seat to be set
v2: Update comment provided by Lennart

Fixes: https://github.com/systemd/systemd/issues/11299
2019-03-04 12:04:53 +01:00
Yu Watanabe
55ac7b6314 fuzz-dhcp6-client: avoid assertion failure on samples which dont fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11584.
2019-03-04 12:04:09 +01:00
Lennart Poettering
965bfcd6b2
Merge pull request #11882 from yuwata/fix-log-syntax
Fix log_syntax()
2019-03-04 11:03:36 +01:00
Yu Watanabe
59c1546b45 test: add tests for log_syntax() 2019-03-04 15:28:32 +09:00
Yu Watanabe
ee96382fdb log: make log_syntax() assign correct errno and show valid error cause 2019-03-04 15:18:06 +09:00
Ben Iofel
892cd2f7ac xbootldr: multiple spaces between keys and values (#11872)
The example below the changed line has multiple spaces between e.g. `title` and `Fedora`
2019-03-03 22:51:22 +01:00
Yu, Li-Yu
abfa5697fa man: flush-caches and reset-server-features are commands for resolvectl (#11877) 2019-03-03 22:50:22 +01:00
Zbigniew Jędrzejewski-Szmek
bdc8f36bfb
Merge pull request #11472 from poettering/sd-bus-ref-tweak
try harder to detect when a bus and its queued messages are fully unreffed and free everything then
2019-03-01 17:52:57 +01:00
Zbigniew Jędrzejewski-Szmek
672d1f57f7
Merge pull request #11863 from poettering/subvol-no-submount
nspawn: don't descend into subvols on --ephemeral
2019-03-01 16:44:40 +01:00
Lennart Poettering
3f2fa83499 man: document that --ephemeral and --template= don't cover submounts
We never made this clear, let's fix that.
2019-03-01 16:25:03 +01:00
Lennart Poettering
d3f3df6199 btrfs: when falling back to plain copy when snapshoting exclude submounts
The subvol snapshot logic doesn't cover sub-mounts either, and it really
shouldn't in the general case, hence let's simply stop at submounts in
all cases, both in the main and in the fall-back codepath.

As discussed here:

https://github.com/systemd/systemd/pull/11243#pullrequestreview-209477230
2019-03-01 16:22:36 +01:00
Zbigniew Jędrzejewski-Szmek
cc5fc36aec
Merge pull request #11243 from poettering/nspawn-root-overlay
add systemd-nspawn --volatile=overlay support, as well as the same for host systems
2019-03-01 16:08:55 +01:00
Lennart Poettering
4b70aedc4a test: add test for new sd-bus refcnt logic 2019-03-01 15:37:39 +01:00
Lennart Poettering
c1757a70ea sd-bus: use "queue" message references for managing r/w message queues in connection objects
Let's make use of the new concept the previous commit added.

See: #4846
2019-03-01 15:37:39 +01:00
Lennart Poettering
1b3f9dd759 bus-message: introduce two kinds of references to bus messages
Before this commit bus messages had a single reference count: when it
reached zero the message would be freed. This simple approach meant a
cyclic dependency was typically seen: a message that was enqueued in a
bus connection object would reference the bus connection object but also
itself be referenced by the bus connection object. So far out strategy
to avoid cases like this was: make sure to process the bus connection
regularly so that messages don#t stay queued, and at exit flush/close
the connection so that the message queued would be emptied, and thus the
cyclic dependencies resolved. Im many cases this isn't done properly
however.

With this change, let's address the issue more systematically: let's
break the reference cycle. Specifically, there are now two types of
references to a bus message:

1. A regular one, which keeps both the message and the bus object it is
   associated with pinned.

2. A "queue" reference, which is weaker: it pins the message, but not
   the bus object it is associated with.

The idea is then that regular user handling uses regular references, but
when a message is enqueued on its connection, then this takes a "queue"
reference instead. This then means that a queued message doesn't imply
the connection itself remains pinned, only regular references to the
connection or a message associated with it do. Thus, if we end up in the
situation where a user allocates a bus and a message and enqueues the
latter in the former and drops all refs to both, then this will detect
this case and free both.

Note that this scheme isn't perfect, it only covers references between
messages and the busses they are associated with. If OTOH a bus message
is enqueued on a different bus than it is associated with cyclic deps
cannot be recognized with this simple algorithm, and thus if you enqueue
a message associated with a bus A on a bus B, and another message
associated with bus B on a bus A, a cyclic ref will be in effect and not
be discovered. However, given that this is an exotic case (though one
that happens, consider systemd-bus-stdio-bridge), it should be OK not to
cover with this, and people have to explicit flush all queues on exit in
that case.

Note that this commit only establishes the separate reference counters
per message. A follow-up commit will start making use of this from the
bus connection object.
2019-03-01 15:37:39 +01:00
Lennart Poettering
b41812d1e3 sd-bus: always go through sd_bus_unref() to free messages
Don't try to be smart, don't bypass the ref counting logic if there's no
real reason to.

This matters if we want to tweak the ref counting logic later.
2019-03-01 15:19:45 +01:00
Lennart Poettering
39feb2ce41 sd-bus: drop two inappropriate empty lines 2019-03-01 15:19:45 +01:00
Lennart Poettering
c0bc4ec5cc sd-bus: make sure dispatch_rqueue() initializes return parameter on all types of success
Let's make sure our own code follows coding style and initializes all
return values on all types of success (and leaves it uninitialized in
all types of failure).
2019-03-01 15:19:45 +01:00