1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 00:51:24 +03:00
Commit Graph

49457 Commits

Author SHA1 Message Date
Lennart Poettering
77552b9520 analyze: slightly reword PrivatTmp= message
Apparently there way confusion about "does not apply". Let's say "is not
appropriate".

Fixes: #13095
2021-02-10 12:14:29 +01:00
Lennart Poettering
43475909ce resolved: drop timestamp parameter to dns_cache_put() we don't ever pass 2021-02-09 18:02:14 +01:00
Lennart Poettering
30ee707170 resolved: avoid NOTIMP error when looking up not supported requests
Some folks argue that NOTIMP should only be returned if a specific QTYPE
is not supported. While I don#t think the RFCs are too clear about that,
let's use REFUSED instead, which appears to be a less controversial
choice of error code.

Prompted-by: #17218
2021-02-09 17:58:30 +01:00
Lennart Poettering
775ae35403 resolved: add support for answering DNSSEC questions on the stub
This substantially beefs up the local DNS stub feature set in order to
allow local clients to do DNSSEC validation through the stub.

Previously we'd return NOTIMP if we'd get a DO or DO+CD lookup. With
this change we'll instead:

1. If we get DO+CD requests (i.e. DNSSEC with no local checking) we'll
   proxy DNS queries and response mostly unmodified to/from upstream DNS
   servers if possible (this is called "bypass" mode).  We will patch in
   new request IDs, (and patch them back out on reply), so that we can
   sanely keep track of things.  We'll also maintain a minimal local
   cache for such lookups, always keeping the whole DNS packets in it
   (if we reply from cache we'll patch the TTLs of all included RRs).

2. If we get DO requests without CD (i.e. DNSSEC with local checking)
   we'll resolve and validate locally. In this mode we will not proxy
   packets, but generate our own. We will however cache the combination
   of answer RRs (along with their packet section assignments) we got
   back in the cache, and use this information to generate reply packets
   from the DNS stub.

In both cases: if we determine a lookup is to be answered from LLMNR or
mDNS we'll always revert to non-DNSSEC, non-proxy operation as before.
Answers will lack the DO bit then, since the data cannot be validated
via DNSSEC by the clients.

To make this logic more debuggable, this also adds query flags for
turning off RR sources. i.e. cache/network/zone/trust anchor/local
synthesis may now be disabled individually for each lookup.

The cache is substantially updated to make all this work: in addition to
caching simple RRs for lookup RR keys, we'll now cache the whole packets
and the whole combination of RRs, so that we can answer DO and DO+CD
replies sensibly according to the rules described above. This sounds
wasteful, but given that the
DnsResourceRecord/DnsResourceKey/DnsAnswer/DnsPacket
objects are all ref-counted and we try to merge references the actual
additional memory used should be limited (but this might be something to
optimize further later on).

To implement classic RR key lookups and new-style packet proxy lookups
(i.e. the ones necessary for DO+CD packet proxying, as described above)
DnsTransaction and DnsQuery objects now always maintain either a
DnsResourceKey/DnsQuestion as lookup key or a DnsPacket for "bypass"
mode.

Fixes: #4621 #17218
2021-02-09 17:58:25 +01:00
Lennart Poettering
d8f3836ea9 resolved: DNS_CLASS_ANY lookups are OK too 2021-02-09 17:53:10 +01:00
Lennart Poettering
6f76e68a3c resolved: if dns_packet_append_answer() fails count how many RRs were successfully added
This is useful later when handling the truncation case: if we can't add
all RRs we'd like to add we need to set the TC bit, but still report the
number of RRs we added (and not the number of RRs we would have liked to
add) to the packet.
2021-02-09 17:53:04 +01:00
Lennart Poettering
04617bf83f resolved: add RRSIG field to DnsAnswerItem 2021-02-09 17:52:59 +01:00
Lennart Poettering
fa4e74b8ff resolved: add new DnsAnswerFlags indicating originating section when parsing
Let's beef up our parser a bit: let's store in the DnsAnswerFlags field
(that is stored as part of DnsAnswerItem) which DNS packet section (i.e.
answer, authoritative, additional) an RR originates from.

This is useful when propagating answers from an upstream DNS server
eventually, as we can place the data in the right sections downstream
too.
2021-02-09 17:52:53 +01:00
Lennart Poettering
9c5fcb8ac7 resolved: replace DNS_ANSWER_FOREACH_FULL() iterator macro with DNS_ANSWER_FOREACH_ITEM()
The more fields DnsAnswerItem gains the less sense it makes to pass
every field of it as separate parameter to an iterator macro. Let's
simplify things here, in preparation of adding more fields to the
structure later on: let's just return the structure itself in the loop,
rather than the individual fields.
2021-02-09 17:52:49 +01:00
Lennart Poettering
b17b6a7401 resolved: slight modernizations of resolved-dns-answer.c functions
Let's follow our own coding style an initialized return values on all
cases of "success".
2021-02-09 17:52:43 +01:00
Lennart Poettering
7d44b1986b resolved: add dns_answer_contains() helper 2021-02-09 17:52:36 +01:00
Lennart Poettering
81b4d94df5 resolved: add logic for patching TTLs of full packets 2021-02-09 17:52:30 +01:00
Lennart Poettering
93748b2686 resolved: add logic for patching OPT max udp size of existing packet 2021-02-09 17:52:24 +01:00
Lennart Poettering
42df953247 resolved: introduce dns_transaction_key() helper for getting RR key for transaction
This is a simple search&replace excercise: instead of accessing the
"key" field of the transaction directly, let's use a small inline helper
that does this for us.

This appears pointless for now, but this will become useful later when
we introduce "bypass" transactions, that reuse the original client DNS
packet for queries instead of synthesizing a packet of our own. In that
case transactions either have regular "key" field initialized as before,
or the "bypass" packet field instead. The new dns_transaction_key()
helper allows us to hide the differences for most cases as we can later
teach it to access the "bypass" packet's question key transparently.

No change in behaviour.
2021-02-09 17:52:19 +01:00
Lennart Poettering
1a6cd0206b resolved: add helper dns_packet_dup() for duplicating packets 2021-02-09 17:51:45 +01:00
Lennart Poettering
228f5ed3a4
Merge pull request #18518 from poettering/inhibit-limit-columns
put a width limit on the "systemd-inhibit --list" table
2021-02-09 17:14:25 +01:00
Lennart Poettering
619b0c077c inhibit: cut off overly long "who" fields
systemd-inhibit when invoked with a command line will put the whole
command line in the "who" field of the inhibitor lock. This can get
extremely long for shell expressions, making the table "systemd-inhibit
--list" shows ridiculously weirdly formatted. Let's put a limit on the
column width: half of the screen, not more.
2021-02-09 15:06:25 +01:00
Lennart Poettering
2cd9f773e2 format-table: don't hit assert if column got less width than it asked for
If one field in a specific column has a maximum size limit, other fields
in the same column might affected by it and get less than they asked
for. Let's make sure we can handle this, and don't assert on this
because surprisingly we got less than what we asked for.
2021-02-09 15:05:25 +01:00
Zbigniew Jędrzejewski-Szmek
40a49f127e systemctl: remove comment about --failed being deprecated
Follow-up for bef19548a2.
2021-02-09 14:14:16 +01:00
Zbigniew Jędrzejewski-Szmek
5fd8782328 fuzz-systemctl-parse-argv: a new fuzzer
Does what the name suggests. Obviously inspired by sudoers, but note that
our tools are not supposed to be installed suid, so there is no privilege
boundary to cross here.
2021-02-09 14:11:42 +01:00
Luca Boccassi
0f15cb2243
Merge pull request #18470 from mrc0mmand/ci-clang-12
ci: run build test with clang-12 as well
2021-02-09 13:06:40 +00:00
Zbigniew Jędrzejewski-Szmek
5bbf331434
Merge pull request #18416 from yuwata/strverscmp
util: introduce strverscmp_improved()
2021-02-09 14:06:18 +01:00
Zbigniew Jędrzejewski-Szmek
4ef8478eb5 fuzz-journal-remote: do not assert on resource conditions
We have a number of issues where oss-fuzz reports input-independent crashes of
fuzz-journal-remote. Instead of asserting that stuff that allocated fds and
memory never fails, let's instead just return an error.

https://oss-fuzz.com/testcase-detail/4791099424112640
https://oss-fuzz.com/testcase-detail/4531912477638656

I don't see any docs as to whether LLVMFuzzerTestOneInput() is allowed to
return non-zero. Propagating the error code is easiest, so let's just do that.
If it turns out that this causes oss-fuzz to still report a failure, we can
suppress that later.
2021-02-09 13:59:01 +01:00
Yu Watanabe
7bc38f59dc log: do not use uninitialized value
Follow-up for 85cf96e3f5.
2021-02-09 13:58:12 +01:00
Frantisek Sumsal
67c972c610 ci: temporarily pin Arch repositories to glibc 2.32-5
glibc 2.33-3 shipped on 2021-02-06 breaks running Arch containers on
systems with older kernels (like Ubuntu Focal). Until the issue is
resolved, let's pin the Arch repositories to glibc 2.32-5 to mitigate
the annoying CI fails.

See: https://bugs.archlinux.org/task/69563
2021-02-09 13:57:28 +01:00
Zbigniew Jędrzejewski-Szmek
f47df388a0
Merge pull request #18346 from yuwata/hostnamectl-try-to-set-transient-hostname
hostnamectl: try to set transient hostname even if setting static or pretty hostname failed
2021-02-09 12:42:25 +01:00
Yu Watanabe
beb75dd31d test-network: support protocol and linkdown flag for ff00::/8 route
Fixes #18507.
2021-02-09 12:25:27 +01:00
Kevin P. Fleming
12f7469bbe network: Delay addition of IPv6 Proxy NDP addresses
Setting of IPv6 Proxy NDP addresses must be done at the same
time as static addresses, static routes, and other link attributes
that must be configured when the link is up. Doing this ensures
that they are reconfigured on the link if the link goes down
and returns to service.
2021-02-09 19:56:56 +09:00
Anita Zhang
59331b8e29 oom: implement avoid/omit xattr support
There may be situations where a cgroup should be protected from killing
or deprioritized as a candidate. In FB oomd xattrs are used to bias oomd
away from supervisor cgroups and towards worker cgroups in container
tasks. On desktops this can be used to protect important units with
unpredictable resource consumption.

The patch allows systemd-oomd to understand 2 xattrs:
"user.oomd_avoid" and "user.oomd_omit". If systemd-oomd sees these
xattrs set to 1 on a candidate cgroup (i.e. while attempting to kill something)
AND the cgroup is owned by root, it will either deprioritize the cgroup as
a candidate (avoid) or remove it completely as a candidate (omit).

Usage is restricted to root owned cgroups to prevent situations where an
unprivileged user can set their own cgroups lower in the kill priority than
another user's (and prevent them from omitting their units from
systemd-oomd killing).
2021-02-09 02:27:40 -08:00
Anita Zhang
242d75bdaa cgroup-util: add ManagedOOMPreference enum to use between pid1 and oomd 2021-02-09 02:27:37 -08:00
Anita Zhang
74f834e9e2 oom: skip over cgroups with no memory usage 2021-02-09 01:30:05 -08:00
Anita Zhang
1f76411bd6 oom: sort by pgscan and memory usage
If 2 candidates have the same pgscan, prioritize the one with the larger
memory usage.
2021-02-09 01:29:57 -08:00
Anita Zhang
df7f3eab52 oom: wrap reply.path with empty_to_root 2021-02-09 01:23:58 -08:00
Anita Zhang
e303833355 oom: shorten xattr name 2021-02-09 01:23:58 -08:00
Yu Watanabe
8087644a13 tree-wide: replace strverscmp() and str_verscmp() with strverscmp_improved() 2021-02-09 14:25:03 +09:00
Yu Watanabe
87b7d9b6ff string-util: introduce strverscmp_improved()
Unfortunately, strverscmp() from libc or str_verscmp() do not correctly
handle pre-release version, e.g. 247 vs 247~rc1.

