]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 years agoAdd crypttab option silent
Sebastian Blunt [Sat, 15 May 2021 03:39:54 +0000 (20:39 -0700)] 
Add crypttab option silent

Adds a crypttab option 'silent' that enables the AskPasswordFlag
ASK_PASSWORD_SILENT. This allows usage of systemd-cryptsetup to default
to silent mode, rather than requiring the user to press tab every time.

5 years agotest: combine stdout/stderr from failed test
Dan Streetman [Fri, 30 Apr 2021 00:21:10 +0000 (20:21 -0400)] 
test: combine stdout/stderr from failed test

Printing stdout and stderr from a failed test makes it harder to
interpret what the specific problem was; instead let's print out
the lines in order as we got them when the test was run

Also save failed test output to file if ARTIFACT_DIRECTORY is defined

5 years agoMerge pull request #19612 from keszybz/meson-0.58-quieting
Zbigniew Jędrzejewski-Szmek [Sat, 15 May 2021 08:49:10 +0000 (10:49 +0200)] 
Merge pull request #19612 from keszybz/meson-0.58-quieting

Make meson output quiet again

5 years agoresolved: fix braino with reference counting and linked lists
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 08:49:24 +0000 (10:49 +0200)] 
resolved: fix braino with reference counting and linked lists

In 0e0fd08fc832b8f42e567d722d388eba086da5ff I added reference counts to keep
track of the DnsQueryCandidate objects. Unfortunately, dns_query_unref_candidates()
was written as

     while (q->candidates)
           dns_query_candidate_unref(q->candidates);

i.e. it would keep dropping the reference count as many times as needed for it
to hit 0, making the patch less than fully effective.

dns_query_unref_candidates() is renamed to dns_query_detach_candidates() and
changed to drop exactly one reference from each of the linked candidates.

Example failure:
==463== Invalid read of size 8
==463==    at 0x419C93: dns_query_candidate_go (resolved-dns-query.c:159)
==463==    by 0x41A143: dns_query_candidate_notify (resolved-dns-query.c:304)
==463==    by 0x434BD6: dns_transaction_complete (resolved-dns-transaction.c:437)
==463==    by 0x436A0F: dns_transaction_process_dnssec (resolved-dns-transaction.c:976)
==463==    by 0x4378C1: dns_transaction_process_reply (resolved-dns-transaction.c:1387)
==463==    by 0x437CE9: on_dns_packet (resolved-dns-transaction.c:1444)
==463==    by 0x4B2DC9B: source_dispatch (sd-event.c:3512)
==463==    by 0x4B2FB1F: sd_event_dispatch (sd-event.c:4077)
==463==    by 0x4B2FFFA: sd_event_run (sd-event.c:4138)
==463==    by 0x4B301D6: sd_event_loop (sd-event.c:4159)
==463==    by 0x464A24: run (resolved.c:92)
==463==    by 0x464B3C: main (resolved.c:99)
==463==  Address 0x5f409d0 is 32 bytes inside a block of size 72 free'd
==463==    at 0x48410E4: free (vg_replace_malloc.c:755)
==463==    by 0x418EDF: mfree (alloc-util.h:48)
==463==    by 0x4197E8: dns_query_candidate_free (resolved-dns-query.c:67)
==463==    by 0x4198B7: dns_query_candidate_unref (resolved-dns-query.c:70)
==463==    by 0x41A2E3: dns_query_unref_candidates (resolved-dns-query.c:337)
==463==    by 0x41C5FE: dns_query_cname_redirect (resolved-dns-query.c:1028)
==463==    by 0x41CA04: dns_query_process_cname_one (resolved-dns-query.c:1128)
==463==    by 0x41CA80: dns_query_process_cname_many (resolved-dns-query.c:1157)
==463==    by 0x40C0BD: bus_method_resolve_hostname_complete (resolved-bus.c:198)
==463==    by 0x41B312: dns_query_complete (resolved-dns-query.c:562)
==463==    by 0x41C1AC: dns_query_accept (resolved-dns-query.c:922)
==463==    by 0x41C2C4: dns_query_ready (resolved-dns-query.c:955)
==463==    by 0x41A162: dns_query_candidate_notify (resolved-dns-query.c:314)
==463==    by 0x434BD6: dns_transaction_complete (resolved-dns-transaction.c:437)
==463==    by 0x438995: dns_transaction_prepare (resolved-dns-transaction.c:1728)
==463==    by 0x43921D: dns_transaction_go (resolved-dns-transaction.c:1928)
==463==    by 0x419C7C: dns_query_candidate_go (resolved-dns-query.c:163)
==463==    by 0x41A143: dns_query_candidate_notify (resolved-dns-query.c:304)
==463==    by 0x434BD6: dns_transaction_complete (resolved-dns-transaction.c:437)
==463==    by 0x436A0F: dns_transaction_process_dnssec (resolved-dns-transaction.c:976)
==463==    by 0x4378C1: dns_transaction_process_reply (resolved-dns-transaction.c:1387)
==463==    by 0x437CE9: on_dns_packet (resolved-dns-transaction.c:1444)
==463==    by 0x4B2DC9B: source_dispatch (sd-event.c:3512)
==463==    by 0x4B2FB1F: sd_event_dispatch (sd-event.c:4077)
==463==    by 0x4B2FFFA: sd_event_run (sd-event.c:4138)
==463==    by 0x4B301D6: sd_event_loop (sd-event.c:4159)
==463==    by 0x464A24: run (resolved.c:92)
==463==    by 0x464B3C: main (resolved.c:99)
==463==  Block was alloc'd at
==463==    at 0x483E86F: malloc (vg_replace_malloc.c:380)
==463==    by 0x418F81: malloc_multiply (alloc-util.h:96)
==463==    by 0x419378: dns_query_candidate_new (resolved-dns-query.c:23)
==463==    by 0x41B42C: dns_query_add_candidate (resolved-dns-query.c:582)
==463==    by 0x41BB7A: dns_query_go (resolved-dns-query.c:762)
==463==    by 0x40CE3A: bus_method_resolve_hostname (resolved-bus.c:464)
==463==    by 0x4A84B86: method_callbacks_run (bus-objects.c:414)
==463==    by 0x4A87961: object_find_and_run (bus-objects.c:1323)
==463==    by 0x4A87FEE: bus_process_object (bus-objects.c:1443)
==463==    by 0x4AA3434: process_message (sd-bus.c:2964)
==463==    by 0x4AA3623: process_running (sd-bus.c:3006)
==463==    by 0x4AA4110: bus_process_internal (sd-bus.c:3226)
==463==    by 0x4AA41EF: sd_bus_process (sd-bus.c:3253)
==463==    by 0x4AA5343: io_callback (sd-bus.c:3604)
==463==    by 0x4B2DC9B: source_dispatch (sd-event.c:3512)
==463==    by 0x4B2FB1F: sd_event_dispatch (sd-event.c:4077)
==463==    by 0x4B2FFFA: sd_event_run (sd-event.c:4138)
==463==    by 0x4B301D6: sd_event_loop (sd-event.c:4159)
==463==    by 0x464A24: run (resolved.c:92)
==463==    by 0x464B3C: main (resolved.c:99)

