Commit graph

61501 commits

Author SHA1 Message Date
Yu Watanabe d3bee9f300 hwdb: add comments about matching entries
Follow-up for 57bb707d48.

This makes the comments in 60-evdev.hwdb, 60-keyboard.hwdb, and
70-pointingstick.hwdb consistent.
2022-12-14 01:50:07 +09:00
Yu Watanabe c31e7bf07d hwdb: drop trailing space 2022-12-14 01:45:10 +09:00
Yu Watanabe ab84b9efb8
Merge pull request #25658 from yuwata/fuzz-etc-hosts
resolve: dedup entries in /etc/hosts
2022-12-14 01:44:12 +09:00
Zbigniew Jędrzejewski-Szmek c5966ab5bf coredump: cescape invalid json data before logging
In both cases, the json string is short, so we can print it, which is useful
for diagnosing invalid data in packages. But we need escape non-printable
characters.

https://bugzilla.redhat.com/show_bug.cgi?id=2152685

I went over the rest of the codebase, and it seems that other calls to
json_parse() don't have this problem.
2022-12-14 01:37:19 +09:00
AndyChi e4970f5dae
hwdb: Add additional Dell models that require ACCEL_LOCATION=base (#25724) 2022-12-14 00:19:27 +09:00
January 5537165879 doc: add an example code to lock the whole disk
add an example to leverage `libsystemd` infrastructure to get the whole disk of a block device and take BSD lock on it #25046
2022-12-13 14:55:57 +01:00
Daan De Meyer 661e4251a5 execute: Pass AT_FDCWD instead of -1
Let's enforce that callers pass AT_FDCWD as read_dfd to load_credential()
to avoid an assert() in read_full_file_full() if read_dfd is -1.
2022-12-13 22:00:34 +09:00
Daan De Meyer 99173cafbe mkosi: Drop i686 packages
These are only needed for some kernel selftests but they prevent
building the mkosi image on aarch64 systems so let's drop them
until mkosi has support for conditional configuration so we can
only add these packages on the right architecture.
2022-12-13 22:00:04 +09:00
Yu Watanabe 16a6bc5a7a resolve: dedup entries in /etc/hosts
This improves the performance of parsing the file and reduces memory pressure.

Running 'fuzz-etc-hosts timeout-strv' with valgrind,

Before:
total heap usage: 321,020 allocs, 321,020 frees, 15,820,387,193 bytes allocated
real    0m23.531s
user    0m21.458s
sys     0m1.961s

After:
total heap usage: 112,408 allocs, 112,408 frees, 7,297,480 bytes allocated
real    0m8.664s
user    0m8.545s
sys     0m0.065s

Hopefully fixes oss-fuzz#47708 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47708).
2022-12-13 20:37:48 +09:00
Yu Watanabe 59dad407a2 resolve: introduce more hash-ops and use them
No functional changes, just refactoring.
2022-12-13 20:37:48 +09:00
Yu Watanabe 232481a0e6 resolve: use dns_name_hash_ops_free
No functional changes, just refactoring.
2022-12-13 20:37:04 +09:00
Yu Watanabe 3deed83ae2 dns-domain: introduce dns_name_hash_ops_free
Preparation for later commits.
2022-12-13 20:32:44 +09:00
Yu Watanabe 4596c83658 in-addr-util: introduce in_addr_data_hash_ops_free and expose its compare and hash functions
Preparation for later commits.
2022-12-13 20:32:44 +09:00
Yu Watanabe 0f17886390 resolve: split manager_etc_hosts_lookup() into small parts
No functional changes, just refactoring.
2022-12-13 20:32:00 +09:00
Yu Watanabe 10b0c81802 resolve: adjust warning 2022-12-13 20:29:16 +09:00
Yu Watanabe 9f1a1f2047 resolve: merge two boolean variables
No functional changes, just refactoring.
2022-12-13 20:29:16 +09:00
Yu Watanabe e4e340990f resolve: introduce cleanup functions for EtcHostsItemBy{Address,Name}
No functional change, just refactoring and preparation for later
commits.
2022-12-13 20:29:16 +09:00
Yu Watanabe bb5c77305e resolve: make etc_hosts_item_by_{address,name}_free() accept NULL 2022-12-13 20:29:12 +09:00
Yu Watanabe 133eedad2b resolve: rename EtcHostsItem -> EtcHostsItemByAddress 2022-12-13 20:26:55 +09:00
Yu Watanabe 0f7bdf3503 resolve: rename etc_hosts_free() -> etc_hosts_clear() 2022-12-13 20:26:55 +09:00
Yu Watanabe 10b89c59dc
Merge pull request #25713 from keszybz/hwdb-matching
Restore backwards compat in 60-evdev.rules
2022-12-13 18:13:27 +09:00
Peter Cai e6319a102e cryptsetup-fido2: Try all FIDO2 key slots when opening LUKS volume
After #25268, it is now possible to check whether a credential
is present on a FIDO2 token without actually attempting to retrieve said
credential. However, when cryptsetup plugins are not enabled, the
fallback unlock routines are not able to make multiple attempts with
multiple different FIDO2 key slots.

Instead of looking for one FIDO2 key slot when trying to unlock, we now
attempt to use all key slots applicable.

Fixes #19208.
2022-12-12 21:48:39 +01:00
Luca Boccassi d41789edc5
Merge pull request #25375 from PeterCxy/fido2-fixups
Fixups for FIDO2 pre-flight checks
2022-12-12 21:48:09 +01:00
uerdogan d8100dd17e
Update 60-evdev.hwdb (#25704)
This solves Debian Bug report 1008760:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008760.

Solution was inspired by this kernel bug report message:
https://bugzilla.kernel.org/show_bug.cgi?id=204967#c15.

My measured pad dimensions with a ruler were 85x44mm.
But I decided to take the 2x size reported by the current kernel
when invoking the touchpad-edge-detector command from the
libdev-tools package. Because this comment claims that the old
vs new kernel reportings differ by factor 2:
https://bugzilla.kernel.org/show_bug.cgi?id=204967#c3 .

Therefore I have used this command to get the new entry to 60-evdev.hwdb:

"root@pb:~# touchpad-edge-detector 80x34 /dev/input/event2
Touchpad ETPS/2 Elantech Touchpad on /dev/input/event2

Move one finger around the touchpad to detect the actual edges
Kernel says:	x [0..1254], y [0..528]
Touchpad sends:	x [0..2472], y [-524..528] -^C

Touchpad size as listed by the kernel: 40x17mm
User-specified touchpad size: 80x34mm
Calculated ranges: 2472/1052

Suggested udev rule:
# <Laptop model description goes here>
evdev:name:ETPS/2 Elantech Touchpad:dmi:bvnPackardBell:bvrV1.21:bd08/09/2012:br21.240:svnPackardBell:pnEasyNoteTS11HR:pvrV1.21:rvnPackardBell:rnSJV50_HR:rvrBaseBoardVersion:cvnPackardBell:ct10:cvrV1.21:*
 EVDEV_ABS_00=0:2472:31
 EVDEV_ABS_01=-524:528:31
 EVDEV_ABS_35=0:2472:31
 EVDEV_ABS_36=-524:528:31
"
2022-12-12 20:46:50 +00:00
Zbigniew Jędrzejewski-Szmek f8717d2a72 udevadm: emit deprecation notice in udevadm hwdb
This tool was "deprecated" back in 65eb4378c3,
but only by removing documentation. This is somewhat surprising, but udevadm
hwdb --update and systemd-hwdb update generate different databases. udevadm
runs in compat mode and (as far as I have been able to figure out from a quick
look), it omits filename information and does some other changes to the
datastructures. The consuming code (udev) is the same in both cases, so this
"compatibility mode" seems very strange. But I don't think it's worth trying to
figure out why things were done this way. Let's just push people towards the
new code.

Inspired by https://github.com/systemd/systemd/issues/25698#issuecomment-1346298094.
2022-12-12 21:45:28 +01:00
Will Fancher 01fdfbb82c sysroot: Support x-systemd.makefs 2022-12-12 21:45:06 +01:00
Luca Boccassi b8b84c6e5e
Merge pull request #25646 from yuwata/sd-id128-enomedium
sd-id128: make sd_id128_get_machine() return -ENOMEDIUM when not initialized
2022-12-12 21:42:36 +01:00
Lennart Poettering e591cd5c8a update TODO 2022-12-12 15:44:29 +01:00
Luca Boccassi de1b92ebe1
Merge pull request #25615 from DaanDeMeyer/mkosi-kconfig
mkosi: Rework kconfig handling
2022-12-12 15:30:07 +01:00
Luca Boccassi 97ad3e6a2c
Merge pull request #25692 from yuwata/resolve-rr-txt
resolve: drop recurstion from TXT field handling
2022-12-12 14:13:16 +01:00
Yu Watanabe b40c8ebdc8 sd-id128: fold do_sync flag into Id128FormatFlag 2022-12-12 22:07:48 +09:00
Yu Watanabe c576920e67 man: mention that sd_id128_get_boot() and friend may return -ENOSYS
And drop to mention sd_id128_get_boot_app_specific() may return -ENOENT
or -ENOMEDIUM. The function does not read /etc/machine-id. But reads a
file in the procfs, which is a kind of the kernel API. Hence the
failures are caused only when the system has wrong setup.
2022-12-12 22:06:35 +09:00
Yu Watanabe e2720340e9 sd-id128: make sd_id128_get_boot() and friend return -ENOSYS when /proc/ is not mounted 2022-12-12 22:04:53 +09:00
Yu Watanabe 9be90c401e sd-id128: make sd_id128_get_boot() and friend return -ENOMEDIUM 2022-12-12 22:04:53 +09:00
Yu Watanabe a237c6e0b0 man: mention sd_id128_get_machine() or friend may return -ENOPKG 2022-12-12 21:57:31 +09:00
Yu Watanabe 66c7949e08 test: add tests for "uninitialized" string handling by id128_read_fd() 2022-12-12 21:57:31 +09:00
Yu Watanabe 057bf780e9 sd-id128: make id128_read() or friends return -ENOPKG when the file contents is "uninitialized"
Then, this drops ID128_PLAIN_OR_UNINIT. Also, this renames
Id128Format -> Id128FormatFlag, and make it bitfield.

Fixes #25634.
2022-12-12 21:57:31 +09:00
Yu Watanabe 28bf2de201 sd-id128: several cleanups
- use SD_ID128_STRING_MAX or friend,
- use sizeof(sd_id128_t),
- use newly introduced ascii_ishex().
2022-12-12 21:48:47 +09:00
Yu Watanabe 0ce8870f19 string-util: introduce ascii_ishex() 2022-12-12 21:47:22 +09:00
Zbigniew Jędrzejewski-Szmek ae3506ab92 udev-builtin-keyboard: update description 2022-12-12 13:44:33 +01:00
Zbigniew Jędrzejewski-Szmek 953c928c24 udev: rework 60-evdev.rules to be "additive"
We would execute up to four hwdb match patterns (+ the keyboard builtin):
After the first hit, we would skip the other patterns, because of the GOTO="evdev_end"
action.

57bb707d48 (rules: Add extended evdev/input match
rules for event nodes with the same name), added an additional match with
":phys:<phys>:ev:<ev>" inserted. This breaks backwards compatibility for user
hwdb patterns, because we quit after the first match.

In general hwdb properties are "additive". We often have a general rule that
matches a wider class and then some specific overrides. E.g. in this particular
case, we have a match for all trackpoints, and then a bunch of model-specific
settings.

So let's change the rules to try all the match patterns and combine the
received properties. We execute builtin-keyboard once at the end, if there was
at least one match.

Fixes #25698. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2152226.

This also impacts other cases which I think would be very confusing for users.
Since we quit after a first successful match, if we had e.g. a match for
'evdev:input:b*v*p*' in out database, and the user added a match using
'evdev:name:*', which is the approach we document in the .hwdb files and which
users quite often use, it would be silently ignored. What's worse, if we added
our 'evdev:input:b*v*p*' match at a later point, user's match would stop
working. If we combine all the properties, we get more stable behaviour.
2022-12-12 13:44:33 +01:00
Luca Boccassi 30338b8b66
Merge pull request #25707 from yuwata/sd-device-fix-double-free
sd-device: fix double-free
2022-12-12 13:26:42 +01:00
Lennart Poettering a0bccdd375 update TODO 2022-12-12 12:59:30 +01:00
Yu Watanabe 733529d812 test: name_assign_type sysattr never exists for enumerated devices
As we filtered out network devices in the test.
2022-12-12 15:04:39 +09:00
Yu Watanabe eb18e7b782 sd-device: fix double-free
If an attribute is read but the value is not used (i.e. ret_value is NULL),
then sd_device_get_sysattr_value() mistakenly frees the read data even though
it is cached internally.

Fixes a bug introduced by acfc2a1d15.

Fixes #25702.
2022-12-12 14:20:47 +09:00
Hugo Carvalho 4113a3e0f3 po: Translated using Weblate (Portuguese)
Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: Hugo Carvalho <hugokarvalho@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/pt/
Translation: systemd/main
2022-12-12 13:26:55 +09:00
Lycowolf 67065750c5 Add mount matrix for VisionBook 12Wr Tab 2022-12-12 13:24:00 +09:00
Peter Cai 2a469016e3 libfido2-util: Refactor pre-flight failure handling
`fido2_is_cred_in_specific_token()` should simply not return error codes
for non-fatal errors. For example, `-ENODEV` can be safely translated to
a `false` return value. When the pre-flight request is not supported, we
should simply return true to instruct the caller to attempt to use the
device anyway.

All error codes returned by the funtion should now be fatal and logged
at error level. Non-fatal errors should only appear in debug logs.
2022-12-10 15:28:49 -05:00
Peter Cai 5d2c1ce4e4 libfido2-util: Perform pre-flight checks as well when a specific device path is given
This prevents unnecessary user interactions when `fido2-device` is set to
something other than `auto` -- a case overlooked in the original PR #23577
(and later #25268).

We do not move pre-flight checks to `fido2_use_hmac_hash_specific_token`
because the behaviors are different between different cases: when the
device path is NULL, we try to automatically choose the correct device,
in which case pre-flight errors should be "soft" errors, without
spamming the tty with error outputs; but when a specific device path is
given, a pre-flight request that determined the non-existence of the
credential should be treated the same as a failed assertion request.
2022-12-10 15:28:49 -05:00
Peter Cai 53c1ef9ce0 libfido2-util: Disable pre-flight checks for credentials with UV
According to the FIDO2 spec, tokens may not support pre-flight checks
for credentials requiring UV, at least not without at least
`pinUvAuthParam` or `uv = true`. Originally, in #25268, this was
handled by passing a PIN to satisfy `pinUvAuthParams`, but this is not
ideal, since `pinUvAuthParam` can be obtained from either a PIN
or a UV verification. Forcing the user to enter the PIN here (which is
often just the fallback option on UV devices) is no better than just
trying out each device with the actual assertion request.

As a result, this commit disables pre-flight checks when the credential
requires UV, and instead reverts to the old behavior (trying out each
device and each key slot, requiring multiple user interactions) for this
type of credentials.
2022-12-10 15:28:49 -05:00