This implement a new comparison function, which is based on the RPM's
rpmvercmp().
2021-02-09 14:24:58 +09:00
Yu Watanabe
e5bc5f1f5a fundamental: move several macros and functions into src/fundamental/
sd-boot has a copy of a subset of codes from libbasic. This makes
sd-boot share the code with libbasic, and dedup the code.

Note, startswith_no_case() is dropped from sd-boot, as
- it is not used,
- the previous implementation is not correct,
- gnu-efi does not have StrniCmp() or so.
2021-02-09 14:22:54 +09:00
Yu Watanabe
822be62fb2 hostnamectl: use Table 2021-02-09 13:49:27 +09:00
Yu Watanabe
f2d3ec7abf hostnamectl: show hint when user try to set transient hostname but static hostname is already used 2021-02-09 13:49:27 +09:00
Yu Watanabe
e8acf09186 hostname: use free_and_strdup_and_warn() 2021-02-09 13:49:27 +09:00
Yu Watanabe
ba12e41d05 hostname: re-read file later when failed to update file
Previously, even when writing e.g. /etc/hostname fails, the static
hostname in Context is not restored. So, the subsequent call of the same
method succeeds:
```
$ sudo chattr +i /etc/hostname
$ sudo hostnamectl --static set-hostname aaa
Could not set static hostname: Access denied
$ echo $?
1
$ sudo hostnamectl --static set-hostname aaa
$ echo $?
0
```