Fixes #19376.

5 years agoRevert "tools/make-directive-index: parallelize"
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 15:53:31 +0000 (17:53 +0200)] 
Revert "tools/make-directive-index: parallelize"

This reverts commit a2031de849da52aa85b7e4326c0112ed7e5b5672.

The patch itself seems OK, but it exposes a bug in lxml or libxml2-2.9.12 which
was just released. This is being resolved in
https://gitlab.gnome.org/GNOME/libxml2/-/issues/255, but it might be while. So
let's revert this for now to unbreak our CI.

Fixes #19601.

5 years agomeson: revert the change to unquote commands in add_install_script 19612/head
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 14:12:51 +0000 (16:12 +0200)] 
meson: revert the change to unquote commands in add_install_script

Old meson fails with:
Element not a string: [<Holder: <ExternalProgram 'sh' -> ['/bin/sh']>>, '-c', 'test -n "$DESTDIR" || /bin/journalctl --update-catalog']

I'm doing it as a revert so that it's easy to undo the revert when we require
newer meson. The effect is not so bad, maybe a dozen or so lines about finding
'sh'.

5 years agofix typo
Yu Watanabe [Fri, 14 May 2021 16:59:23 +0000 (01:59 +0900)] 
fix typo

5 years agoresolved: inline iterator variable declarations 19608/head
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 15:33:54 +0000 (17:33 +0200)] 
resolved: inline iterator variable declarations

5 years agoresolved: drop pointless bitfield on a lone bool
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 15:32:50 +0000 (17:32 +0200)] 
resolved: drop pointless bitfield on a lone bool

5 years agoresolved: optimize layout of DnsPacket
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 15:31:26 +0000 (17:31 +0200)] 
resolved: optimize layout of DnsPacket

We obviously have lots of those, so even small savings add up.

Bitfields are dropped because they don't give any memory savings due to
alignment requirements (but would still require more complex to access).

/* size: 184, cachelines: 3, members: 28 */
/* sum members: 172, holes: 1, sum holes: 4 */
/* sum bitfield members: 4 bits (0 bytes) */
/* padding: 7 */
/* bit_padding: 4 bits */
    ↓
/* size: 176, cachelines: 3, members: 28 */

5 years agoresolved: optimize layout of DnsTransaction
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 15:28:48 +0000 (17:28 +0200)] 
resolved: optimize layout of DnsTransaction

/* size: 296, cachelines: 5, members: 46 */
/* sum members: 278, holes: 5, sum holes: 17 */
/* sum bitfield members: 4 bits, bit holes: 1, sum bit holes: 4 bits */
    ↓
/* size: 280, cachelines: 5, members: 46 */
/* sum members: 278, holes: 1, sum holes: 1 */
/* sum bitfield members: 4 bits, bit holes: 1, sum bit holes: 4 bits */

5 years agoresolved: rearrange DnsResourceRecord for better layout
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 15:15:53 +0000 (17:15 +0200)] 
resolved: rearrange DnsResourceRecord for better layout

The structure is rearranged to have less holes. Also fields in the union
are rearranged not to have holes (though most variants of the union still
have some padding at the end).

The full size does not decrease a lot, but the compiler should be able to
copy less bytes when it knows the specific type of the union.

