Commit graph

71196 commits

Author SHA1 Message Date
Mike Yuan 783e816e81
logind-dbus: rearrange functions 2024-02-21 15:50:13 +08:00
Mike Yuan d536e8b5e9
logind-session-dbus: drop unneeded unref_and_replace
If there's pending s->upgrade_message, we already return early
above.
2024-02-21 15:37:33 +08:00
Yu Watanabe 3c6d9d1c39
Merge pull request #31405 from yuwata/network-ndisc-reachable-time
network/ndisc: set neighbor reachable time
2024-02-21 14:29:01 +09:00
Mike Yuan e404ca3eb7
Merge pull request #31419 from AdrianVovk/fixup-largefile-define
Fixup largefile define
2024-02-21 13:12:30 +08:00
Yu Watanabe 9e39d0a32a
Merge pull request #31408 from mrc0mmand/verify-unit-files-v2
test: verify our own units (where applicable)
2024-02-21 12:01:48 +09:00
Luca Boccassi 5605b7d61a
Merge pull request #31400 from poettering/askpw-rework
Password Asking rework
2024-02-20 23:45:52 +00:00
Adrian Vovk e4d0606c2b
fd-util: Add helpers to check if FD flags are safe
Adds a SAFE_FD_FLAGS define to list out all the safe FD flags, and also
an UNSAFE_FD_FLAGS() macro to strip out the safe flags and leave only
the unsafe flags. This can be used to quickly check if any unsafe flags
are set and print them for diagnostic purposes
2024-02-20 15:01:37 -05:00
Adrian Vovk 9e3db91f2f
missing_fcntl: Fix RAW_O_LARGEFILE
This value is actually arch-specific, so this commit defines it for all
the arches that set it to some custom value

Fixes https://github.com/systemd/systemd/issues/31417
2024-02-20 15:01:36 -05:00
Zbigniew Jędrzejewski-Szmek 0615abef62 analyze: always recommend saving the output to a file
The command will refuse to write to a TTY, so give a strong hint
that redirecting to a file is recommended. This makes the synopsis,
man page text, and --help output consistent.

Also drop the space after the redirection operator everywhere.
2024-02-20 19:35:58 +00:00
Lennart Poettering b2ac928088 cryptsetup: drop "headless" bool, make it a flag in AskPasswordFlags instead
This bool controls whether we should interactively ask for a password,
which is pretty much what the ask_password-api.c APIs are about. Hence,
just make the bool a flag in AskPasswordFlags enum, and use it
everywhere.

This still catches the flag early in upper levels of the codebase,
exactly as before, but if the flag is still present in the lower layers
it's also handled there and results in ENOEXEC if seen.

This is mostly an excercise in simplifying our ridiculously long
function call parameter lists a bit.
2024-02-20 16:50:04 +01:00
Lennart Poettering 732285eb8c man: tweak cryptsetup credentials docs a bit
Let's bring the credentials into a better order, in order of relevance.

Also, let's clarify what the generic LUKS PIN is about.

Finally, list the credentials in system-credentials(7) too, after all
people might want to unlock a disk with this via SMBIOS Type 11 or so.
2024-02-20 16:50:00 +01:00
Lennart Poettering 0fceb5539d man: now that the crdentials used by systemd-cryptenroll are in order, document them
Replaces: #31370
2024-02-20 16:50:00 +01:00
Lennart Poettering 1c12daa46f cryptsetup-pkcs11: also plug credential name to use to credential plugin 2024-02-20 16:50:00 +01:00
Lennart Poettering b3a635841a cryptenroll,cryptsetup: clean up unlock credential for TPM2 + FIDO2
Let's make sure that when cryptenroll asks for the TPM2 or FIDO2 token
PIN it uses cryptenroll.* credential namespace, and cryptsetup uses
cryptsetup.*.
2024-02-20 16:50:00 +01:00
Lennart Poettering a96c284f10 pkcs11-util: clean up credential handling for PKCS11 PIN
similar as the previous commit, let's clean up the credential name we
use. Use home.token-pin in case of homectl, and cryptenroll.pkcs11-pin
in case of cryptenroll.
2024-02-20 16:50:00 +01:00
Lennart Poettering 7252be6083 cryptenroll: use a different credential for new new PIN
The TPM2 enrollment is the only of the three token enrollments where the
user picks a PIN at enrollment time (the others have a PIN set for the
token, not for the enrollment). Let's make sure it uses a different
credential for retrieving this PIN, in order to make sure people can
programmatically change PINs via credentials (in which case they need to
supply both).
2024-02-20 16:50:00 +01:00
Lennart Poettering 251c71b62b libfido2: tweak credential to read fido2 PIN from
Querying a fido2 PIN via askpw for enrolling is currently used in two
places: cryptenroll and homectl. So far we sloppily used the same fixed
credential name "fido2-pin" in both cases. Let's tweak that and make the
credential name match the other credentials cryptenroll or home query,
i.e. using the cryptenroll.* and home.* namespaces.

