Commit Graph
79843 Commits
Author SHA1 Message Date
Yu Watanabe c4eef17990 dirent-util: add several assertions in posix_getdents()
Follow-up for e86a492ff0.
2025-03-04 22:54:01 +01:00
Michal Koutný cf62e00295 path: Close inotify FD asynchronously
inotify FD may take several milliseconds to close.  We measured
daemon-reload

        default: (0.427 ± 0.05) s
        async:   (0.323 ± 0.02) s

with 5 path units out of 422 units. I.e. ~1% of units cause ~25% of
delay, hence this fix seems like low-hanging fruit on the daemon-reload
critical path.

Particular inotify slowness pointed out by @fbuihuu.
2025-03-04 21:37:58 +01:00
Lennart Poettering 52d5043b5e pam-systemd: default to "lightweight" sessions if area is selected
We currently don't support invoking a per-area service manager instance,
hence don't try to pull in one if we log into an area.

Once we add support for per-area service managers we can relax this
again.
2025-03-04 18:09:37 +01:00
Lennart Poettering 837849561b varlink: optionally create leading dirs when binding AF_UNIX socket
This is such a common case, let's make it easy to do this.
2025-03-04 18:07:17 +01:00
Lennart Poettering 4f4c37bc07 log: explicitly size log_target_max_level()
We always validate that the target value is below _LOG_TARGET_SINGLE_MAX
before acessing it, but we don't actually size the array like that.
let's fix that.