Bitfields are dropped because they don't give any memory savings due to
alignment requirements (but would still require more complex to access).

The change from the this and previous commit:
/* size: 128, cachelines: 2, members: 13 */
/* sum members: 112, holes: 3, sum holes: 15 */
/* sum bitfield members: 2 bits, bit holes: 1, sum bit holes: 6 bits */
     ↓
/* size: 112, cachelines: 2, members: 13 */
/* sum members: 108, holes: 1, sum holes: 4 */

5 years agoresolved: use narrower types for label counts in rr
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 15:03:30 +0000 (17:03 +0200)] 
resolved: use narrower types for label counts in rr

Order will be adjusted later to remove holes.

5 years agoselinux: invoke selinux_set_callback(3) more type-safe 19551/head
Christian Göttsche [Fri, 14 May 2021 12:14:25 +0000 (14:14 +0200)] 
selinux: invoke selinux_set_callback(3) more type-safe

5 years agoresolved: shorten dns_name_count_labels()
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 14:47:21 +0000 (16:47 +0200)] 
resolved: shorten dns_name_count_labels()

5 years agoresolved: pahole optimization for DnsQuery
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 09:28:17 +0000 (11:28 +0200)] 
resolved: pahole optimization for DnsQuery

Change from the last three commits:

/* size: 312, cachelines: 5, members: 46 */
/* sum members: 296, holes: 5, sum holes: 16 */
   ↓
/* size: 288, cachelines: 5, members: 46 */
/* sum members: 286, holes: 1, sum holes: 1 */

It's not a big difference, but we might have quite a few queries in flight,
so let' make this a bit more efficient.

5 years agoresolved: make counter for redirects smaller
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 09:20:18 +0000 (11:20 +0200)] 
resolved: make counter for redirects smaller

It can never go above 16, so let's use a narrower type.

Order will be adjusted later to remove holes.

5 years agoresolved: make counter for n_auxiliary_queries smaller
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 09:12:12 +0000 (11:12 +0200)] 
resolved: make counter for n_auxiliary_queries smaller

It can never go above 64, so let's use a narrower type.

Order will be adjusted later to remove holes.

5 years agoMerge pull request #19609 from keszybz/networkd-dhcp-man
Lennart Poettering [Fri, 14 May 2021 14:26:18 +0000 (16:26 +0200)] 
Merge pull request #19609 from keszybz/networkd-dhcp-man

Tweak man page ordering for DHCPv[46] options

5 years agoresolved: indent tables for readability
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 07:04:47 +0000 (09:04 +0200)] 
resolved: indent tables for readability

Some of the tables in resolved were already doing using this convention. This
makes the rest of them do so too.

5 years agomeson: print autodetected sbat fields
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 12:20:33 +0000 (14:20 +0200)] 
meson: print autodetected sbat fields

...
Message: sbat-distro (from ID): fedora
Message: sbat-distro-summary (from NAME): Fedora
Message: sbat-distro-url (from BUG_REPORT_URL): https://bugzilla.redhat.com/
...

5 years agomeson: call find_program() once and reuse the variable everywhere
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 12:16:17 +0000 (14:16 +0200)] 
meson: call find_program() once and reuse the variable everywhere

Meson 0.58 has gotten quite bad with emitting a message every time
a quoted command is used:
Program /home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh found: YES (/home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program xsltproc found: YES (/usr/bin/xsltproc)
Configuring custom-entities.ent using configuration
Message: Skipping bootctl.1 because ENABLE_EFI is false
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Message: Skipping journal-remote.conf.5 because HAVE_MICROHTTPD is false
Message: Skipping journal-upload.conf.5 because HAVE_MICROHTTPD is false
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Message: Skipping loader.conf.5 because ENABLE_EFI is false
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
...

Let's suffer one message only for each command. Hopefully we can silence
even this when https://github.com/mesonbuild/meson/issues/8642 is
resolved.

5 years agoselinux: reload label db on policy load with libselinux 3.2
Christian Göttsche [Fri, 14 May 2021 12:12:39 +0000 (14:12 +0200)] 
selinux: reload label db on policy load with libselinux 3.2

Currently the label database is not reloaded with libselinux 3.2 on a
policy reload.

Since libselinux 3.2 avc_open(3) uses the SELinux status page instead of
a netlink socket to check for policy reloads.
The status page is also queried in mac_selinux_maybe_reload().
Thus calls to selinux_check_access(3) might consume an update, queried
by selinux_status_updated(3), leaving mac_selinux_maybe_reload() unable
to detect a policy reload.

Do not use selinux_status_updated(3), use selinux_status_policyload(3)
unconditionally.

Relevant libselinux commit: https://github.com/SELinuxProject/selinux/commit/05bdc03130d741e53e1fb45a958d0a2c184be503

Debian Bullseye is going to ship libselinux 3.1, so stay compatible for
backports.

5 years agoman: reword descriptions of two DHCPv4 options 19609/head
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 07:04:30 +0000 (09:04 +0200)] 
man: reword descriptions of two DHCPv4 options

5 years agoman: reorder items in [DHCPv4] and [DHCPv6] sections
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 06:58:44 +0000 (08:58 +0200)] 
man: reorder items in [DHCPv4] and [DHCPv6] sections