This is particular done in light of #31370, which wants to make the
credential name public. We really should get the name in order before
making it public.
2024-02-20 16:50:00 +01:00
Lennart Poettering 09eed3bf8c pcrlock: normalize credential name for TPM2 PIN
Let's drop the "systemd-" prefix from the credential name. We do not
prefix credentials that way so far. Don't do so here either.

The name is not really API, it's not documented, hence change it now
where we still can.
2024-02-20 16:50:00 +01:00
Lennart Poettering 6278a8655f cryptenroll: use correct askpw id for pw request
The "id" is used in the askpw protocol to recognize password prompts, in
case a service is replying to them and needs some id. Previously we set
an incorrect id, the one of cryptsetup. Fix that.

(I guess the id is not used much, it comes from a time where we had no
credentials, and thus some people wanted to supply passphrases
programmatically rather interactively. The usecase is probably gone, but
we should still set some valid id I guess.)
2024-02-20 16:50:00 +01:00
Lennart Poettering 6b3a907764 dissect-image: use strv_free_erase() at one more place 2024-02-20 16:50:00 +01:00
Lennart Poettering 05569104bd cryptenroll: fix type confusion on acquire_tpm2_key() parameter 2024-02-20 16:50:00 +01:00
Lennart Poettering d08fd4c314 ask-password: rework how we pass request meta info when asking passwords
Rather than adding more and more parameters to ask_password_auto(), let's
pass a structure of the fields that often are constant anyway.

This way, callers can fill in what they need, and we take the filled
structure which we can pass around internally as one.

This is in particular preparation for adding one more field in one of
the next commits.
2024-02-20 16:50:00 +01:00
Mike Yuan 8e94bb62a5 core/mount: if umount(8) fails but mount disappeared, assume success
Fixes #31337
2024-02-20 16:22:27 +01:00
Frantisek Sumsal 5083e42765 test: verify our own units (where applicable)
This is inspired by one of our internal tests that does pretty much the
same thing. However, it is slightly more convoluted than I'd like it to
be, since I really don't want to duplicate the list of our units in
another place, so we need to, somehow, pass the list from the meson file
to the test script. I originally envisioned this to be a part of the
unit test suite, but this doesn't work for unit files with absolute
paths to binaries, as we'd have to install the build first (maybe using
a chroot would work?).

It doesn't check man pages (since they might not be installed on the
test machine) and also skip recursive dependencies (as that would trip
over issues in files that are not under our direct control), but it
should still cover typos and such.