This doesn#t effectively change anything, but it makes things more
explicit what the limit here is.
2025-03-04 18:07:00 +01:00
Daan De Meyer 88400145ea test: Connect test unit to console when running interactively (#36586) 2025-03-04 17:06:49 +01:00
Lennart Poettering facc9439a7 dns-stream: only read DNS packet data if we identified the peer properly
If we use TCP fastopen to connect to a DNS server via TCP, and it
responds really quickly between our connection attempt and our immediate
check back, then we have not identified the peer yet, and will not be
able to use the peer metadata to fill in our packet info.

Let's fix that, and simply not read from the socket until identification
is complete.

Fixes: #34956
2025-03-04 12:33:53 +00:00
Lennart Poettering 8113361e82 resolved: pick up new DNSSEC KSC from 2024
Import thew new key from https://data.iana.org/root-anchors/root-anchors.xml.

The old one remains valid, as per provided data.

Fixes: #36260
2025-03-04 11:51:34 +00:00
Daan De Meyer 5abf819a5f basic: remove unnecessary definition in missing_xyz.h (#36565) 2025-03-04 08:41:14 +01:00
Harrison Vanderbyl 7fff71328e hwdb: add rotation profile matrix for Rog Ally X (2024) (#36591) 2025-03-04 13:15:23 +09:00
Yu Watanabe f342c2420a chattr-util: two trivial cleanups (#36593) 2025-03-04 13:13:25 +09:00
Lennart Poettering e5e8cd3eba tree-wide: several cleanups and fixlets prompted by Coverity (#36431) 2025-03-03 23:17:28 +01:00
Lennart Poettering 591e1492b7 Coverity fixups (#36503)
Details in individual commits.
2025-03-03 22:54:42 +01:00
Yu Watanabe 059d23c966 exec-invoke: add missing assertions and drop unnecessary conditions
Fixes CID#1534358.
2025-03-04 05:18:15 +09:00
Yu Watanabe 34b58da114 exec-invoke: modernize get_supplementary_groups()
- drop unused argument 'group',
- rename output arguments,
- add missing assertions for output arguments,
- always initialize output arguments on success.
2025-03-04 05:18:15 +09:00
Yu Watanabe 00575cfd69 hwdb-util: drop unused value assignment
The values assigned to 'r' were never used, and overwritten by the next
call of read_line_full().

Fixes CID#1548043 and CID#1548064.
2025-03-04 05:18:15 +09:00
Yu Watanabe 6529ab0b06 pe-binary: fix array overrun
This is a kind of paranoia, as memeqzero() does not read anyting if
length is zero. But, strictly speaking C language does not allow such,
and Coverity warn about that.

Fixes CID#1561177.
2025-03-04 05:18:15 +09:00
Yu Watanabe 2bf5d698d6 pe-binary: trivial coding style fixlets 2025-03-04 05:18:15 +09:00
Yu Watanabe 3428c4b818 generator: insert parentheses to make the code clearer
Silence CID#1563781.
2025-03-04 05:18:15 +09:00
Yu Watanabe 42f6a96e6c fileio: move call of label_ops_post() before error handling of creating files
Fixes CID#1563946.
2025-03-04 05:18:15 +09:00
Yu Watanabe b0e5cde687 async: voidify call of fsync()
Fixes CID#1564787.
2025-03-04 05:18:15 +09:00
Daan De Meyer 9fd25fd3ce network: Use RTNH_COMPARE_MASK in route_can_update() (#36585)
Let's only compare flags that can be set by userspace and not all flags.

Fixes a bug introduced by 7027cdbd79 (v256).
Fixes #36544
2025-03-04 05:00:33 +09:00
Yu Watanabe c7ef4b9f1a copy: slightly optimize around chattr_fd() 2025-03-04 04:49:18 +09:00
Yu Watanabe e86a492ff0 dirent-util: introduce simple wrapper of posix_getdents()
glibc exports getdents64 syscall as is, but musl exports it as
posix_getdents(). Let's introduce a simple wrapper of posix_getdents().

Note, our baseline for glibc is 2.31. Hence, we can assume getdents64()
always defined when building with glibc.
2025-03-04 04:23:57 +09:00
Michal Koutný c4b7596607 TEST-13-NSPAWN.nss-mymachines: Use negative matching switch
The test expects _not_ to find the patterns but the run_and_grep would
still print 'FAIL:' message. Use the dedicated -n option that inverts
the semantics cleaner than shell's !.
2025-03-03 19:27:17 +01:00
Michal Koutný 75e2d70eef user-record: Make user and group matching functions total
Since we can evaluate even the case with invalid ids (non-matching) we
can switch the function to pure boolean with no error cases and simpler
(none) return error handling.
2025-03-03 19:27:12 +01:00
Michal Koutný eaeb96125a userdb: Fix return value of groupdb_by_name()
The commit 7419291670 ("userdb: move UserDBMatch handling from userdbctl
into generic userdb code to allow it to be done server side")
unintentionally passes return value from group_record_match() as its
return value and thus diverges from other search functions that return 0
on success. Align that by returning 0 instead of 1, all existing callers
are invariant to this change.
2025-03-03 19:26:52 +01:00
Michal Koutný 5eceb5a7a2 user-record: Handle invalid uid/gid case
I'm not that familiar with outer code to guide Coverity with an
assert(), so consider invalid uid/gid as non-matching in order to avoid
-EINVAL for bit shifts calculation.

Fixes: CID#1590746
2025-03-03 19:14:56 +01:00
Yu Watanabe ec32732043 basic: introduce our own sys/mount.h implementation
To resolve conflict with sys/mount.h and linux/mount.h or linux/fs.h.

The conflict between sys/mount.h and linux/mount.h is resolved in
glibc-2.37 (774058d72942249f71d74e7f2b639f77184160a6), but our baseline
is still glibc-2.31. Also, even with the version or newer, still
sys/mount.h conflicts with linux/fs.h, which is included by
linux/btrfs.h.

This introduces our own implementation of sys/mount.h, that can be
simultaneously included with linux/mount.h and linux/fs.h. This also
imports linux/fs.h, linux/mount.h, and several other dependent headers.
The introduced sys/mount.h header itself may not be enough simple, but
by using the header, we can drop most of workarounds in other source files.
2025-03-04 02:24:49 +09:00
Yu Watanabe bc2bb59bdd missing_audit: AUDIT_NLGRP_READLOG is defined since kernel v3.16
More specifically, since 451f921639fea4600dfb9ab2889332bdcc7b48d3.
Now, our kernel baseline is 5.4. Hence, we can drop the definition.
2025-03-04 02:24:49 +09:00
Yu Watanabe aa14f19398 basic/linux: import capability.h from kernel 6.14-rc4 2025-03-04 02:24:49 +09:00
Yu Watanabe b9b006c504 missing_wait: add short comment about P_PIDFD 2025-03-04 02:24:49 +09:00
Yu Watanabe 003b845cb2 missing_timerfd: TFD_TIMER_CANCEL_ON_SET is defined since glibc-2.26 2025-03-04 02:24:49 +09:00
Yu Watanabe e75372958d missing_threads.h: threads.h exists since glibc-2.28 2025-03-04 02:24:49 +09:00
Yu Watanabe 75b101718c missing_socket: drop unnecessary definitions
All removed definitions are in glibc-2.31
2025-03-04 02:24:49 +09:00
Yu Watanabe 2c2d832eb0 missing_securebits: remove unnecessary header
Our kernel baseline is 5.4, hence all entries in the headers are defined
in linux/securebits.h.
2025-03-04 02:24:49 +09:00
Yu Watanabe a7cb43d8d1 missing_resource.h: RLIMIT_RTTIME is defined since glibc-2.14
Now our baseline is glibc-2.31.
2025-03-04 02:24:49 +09:00
Yu Watanabe 8e091ec420 basic/linux: import prctl.h from linux 6.14-rc4 2025-03-04 02:24:49 +09:00
Yu Watanabe 6e338c25d8 missing_network: drop unnecessary definitions
They are already defined in glibc-2.31.
2025-03-04 02:24:49 +09:00
Yu Watanabe b4ea2e7249 missing_namespace: drop unnecessary entries
Our kernel baseline is 5.4.
2025-03-04 02:24:49 +09:00
Yu Watanabe dc1a78a462 basic/linux: import loop.h from kernel 6.14-rc4, and drop missing_loop.h 2025-03-04 02:24:49 +09:00
Yu Watanabe fa716b6fc7 missing_keyctl: import keyctl.h from kernel 6.14-rc4 2025-03-04 02:24:49 +09:00
Yu Watanabe e7e91769e8 basic/linux: import ioprio.h from kernel 6.14-rc4
This also fixes the maximum allowed ioprio class: 8 -> 7
2025-03-04 02:24:49 +09:00
Yu Watanabe 87fb62f598 missing_input: replace the header with genuine linux header 2025-03-04 02:24:49 +09:00
Yu Watanabe 4dbaa211b5 basic/linux: import hidraw.h and hid.h from linux-6.14-rc4 2025-03-04 02:24:49 +09:00
Yu Watanabe 1b8f8a2d30 missing_fs: drop unnecessary entries
Now our kernel baseline is 5.4.
2025-03-04 02:24:49 +09:00
Yu Watanabe c5cba760cf missing_fcntl: drop definitions covered by glibc-2.31
Note, this also fixes the definition for O_TMPFILE for parisc and hppa,
it should be 040000000 (seven zeros) rather than 0400000000 (eight zeros).
2025-03-04 02:24:49 +09:00
Yu Watanabe b5337d1d52 meson: cleanup glibc header checkers 2025-03-04 02:24:49 +09:00
Yu Watanabe 883360f63a missing_type: char16_t and char32_t are always defined in uchar.h since C11
Now, we use C17, hence the fallback definitions can be dropped.
2025-03-04 02:24:49 +09:00
Yu Watanabe 905497c86d missing_stdlib: secure_getenv() exists since glibc-2.17 2025-03-04 02:24:49 +09:00