The settings were listen in a completely random order, also different
between the v4 and v6 sections. Order by "options sent", "options received",
"communication settings" in both sections.

Also minor formatting changes are done, e.g. "=" is added in various places.

5 years agonetwork: shorten code a bit and update log message
Yu Watanabe [Fri, 14 May 2021 03:08:49 +0000 (12:08 +0900)] 
network: shorten code a bit and update log message

5 years agoMerge pull request #19592 from yuwata/network-introduce-describe-bus-method
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 07:34:06 +0000 (09:34 +0200)] 
Merge pull request #19592 from yuwata/network-introduce-describe-bus-method

network: introduce Describe() bus method and use it in networkctl

5 years agoshell-completion: support --json option for hostnamectl 19592/head
Yu Watanabe [Wed, 12 May 2021 16:37:41 +0000 (01:37 +0900)] 
shell-completion: support --json option for hostnamectl

5 years agonetworkctl: introduce --json option for "status" and "list" commands
Yu Watanabe [Wed, 12 May 2021 15:22:14 +0000 (00:22 +0900)] 
networkctl: introduce --json option for "status" and "list" commands

When `--json` option is specified, "status" and "list" commands gives
the same information, as originally "list" just gives partial
information of "status" in different format.

5 years agojson: make JSON_VARIANT_ARRAY/OBJECT_FOREACH() nestable
Yu Watanabe [Fri, 14 May 2021 00:05:20 +0000 (09:05 +0900)] 
json: make JSON_VARIANT_ARRAY/OBJECT_FOREACH() nestable

5 years agonetworkctl: use table_set_empty_string()
Yu Watanabe [Wed, 12 May 2021 16:12:58 +0000 (01:12 +0900)] 
networkctl: use table_set_empty_string()

5 years agonetwork: introduce Describe() method for manager and links
Yu Watanabe [Wed, 12 May 2021 13:11:09 +0000 (22:11 +0900)] 
network: introduce Describe() method for manager and links

5 years agoudev,network: make link_get_type_string() return negative errno on failure
Yu Watanabe [Wed, 12 May 2021 12:07:14 +0000 (21:07 +0900)] 
udev,network: make link_get_type_string() return negative errno on failure

And make net_match_config() propagate the error.

5 years agonetwork: move and rename network_get() -> link_get_network()
Yu Watanabe [Wed, 12 May 2021 11:58:06 +0000 (20:58 +0900)] 
network: move and rename network_get() -> link_get_network()

This also drops test_network_get(). But it tests almost nothing. So, it
should be ok to not re-implement something like test_link_get_network().

5 years agorun: update checks to allow running with a user's bus
Anita Zhang [Thu, 13 May 2021 08:17:51 +0000 (01:17 -0700)] 
run: update checks to allow running with a user's bus

systemd-run is documented to as being able to connect and run on a
specific user bus with "--user --machine=lennart@.host" arguments.
This PR updates some logic that prevented this from working.

5 years agotools/make-directive-index: parallelize
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 09:24:25 +0000 (11:24 +0200)] 
tools/make-directive-index: parallelize

I occasionally do 'build/man/man systemd.directives' when working on man pages,
and it's annoying slow. By paralellizing the parsing of xml, we can make it a
bit faster.

This is still rather innefficient. Only the parsing part is serialized, xml is
still produced serially at the end, which is hard to avoid.

$ ninja -C build man/systemd.directives.xml
before:
8.20s user 0.21s system 99% cpu 8.460 total
8.33s user 0.18s system 98% cpu 8.619 total
8.72s user 0.19s system 98% cpu 9.019 total

after:
13.99s user 0.73s system 345% cpu 4.262 total
14.15s user 0.35s system 348% cpu 4.161 total
14.33s user 0.35s system 339% cpu 4.321 total

I.e. it uses almost twice as much cpu, but cuts the wallclock time down (on a
2-core/4-thread cpu) to about half too, which is an overall win if you're just
trying to render the man page.

The change from list and .append() to set and .add() is something that could
have been done before too, but it's noticable now. It cuts down on the
serialization/deserialization time (about .2s).

5 years agoAdd Microsoft Pro Intellimouse MOUSE_DPI to hwdb
Simon Watts [Wed, 12 May 2021 21:22:39 +0000 (22:22 +0100)] 
Add Microsoft Pro Intellimouse MOUSE_DPI to hwdb

- Internet specifications give 1600 DPI @ 1000Hz for this sensor
- Confirmed experimentally via `mouse-dpi-tool`
- vid, pid, and name match string from `mouse-dpi-tool`