There are currently two units for which the check had to be disabled -
syslog.socket, as the corresponding syslog.service might not be
installed, and rc-local.service as that's a compat API and the necessary
/etc/rc.d/rc.local file may not (and most likely won't be) present.
2024-02-20 15:45:50 +01:00
Zmyeir 8a461c572b hwdb: Add support for MetawillBook01 to 60-sensor.hwdb
Add accel orientation quirk for the METAPHYUNI MetawillBook01 2-in-1 laptop
2024-02-20 15:10:47 +01:00
MrSmör 8b6cfbd2b8 boot: padding for default arrow at too long lines
If the default boot entry name doesnt leave enough space for the
indicator arrow, it overwrote the first two characters of the entry

Now every line will always have enough padding.
2024-02-20 14:36:52 +01:00
Frantisek Sumsal 3e7b1b5cb9 test: fix mixed indent 2024-02-20 13:31:00 +01:00
Frantisek Sumsal a69ec6fb02 test: support TEST_MATCH_* stuff in TEST-23-UNIT-FILE as well
TEST-23 uses run_subtests_with_signals() which I forgot about when
introducing the change.

Follow-up for 0efa27bd4b.
2024-02-20 13:31:00 +01:00
Luca Boccassi ce3fa3863d
Merge pull request #31388 from keszybz/bitfield-cleanup
Bitfield cleanup
2024-02-20 12:15:24 +00:00
Yu Watanabe 142f0e9517 analyze: skip to check ExecCommand for .mount and .swap units
They are not set by a unit file, but dynamically generated.

Fixes a bug caused by abf0ccc1c6.

Fixes #31396.
2024-02-20 11:59:10 +00:00
Zbigniew Jędrzejewski-Szmek 6169bb19a9 logind: drop bitfield annotations
As in other cases, this is simpler but better.

pahole:
-	/* size: 336, cachelines: 6, members: 50 */
-	/* sum members: 316, holes: 4, sum holes: 19 */
-	/* sum bitfield members: 4 bits, bit holes: 1, sum bit holes: 4 bits */
-	/* last cacheline: 16 bytes */
+	/* size: 328, cachelines: 6, members: 50 */
+	/* sum members: 320, holes: 3, sum holes: 8 */
+	/* last cacheline: 8 bytes */
2024-02-20 10:42:36 +01:00
Zbigniew Jędrzejewski-Szmek d53017292e timesyncd: reorder structs instead of useless bitfields
Because of alignment, those bitfields were not doing anything useful,
and were causing the generated code to be more complicated. But in this
case, at least potentially there might be a number of copies of those
structs (if we have a bunch of time servers configured), so let's actually
implement the intended space savings by reording the fields to reduce the
size of holes.
2024-02-20 10:41:09 +01:00
Zbigniew Jędrzejewski-Szmek 611a6d15cb systemctl: drop pointless bitfield 2024-02-20 10:41:09 +01:00
Zbigniew Jędrzejewski-Szmek 6e2be1d97a sysupdate: drop pointless bitfields
Again, even without considering how many copies of the struct there
can be, this bitfield is useless because of alignment.
2024-02-20 10:41:09 +01:00
Zbigniew Jędrzejewski-Szmek 0a35e7f6be core/kmod-setup: drop another pointless bitfield annotation
We have two bools followed by a func pointer, which is aligned to e.g. 8 bytes,
so whether the two bools take one bit, one byte, or even a full word, makes no
difference in storage size. But the code generated to service a bitfield is
more complicated.

Also switch to FOREACH_ARRAY().
2024-02-20 10:40:59 +01:00
Yu Watanabe 1452d49741 network/ndisc: set IPv6 neighbor reachable time
Closes #31402.
2024-02-20 15:31:39 +09:00
Yu Watanabe a68f007a23 sd-ndisc: introduce sd_ndisc_router_get_reachable_time() 2024-02-20 15:31:39 +09:00
Yu Watanabe ffef01acdd network/ndisc: ignore most fields of RA header when lifetime is zero 2024-02-20 15:31:39 +09:00
Yu Watanabe 479d3e1994 network/ndisc: drop configurations when received RA with zero lifetime 2024-02-20 15:31:39 +09:00
Yu Watanabe 828b5dbf2f sd-ndisc: allow to call sd_ndisc_router_get_lifetime() with NULL for 'ret' 2024-02-20 15:31:39 +09:00
Yu Watanabe 787e71e432 sd-ndisc: introduce sd_ndisc_is_running() 2024-02-20 15:30:49 +09:00
Yu Watanabe ca34b43481 sd-ndisc: split sd-ndisc.h into small pieces 2024-02-20 15:30:49 +09:00
runiq 793166aea5 udev: String substitutions can be done in ENV, too
Precedence for example in ac63c8df30/rules.d/99-systemd.rules.in (L75).

Add ENV to the list of keys where string substitutions can be used.

While I'm at it, also sort the list in that paragraph alphabetically.
2024-02-20 13:10:30 +09:00
Yu Watanabe 4b6d8de09c home: fix typo
Follow-up for 25c89b8977 and
a4d72746c7.
2024-02-20 09:25:30 +09:00
Yu Watanabe 5ad2874b24 vconsole-setup: fix typo
Follow-up for 190ff0d0a8.
2024-02-20 09:23:18 +09:00
Yu Watanabe c6c7c461a3 resolve: several follow-ups for resolving service via varlink
Follow-ups for e1634bb832.

- Allow to call the method without "name" and "type".
- Allow to specify SD_RESOLVE_NO_TXT and SD_RESOLVE_NO_ADDRESS.
- Allow to provide multiple services, and fix memory leak.
- Rearrange the return value format.
- Encode TXT field with octescape() to make the field matches with the
  io.systemd.Resolve.Monitor interface.

Fixes #31371.
2024-02-19 22:13:07 +01:00
Antonio Alvarez Feijoo d0a0059c21 gpt-auto-generator: fix argument passed to parse_image_policy_argument
Otherwise:

```
Feb 19 16:35:34 localhost systemd-gpt-auto-generator[188]: Assertion 's' failed at src/shared/image-policy.c:656, function parse_image_policy_argument(). Aborting.
```

Fixes 06e78680e3
2024-02-19 19:24:25 +00:00
Luca Boccassi f927b872d6
Merge pull request #31351 from YHNdnzj/exit-status-no-executable
core/exec-invoke: record correct exit status when failed to locate executable
2024-02-19 19:17:31 +00:00
Daan De Meyer 5b54fe8d6d pkcs11-util: Explicitly initiaiize variable to avoid warning
Avoid the following warning on C9S by explicitly initializing
"object".

"""
[389/2801] Compiling C object src/shared/libsystemd-shared-256-devel.a.p/pkcs11-util.c.o
../src/src/shared/pkcs11-util.c: In function ‘pkcs11_token_find_private_key’:
../src/src/shared/pkcs11-util.c:983:21: warning: ‘object’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  983 |         *ret_object = object;
      |         ~~~~~~~~~~~~^~~~~~~~
"""
2024-02-19 18:37:36 +00:00
Lennart Poettering 33b9337130 cgroup: typo fix initial_restric_ifaces_link_fds → initial_restrict_ifaces_link_fds 2024-02-19 19:18:21 +01:00