This makes when updating file is failed, the saved stat is cleared. So,
the static hostname or machine information in the context are always
consistent to the corresponding files.
2021-02-09 13:49:27 +09:00
Yu Watanabe
c388618ec0 hostnamectl: unset pretty hostname only when no target is specified 2021-02-09 13:49:27 +09:00
Yu Watanabe
2d79e90a1f hostnamectl: try to set transient hostname even if updating static or pretty hostname failed
If no target (--pretty, --static, or --transient) is specified, then
let's try to set transient hostname even if setting static or pretty
hostname failed. This may be useful for read-only filesystem.
2021-02-09 13:49:15 +09:00
Yu Watanabe
957991b7ac hostname: introduce two bus errors for updating file 2021-02-09 13:37:27 +09:00
Yu Watanabe
0ce2a086da bus-error: align error definitions 2021-02-09 13:37:27 +09:00
Yu Watanabe
5c3d2e3f43 hostnamectl: improve log message on failure 2021-02-09 13:37:27 +09:00
Gablegritule
5f33b2300b
hwdb: add axis overrides for the Dell Latitude E5510 TouchPad (#18493)
I added an entry for Dell Latitude E5510 TouchPad to set up the true size
of the TouchPad (the size is currently over-estimated)
2021-02-09 09:30:49 +10:00
Frantisek Sumsal
0c69f2ee26
Merge pull request #18478 from mrc0mmand/fix-TEST-06
TEST-06-SELINUX fixes
2021-02-08 12:34:13 +01:00
Frantisek Sumsal
8762049792 tree-wide: fix the string concatenation warning with clang-12
e.g.:
./src/shared/dissect-image.c:2218:39: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
                                      "/usr/lib/os-release\0",
                                      ^
../src/shared/dissect-image.c:2217:39: note: place parentheses around the string literal to silence warning
                [META_OS_RELEASE]   = "/etc/os-release\0"
                                      ^
1 error generated.

See: https://reviews.llvm.org/D85545
2021-02-08 12:22:03 +01:00
Zbigniew Jędrzejewski-Szmek
5bb920ce27 xdg-autostart-generator: sort header includes 2021-02-08 12:17:29 +01:00