5 years agoUpdate Korean translation (#19083)
Seong-ho Cho [Thu, 13 May 2021 08:19:48 +0000 (17:19 +0900)] 
Update Korean translation (#19083)

Co-authored-by: Seong-ho Cho <shcho@gnome.org>
5 years agoMerge pull request #19590 from keszybz/comments-and-service-modernization
Yu Watanabe [Thu, 13 May 2021 03:17:19 +0000 (12:17 +0900)] 
Merge pull request #19590 from keszybz/comments-and-service-modernization

Comments and service modernization

5 years agocore/service: rework management of exec_fd event source 20030/head
Zbigniew Jędrzejewski-Szmek [Mon, 10 May 2021 11:12:53 +0000 (13:12 +0200)] 
core/service: rework management of exec_fd event source

The code in service_spawn() was written as if exec_fd_event_source
was always unset. (We would either fail the assertion that is moved in the
patch, or leak the event source object if it was set.)

To make this work, let's always assert that exec_fd_event_source is unset,
and actually unset it service_sigchld_event(). I think this is the most
elegant approach. The problem is that we don't have the same information
about execution flags as in service_spawn(), so we need to conditionalize
on pid==main_pid to know if we should disable exec_fd_event_source.
I think this matches all cases where we may set exec_fd_event_source:
service_enter_start() and service_run_next_main().

service_enter_stop_post() calls service_set_state(), which will also destroy
the source. But that happens too late, because from service_enter_stop_post()
we call service_spawn() first, and then service_set_state() second.

(An alternative approach would be to deallocate the existing
exec_fd_event_source in service_spawn(). But this would mean that we would
temporarily have an event source attached to a process that we already know is
dead, which seems less than ideal.)

Original report from Dimitri John Ledkov <dimitri.ledkov@canonical.com>:
> Ubuntu private bug reference for this issue at the moment is
> https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1921145

> Michael's and Ian's team run into an issue when using systemd in the
> initrd, without dbus daemon running, and launching a unit in a
> particular way that appears to lock up systemd (pid 1) it self.

> michael vogt: "The attached script works for me to reproduce this on
> classic. I tested 20.04 (245) and 21.04 (247) in a qemu VM. Sometimes
> I need to run it multiple times but usually it crashes after at most 2
> runs. Use "journalctl | tail" to see the messages, it's the same that
> Ian reported. There is also a /var/crash/_usr_lib_systemd_systemd
> crash file created."

> I understand that the particular way to run a unit is very odd,
> however, it is currently possible to invoke, and it would be expected
> for pid1 to not lock up and crash.

> The Assertion that systemd hits is along the lines of:

> [ 10.182627] systemd[1]: Assertion 's' failed at
> src/core/service.c:3204, function service_dispatch_exec_io().
> Aborting.
> [ 10.195458] systemd[1]: Caught <ABRT>, dumped core as pid 449.
> [ 10.204446] systemd[1]: Freezing execution.

5 years agosd-event: add more asserts about event source integrity
Zbigniew Jędrzejewski-Szmek [Mon, 10 May 2021 08:23:08 +0000 (10:23 +0200)] 
sd-event: add more asserts about event source integrity

Also "downgrade" assert_se() to assert(), this is not test code.

5 years agoMerge pull request #19567 from poettering/ipv4-ipv6-lowercase
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 10:21:58 +0000 (12:21 +0200)] 
Merge pull request #19567 from poettering/ipv4-ipv6-lowercase

various follow-ups to socket-bind logic

5 years agoresolved.conf.in: add missing Quad9 servers
Michael Catanzaro [Tue, 11 May 2021 13:24:55 +0000 (08:24 -0500)] 
resolved.conf.in: add missing Quad9 servers

The example configuration is missing half of Quad9's addresses.

5 years agoresolved: be more careful with weird links with low MTUs
Lennart Poettering [Tue, 11 May 2021 20:21:52 +0000 (22:21 +0200)] 
resolved: be more careful with weird links with low MTUs

Apparently CAN links will show up in rtnetlink with very low MTUs. We
shouldn't consider them relevant if no IP is spoken over them, since
these MTUs are irrelevant for us then.

Hence, let's check if there's an address assigned to the link before
considering its MTU.

As additional safety net filter out MTUs smaller than the minimum DNS
packet size, too.

Finally, in case we don't find any suitable interface MTU, let's default
to 1500 as the generic Ethernet MTU.

Fixes: #19396
5 years agopam: fix typo try_authtok → use_authtok
Lennart Poettering [Wed, 12 May 2021 08:33:27 +0000 (10:33 +0200)] 
pam: fix typo try_authtok → use_authtok

This was a copy/paste mistae apparently, there's not "try_authtok" and
this was supposed to copy what Fedora uses, which uses "use_authtok"
correctly. Hence adjust this.

Fixes: #19369
5 years agoMerge pull request #19533 from yuwata/network-queue
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 10:12:22 +0000 (12:12 +0200)] 
Merge pull request #19533 from yuwata/network-queue

network: introduce queue to configure address, route, etc

5 years agocore: disable event sources before unreffing them
Zbigniew Jędrzejewski-Szmek [Mon, 10 May 2021 08:22:07 +0000 (10:22 +0200)] 
core: disable event sources before unreffing them

This mirrors the change done for systemd-resolved in
97935302283729c9206b84f5e00b1aff0f78ad19. Quoting that patch:

> We generally operate on the assumption that a source is "gone" as soon as we
> unref it. This is generally true because we have the only reference. But if
> something else holds the reference, our unref doesn't really stop the source
> and it could fire again.

In particular, we take temporary references from sd-event code, and when called
from an sd-event callback, we could temporarily see this elevated reference
count. This patch doesn't seem to change anything, but I think it's nicer to do
the same change as in other places and not rely on _unref() immediately
disabling the source.

5 years agocore/service: modernization 19590/head
Zbigniew Jędrzejewski-Szmek [Mon, 10 May 2021 10:56:04 +0000 (12:56 +0200)] 
core/service: modernization

5 years agotest-bpf-foreign-programs: fix message
Zbigniew Jędrzejewski-Szmek [Mon, 10 May 2021 10:54:52 +0000 (12:54 +0200)] 
test-bpf-foreign-programs: fix message

5 years agodocs/HACKING: wrap long lines
Zbigniew Jędrzejewski-Szmek [Mon, 10 May 2021 06:35:21 +0000 (08:35 +0200)] 
docs/HACKING: wrap long lines

5 years agosd-event: tweak comments
Zbigniew Jędrzejewski-Szmek [Sat, 8 May 2021 09:40:47 +0000 (11:40 +0200)] 
sd-event: tweak comments

5 years agotimedated: make ntp_synced() static
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 07:39:28 +0000 (09:39 +0200)] 
timedated: make ntp_synced() static

No need to have this in basic.

5 years agoMerge pull request #18986 from poettering/oomd-varlink-fix
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 09:36:32 +0000 (11:36 +0200)] 
Merge pull request #18986 from poettering/oomd-varlink-fix

varlink ref fix

5 years agoMerge pull request #19506 from xnox/ship-stub-elf
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 07:45:36 +0000 (09:45 +0200)] 
Merge pull request #19506 from xnox/ship-stub-elf

boot/efi: install ELF linux.elf.stub in addition to PE linux.efi.stub

5 years agoMerge pull request #19581 from yuwata/specifier-refuse-too-long-results
Lennart Poettering [Wed, 12 May 2021 07:42:08 +0000 (09:42 +0200)] 
Merge pull request #19581 from yuwata/specifier-refuse-too-long-results

specifier: refuse too long results

5 years agonetlink,network: drop "const" from opaque object parameters in supposed-to-be-public...
Lennart Poettering [Tue, 11 May 2021 15:08:00 +0000 (17:08 +0200)] 
netlink,network: drop "const" from opaque object parameters in supposed-to-be-public APIs

This drops the "const" specifier from the opaque object parameters to
various functions in our API.

This effectively reverts #19292 and more.

Why drop this? Our public APIs should not leak too much information
about how stuff is implemented internally. In our public APIs we
shouldn't give too many guarantees we don#t want to necessarily keep.
Specifically: in many cases it makes sense that getters actually
generate/parse/allocate data on the fly, storing/caching the result
internally, to speed things up, do things lazily or to track memory
allocations so that they can be freed later. Doing this means we need to
change the objects, even though the getters are semantically a read
operation.

We want to retain the freedom that we can change things around
internally. By exposing the objects as "const" we remove a good chunk of
that, for little gain.

See sd_bus_creds_get_description() for a real example of a getter that
implicitly caches and thus modifies the relevant object.

This removes the "const" decorators from sd-dhcp and sd-netlink, two
APIs that we intend to make public eventually even though they still are
not, leaving us the chance to still fix this before it becomes set in
stone.

5 years agotest-network: wait for the interfaces are configured after reloading .network files 19533/head
Yu Watanabe [Wed, 5 May 2021 14:05:02 +0000 (23:05 +0900)] 
test-network: wait for the interfaces are configured after reloading .network files

5 years agotest-network: wait for the intreface is configured if it is expected
Yu Watanabe [Wed, 5 May 2021 14:04:24 +0000 (23:04 +0900)] 
test-network: wait for the intreface is configured if it is expected

5 years agonetwork: make route_configure() return all created routes
Yu Watanabe [Thu, 29 Apr 2021 14:18:29 +0000 (23:18 +0900)] 
network: make route_configure() return all created routes

5 years agonetwork: make log_route_debug() show multipath routes and Gateway=_dhcp4 or _ipv6ra
Yu Watanabe [Thu, 29 Apr 2021 14:30:51 +0000 (23:30 +0900)] 
network: make log_route_debug() show multipath routes and Gateway=_dhcp4 or _ipv6ra

5 years agonetwork: use request queue to configure addresses, routes, and nexthops
Yu Watanabe [Wed, 5 May 2021 13:46:44 +0000 (22:46 +0900)] 
network: use request queue to configure addresses, routes, and nexthops

Why is this necessary? Several examples below.

- When a route sets prefsrc, then the address must be already assigned
  (see issue #19285), and also it must be ready if IPv6.
- When a route or nexthop sets gateway, then the address must be reachable.
- When a route sets nexthop ID, then the corresponding nexthop must be
  assigned.
- When a route sets multipath routes on another interface, then the
  interface must exist and be ready to configure.
- When configuring address, the same address must not be under removing
  (see issue #18108).
Etc,. etc,...

So, this makes all requests about addresses, routes, and nethops are once
stored in the queue, and will be processed when they are ready to configure.

Fixes #18108 and #19285.

5 years agonetwork: use request queue to configure neighbors
Yu Watanabe [Fri, 7 May 2021 07:05:31 +0000 (16:05 +0900)] 
network: use request queue to configure neighbors

5 years agonetwork: use request queue to configure routing policy rules
Yu Watanabe [Fri, 7 May 2021 06:57:13 +0000 (15:57 +0900)] 
network: use request queue to configure routing policy rules

5 years agonetwork: introduce link_is_ready_to_configure() helper function
Yu Watanabe [Fri, 7 May 2021 06:45:28 +0000 (15:45 +0900)] 
network: introduce link_is_ready_to_configure() helper function

This will be used in later commits.

5 years agonetwork: add skeleton of request queue
Yu Watanabe [Fri, 7 May 2021 06:39:16 +0000 (15:39 +0900)] 
network: add skeleton of request queue

This will be used in later commits.

5 years agonetwork: nexthop: add NextHop object before sending netlink request
Yu Watanabe [Fri, 7 May 2021 11:52:49 +0000 (20:52 +0900)] 
network: nexthop: add NextHop object before sending netlink request

Otherwise, if nexthop_add() fails, then assertion about nexthop_messages in
static_nexthop_handler() will be triggered.

5 years agonetwork: split out common part of route or address handlers
Yu Watanabe [Fri, 7 May 2021 08:32:51 +0000 (17:32 +0900)] 
network: split out common part of route or address handlers

5 years agonetwork: change order of dropping network configs
Yu Watanabe [Fri, 7 May 2021 07:35:42 +0000 (16:35 +0900)] 
network: change order of dropping network configs

As routes may requires nexthops and addresses, nexthops may requires
addresses.

5 years agonetwork: simplify and rename routing_policy_rule_copy()
Yu Watanabe [Thu, 6 May 2021 20:16:32 +0000 (05:16 +0900)] 
network: simplify and rename routing_policy_rule_copy()

5 years agonetwork: introduce route_dup()
Yu Watanabe [Thu, 6 May 2021 19:47:26 +0000 (04:47 +0900)] 
network: introduce route_dup()

The function will be used in later commits.

5 years agosd-netlink: introduce multipath_route_dup()
Yu Watanabe [Thu, 6 May 2021 19:45:02 +0000 (04:45 +0900)] 
sd-netlink: introduce multipath_route_dup()

The function will be used in later commits.

5 years agonetwork: introduce manager_address_is_reachable()
Yu Watanabe [Thu, 6 May 2021 19:37:58 +0000 (04:37 +0900)] 
network: introduce manager_address_is_reachable()

The function will be used in later commits.

5 years agonetwork: introduce link_has_route()
Yu Watanabe [Thu, 6 May 2021 19:31:20 +0000 (04:31 +0900)] 
network: introduce link_has_route()

The function will be used in later commits.

5 years agonetwork: delay resolving interface specifier in MultiPathRoute=
Yu Watanabe [Thu, 6 May 2021 19:29:52 +0000 (04:29 +0900)] 
network: delay resolving interface specifier in MultiPathRoute=

The interface may not exist when .network files are loaded.

5 years agonetwork: introduce manager_has_address()
Yu Watanabe [Thu, 6 May 2021 19:03:21 +0000 (04:03 +0900)] 
network: introduce manager_has_address()

The function will be used in later commits.

5 years agoordered-set: introduce ordered_set_clear/free_with_destructor()
Yu Watanabe [Mon, 26 Apr 2021 14:52:40 +0000 (23:52 +0900)] 
ordered-set: introduce ordered_set_clear/free_with_destructor()

5 years agohashmap,set: make hashmap_clear_with_destructor() or friends safer
Yu Watanabe [Sat, 8 May 2021 06:32:52 +0000 (15:32 +0900)] 
hashmap,set: make hashmap_clear_with_destructor() or friends safer

5 years agonetwork: use IPV4_ADDRESS_FMT_STR/VAL macros and in6_addr_to_string() or friends
Yu Watanabe [Thu, 6 May 2021 08:15:01 +0000 (17:15 +0900)] 
network: use IPV4_ADDRESS_FMT_STR/VAL macros and in6_addr_to_string() or friends

5 years agoin-addr-util: move IPV4_ADDRESS_FMT_STR/VAL macros from networkd-address.h
Yu Watanabe [Thu, 6 May 2021 07:21:18 +0000 (16:21 +0900)] 
in-addr-util: move IPV4_ADDRESS_FMT_STR/VAL macros from networkd-address.h

5 years agoin-addr-util: introduce in6_addr_to_string() or friends
Yu Watanabe [Thu, 6 May 2021 07:17:47 +0000 (16:17 +0900)] 
in-addr-util: introduce in6_addr_to_string() or friends

5 years agonetwork: use in6_addr_is_link_local() or friends
Yu Watanabe [Thu, 6 May 2021 07:11:33 +0000 (16:11 +0900)] 
network: use in6_addr_is_link_local() or friends

5 years agonetwork: rename routing_policy_rule_configure_internal() and make it take callback
Yu Watanabe [Mon, 26 Apr 2021 07:10:39 +0000 (16:10 +0900)] 
network: rename routing_policy_rule_configure_internal() and make it take callback

5 years agonetwork: make nexthop_configure() take callback
Yu Watanabe [Mon, 26 Apr 2021 07:05:04 +0000 (16:05 +0900)] 
network: make nexthop_configure() take callback

5 years agonetwork: make neighbor_configure() take callback
Yu Watanabe [Mon, 26 Apr 2021 07:04:07 +0000 (16:04 +0900)] 
network: make neighbor_configure() take callback

5 years agotree-wide: refuse too long strings earlier in specifier_printf() 19581/head
Yu Watanabe [Sun, 9 May 2021 16:46:48 +0000 (01:46 +0900)] 
tree-wide: refuse too long strings earlier in specifier_printf()

We usually call specifier_printf() and then check the validity of
the result. In many cases, validity checkers, e.g. path_is_valid(),
refuse too long strings. This makes specifier_printf() refuse such
long results earlier.

Moreover, unit_full_string() and description field in sysuser now
refuse results longer than LONG_LINE_MAX. config_parse() already
refuses the line longer than LONG_LINE_MAX. Hence, it should be ok
to set the same value as the maximum length of the resolved string.

5 years agodns-domain: use DNS_LABEL_MAX at one more place
Yu Watanabe [Wed, 12 May 2021 01:12:18 +0000 (10:12 +0900)] 
dns-domain: use DNS_LABEL_MAX at one more place

5 years agocreds-util: introduce CREDENTIAL_NAME_MAX
Yu Watanabe [Wed, 12 May 2021 01:20:47 +0000 (10:20 +0900)] 
creds-util: introduce CREDENTIAL_NAME_MAX

5 years agofd-util: introduce FDNAME_MAX
Yu Watanabe [Wed, 12 May 2021 01:19:19 +0000 (10:19 +0900)] 
fd-util: introduce FDNAME_MAX

5 years agogpt: introduce GPT_LAVEL_MAX
Yu Watanabe [Wed, 12 May 2021 01:16:36 +0000 (10:16 +0900)] 
gpt: introduce GPT_LAVEL_MAX

5 years agotest: move test_specifier_printf() to test-specifier.c
Yu Watanabe [Sun, 9 May 2021 15:13:14 +0000 (00:13 +0900)] 
test: move test_specifier_printf() to test-specifier.c

5 years agospecifier: rename variable
Yu Watanabe [Sun, 9 May 2021 12:39:34 +0000 (21:39 +0900)] 
specifier: rename variable

5 years agospecifier: use SD_ID128_STRING_MAX
Yu Watanabe [Sun, 9 May 2021 12:23:32 +0000 (21:23 +0900)] 
specifier: use SD_ID128_STRING_MAX

5 years agocore: don't accidentally unref a varlink connection twice 18986/head
Lennart Poettering [Fri, 12 Mar 2021 21:21:58 +0000 (22:21 +0100)] 
core: don't accidentally unref a varlink connection twice

Let's make sure that our close handler unrefs a connection again that we
are already unreffing a few stack frames up by invalidating the pointer
first, and dropping the ref counter only after that.

Replaces: 39ad3f1c092b5dffcbb4b1d12eb9ca407f010a3c

Fixes: #18025
5 years agoRevert "varlink: avoid using dangling ref in varlink_close_unref()"
Lennart Poettering [Fri, 12 Mar 2021 21:21:40 +0000 (22:21 +0100)] 
Revert "varlink: avoid using dangling ref in varlink_close_unref()"

This reverts commit 39ad3f1c092b5dffcbb4b1d12eb9ca407f010a3c.

5 years agocgroup: drop explicit NULL comparisons 19567/head
Lennart Poettering [Mon, 10 May 2021 15:47:32 +0000 (17:47 +0200)] 
cgroup: drop explicit NULL comparisons

5 years agotree-wide: move variables to innermost scope
Lennart Poettering [Mon, 10 May 2021 15:47:19 +0000 (17:47 +0200)] 
tree-wide: move variables to innermost scope

5 years agotree-wide: use af_to_ipv4_ipv6() + af_from_ipv4_ipv6() helpers at various places
Lennart Poettering [Mon, 10 May 2021 15:24:48 +0000 (17:24 +0200)] 
tree-wide: use af_to_ipv4_ipv6() + af_from_ipv4_ipv6() helpers at various places

5 years agoaf-list: add helpers mapping AF_INET/AF_INET6 to "ipv4"/"ipv6"
Lennart Poettering [Mon, 10 May 2021 15:14:13 +0000 (17:14 +0200)] 
af-list: add helpers mapping AF_INET/AF_INET6 to "ipv4"/"ipv6"

5 years agosocket-bind: use lowercase "ipv4"/"ipv6" spelling
Lennart Poettering [Mon, 10 May 2021 14:33:24 +0000 (16:33 +0200)] 
socket-bind: use lowercase "ipv4"/"ipv6" spelling

In most of our codebase when we referenced "ipv4" and "ipv6" on the
right-hand-side of an assignment, we lowercases it (on the
left-hand-side we used CamelCase, and thus "IPv4" and "IPv6"). In
particular all across the networkd codebase the various "per-protocol
booleans" use the lower-case spelling. Hence, let's use lower-case for
SocketBindAllow=/SocketBindDeny= too, just make sure things feel like
they belong together better.

(This work is not included in any released version, hence let's fix this
now, before any fixes in this area would be API breakage)

Follow-up for #17655

5 years agobootctl: same entry path check case-insensitive
zsien [Mon, 10 May 2021 07:42:54 +0000 (15:42 +0800)] 
bootctl: same entry path check case-insensitive

Some motherboards convert the path to uppercase under certain circumstances
(e.g. after booting into the Boot Menu in the ASUS ROG STRIX B350-F GAMING).