Commit Graph

82815 Commits

Author SHA1 Message Date
Ivan Kruglov
d8135125f8 core: leave comments in varlink-unit.c and varlink-cgroup.c about runtime/context split 2025-07-11 06:56:17 -07:00
Ivan Kruglov
08cd319664 core: move Slice from runtime to context in io.systemd.Unit.List 2025-07-11 06:56:17 -07:00
Ivan Kruglov
aa352ece0d core: move DebugInvocation from runtime to context in io.systemd.Unit.List 2025-07-11 06:48:41 -07:00
Yu Watanabe
f2e9193fcf test: drop unnecessary line continuation 2025-07-11 22:24:25 +09:00
Yu Watanabe
4a58d8ed51 udevadm: fix memleak
Fixes a bug in a4a6e21673.

Fixes the following memleak:
```
$ sudo valgrind --leak-check=full build/udevadm cat /usr/lib/udev/rules.d
==3975939==
==3975939== HEAP SUMMARY:
==3975939==     in use at exit: 640 bytes in 1 blocks
==3975939==   total heap usage: 7,657 allocs, 7,656 frees, 964,328 bytes allocated
==3975939==
==3975939== 640 bytes in 1 blocks are definitely lost in loss record 1 of 1
==3975939==    at 0x4841866: malloc (vg_replace_malloc.c:446)
==3975939==    by 0x4ACA71F: malloc_multiply (alloc-util.h:92)
==3975939==    by 0x4ACF988: _hashmap_dump_entries_sorted (hashmap.c:2167)
==3975939==    by 0x4ACFC76: _hashmap_dump_sorted (hashmap.c:2209)
==3975939==    by 0x4AA60A4: hashmap_dump_sorted (hashmap.h:311)
==3975939==    by 0x4AA9077: dump_files (conf-files.c:397)
==3975939==    by 0x4AAA14E: conf_files_list_strv_full (conf-files.c:596)
==3975939==    by 0x42426A: search_rules_file (udevadm-util.c:301)
==3975939==    by 0x424768: search_rules_files (udevadm-util.c:334)
==3975939==    by 0x41287D: cat_main (udevadm-cat.c:110)
==3975939==    by 0x4A7B911: dispatch_verb (verbs.c:139)
==3975939==    by 0x427272: udevadm_main (udevadm.c:121)
==3975939==
==3975939== LEAK SUMMARY:
==3975939==    definitely lost: 640 bytes in 1 blocks
==3975939==    indirectly lost: 0 bytes in 0 blocks
==3975939==      possibly lost: 0 bytes in 0 blocks
==3975939==    still reachable: 0 bytes in 0 blocks
==3975939==         suppressed: 0 bytes in 0 blocks
==3975939==
==3975939== For lists of detected and suppressed errors, rerun with: -s
==3975939== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
```
2025-07-11 22:07:41 +09:00
Yu Watanabe
fabcb1eb06 man: fix version info tag
Follow-up for 63770fa1d3.
2025-07-11 14:33:25 +02:00
Yu Watanabe
2b69797b6d Include more headers explicitly (#38169)
Similar to the recent change like
4f18ff2e29.
2025-07-11 20:21:33 +09:00
vlefebvre
fb71571d3a detect-virt: add bare-metal support for GCE
Google Compute Engine are not only virtual but can be also physical
machines. Therefore checking only the dmi is not enough to detect if it
is a virtual machine. Therefore systemd-detect-virt return "google"
instead of "none" in c3-highcpu-metal machine.
SMBIOS will not help us to make the difference as for EC2 machines.
However, GCE use KVM hypervisor for these VM, we can use this
information to detect virtualization. [0]

Issue and changes has been tested on SUSE SLE-15-SP7 images with
systemd-254 for both GCE, bare-metal and VM.

[0] -
https://cloud.google.com/blog/products/gcp/7-ways-we-harden-our-kvm-hypervisor-at-google-cloud-security-in-plaintext
2025-07-11 20:07:40 +09:00
Yu Watanabe
cc01ee7871 kernel-install: several follow-ups for --entry-type= (#38160)
Follow-ups for b6d4997683 (#37897).
2025-07-11 20:07:19 +09:00
Zbigniew Jędrzejewski-Szmek
63770fa1d3 systemd-run: add --no-pager, use pager for --help 2025-07-11 19:01:42 +09:00
Zbigniew Jędrzejewski-Szmek
d137f280b8 NEWS: clean up uses of backticks
Backticks are good in markdown files, where they signify text to be rendered
with a mono-space font. But our text files doesn't use markdown, and backticks
are just a particularly bad type of quote (ugly, assymetrical, with a special
significance in shell context). Update older NEWS entries to not use them.
2025-07-11 11:56:19 +02:00
Zbigniew Jędrzejewski-Szmek
ce9d701dc4 NEWS: adjust whitespace and texts for v258 2025-07-11 11:56:19 +02:00
Yu Watanabe
642f3dabdc mkosi: Two fixlets for CentOS (#38165) 2025-07-11 18:35:44 +09:00
Yu Watanabe
2bdabb167b basic: rename cap-list.c -> capability-list.c
This also renames relevant files in the same way.

Addresses https://github.com/systemd/systemd/pull/37904#discussion_r2191950396
2025-07-11 18:33:43 +09:00
Yu Watanabe
a87b6c2c5a man/kernel-install: mention --entry-type= option in the man page
Follow-up for b6d4997683.
2025-07-11 17:32:04 +09:00
Yu Watanabe
19d4040d71 kernel-install: regroup options in help meesage
And slightly updates the description.

Follow-up for b6d4997683.
2025-07-11 17:32:04 +09:00
Yu Watanabe
9026f17907 kernel-install: do not mix || and &&
This also slightly updates log message, and make it shown only when
verbose mode is enabled.

Follow-up for b6d4997683.
2025-07-11 17:32:02 +09:00
Yu Watanabe
0c443a8800 tree-wide: include asm/sgidefs.h to make _MIPS_SIM_ABI32 and friends defined
The header provides _MIPS_SIM_ABI32 and friends. Glibc indirectly includes
the header through sys/syscall.h or unistd.h, but let's explicitly include
the header where we use _MIPS_SIM_ABI32 and friends.
2025-07-11 17:26:28 +09:00
Yu Watanabe
e7a86455ed quota-util: explicitly include linux/quota.h
The header linux/quota.h provides e.g. QIF_DQBLKSIZE or PRJQUOTA, which
is used where the quota-util.h is included.
Let's explicitly include the header with 'IWYU pragma: export' tag.
2025-07-11 17:26:28 +09:00
Zbigniew Jędrzejewski-Szmek
d2e22fa6f5 sd-device: trivial cleanups (#38162) 2025-07-11 10:07:30 +02:00
DaanDeMeyer
08197abb15 mkosi: Fix installation conditions for rpmautospec-rpm-macros
rpmautospec-rpm-macros is only in EPEL 9 so let's gate it properly
on that by splitting up the epel packages config file into two.

erofs-utils is in EPEL 9 and in CentOS Stream 10.
2025-07-11 09:48:29 +02:00
Daan De Meyer
869b44e0f7 Several follow-ups for recent SELinux changes (#38161) 2025-07-11 09:01:00 +02:00
Yu Watanabe
78738adf88 network/bridge-vlan: allow to configure bridge vlan on stacked bridge master interface
Fixes #38157.
2025-07-11 08:59:28 +02:00
DaanDeMeyer
e05ba0662b mkosi: Drop epel-next repository for CentOS
It does not exist for CentOS Stream 10, it's only relevant for CentOS
Stream 9 in some corner cases which don't apply to us, so let's not enable
it to avoid complexity instead of only enabling it for CentOS Stream 9.

Follow up for 3800adc9e5
2025-07-11 08:54:40 +02:00
Yu Watanabe
4d7851380a Cleanups for missing_xyz.h headers (#37904)
Continuation of #37960.

The same concern as expalined in #37960 exists also in
missing_syscall.h. If we use enough new glibc, a function we want to use
may be already provided by glibc, but our baseline glibc may not. And it
is hard to detect in our daily development.

This moves all prototypes of syscalls to relevant headers, and missing
syscall functions are defined in relevant .c files of libc wrapper. This
way, we can use usual header as is, e.g. when we want to write code with
`move_mount()`, we can simply use sys/mount.h without checking if it is
supported by our baseline glibc.
2025-07-11 15:20:10 +09:00
Yu Watanabe
7b869ff949 journal: fix typo
Follow-up for df5b3426f6.
2025-07-11 14:12:42 +09:00
Yu Watanabe
369f311686 man: fix typo
Follow-up for 7aefb194e7.
2025-07-11 14:11:04 +09:00
Yu Watanabe
b1ce0a2b50 conf-files: make conf-file enumerators provide more detailed information of enumerated files (#38006)
This introduces `struct ConfFile` that stores detailed information of an
enumerated file, and introduces `conf_files_list_full()` and friends
that provide results in `ConfFile`.
Then make udev, hwdb, catalog, and cat-files use the new function and
struct to make them not read files outside of specified root directory.
2025-07-11 13:50:47 +09:00
Yu Watanabe
531e6a2091 raw-clone: move definition to .c file
Then, we can decrease the number of headers to be indirectly included
by including raw-clone.h. No functional change.
2025-07-11 13:05:46 +09:00
Yu Watanabe
0939d5c360 reboot-util: merge with raw-reboot.h
The header raw-reboot.h is only used with reboot-util. Let's merge them.
2025-07-11 13:05:46 +09:00
Yu Watanabe
1d81c3a74e docs: mention src/include/ directories 2025-07-11 13:05:46 +09:00
Yu Watanabe
c35606b272 include: use unit8_t for uuid
To emphasize it is an array of bytes.
This also align variables.
No functional changes. Just refactoring.
2025-07-11 13:05:46 +09:00
Yu Watanabe
3fc2a44043 include: move trivial kernel header wrappers to src/include/override/ 2025-07-11 13:05:46 +09:00
Yu Watanabe
543a48b653 libc-wrapper: introduce a tiny libc wrapper
Then, move syscall definitions to the wrapper, and prototypes are moved
to relevant headers.

This also adds checks for add_key() and request_key(), as one day
glibc may be going to add some of them separatedly.

The check for fspick in meson.build is dropped, as it is currently
unused in our code.

This also moves
- basic/missing_bpf.h -> include/override/linux/bpf.h,
- basic/missing_keyctl.h -> include/override/linux/keyctl.h.
2025-07-11 13:05:46 +09:00
Yu Watanabe
da522c9921 basic: move basic/missing_syscall_defs.h -> include/override/sys/syscall.h
This also moves syscall tables and generators to the same directory.

Note, inclusion of asm/sgidefs.h is dropped, as it is already included
by unistd.h and sys/syscall.h.
2025-07-11 13:05:46 +09:00
Yu Watanabe
2b912d2066 tree-wide: several cleanups for generating symbol lists and gperf files
- pass our system include directories to make generators use our libc
  wrappers and latest kernel headers,
- include relevant headers in generated gperf file,
- use files() rather than find_program(), as the result of
  find_program() cannot be passed to 'input' of custom_target(),
- move generate-bpf-delegate-configs.py to src/core/, as it is only used
  by libcore.
2025-07-11 13:05:42 +09:00
Yu Watanabe
1a60b97524 include: move libc header wrappers to src/include/override/, and kernel headers to src/include/uapi/
Preparation for later changes.
2025-07-11 12:44:26 +09:00
Yu Watanabe
98751cf16e mkosi: various improvements (#38156) 2025-07-11 12:40:22 +09:00
Yu Watanabe
795a9e8c06 sd-device: replace 'type *func()' -> 'type* func()' 2025-07-11 12:23:35 +09:00
Yu Watanabe
f5287e7efd sd-device: do not set errno needlessly 2025-07-11 12:22:58 +09:00
Yu Watanabe
090c3f924c core/selinux-access: insert an empty line after function arguments
Follow-ups for fe3f2ac073 and
e3fef210c8.
2025-07-11 12:19:51 +09:00
Yu Watanabe
a1518f0a94 selinux-util: downgrade log level to LOG_DEBUG when error code is zero
Previously, the logger is only used in error paths, but since
fe3f2ac073, the logger is also used in a
success path. Let's not log loudly on success.

This also drops unused log_selinux_enforcing().
2025-07-11 11:46:20 +09:00
Yu Watanabe
1e29a967c7 catalog: do not read catalog files outside of specified root directory 2025-07-11 10:42:08 +09:00
Yu Watanabe
683efcf649 hwdb-util: do not read hwdb files outside of specified root directory 2025-07-11 10:42:08 +09:00
Yu Watanabe
4d000c4853 hwdb-util: coding style update
- use 'r' for storing results,
- use RET_GATHER().
2025-07-11 10:42:08 +09:00
Yu Watanabe
ab1333b2b7 udev-rules: do not read udev rules files outside of specified root directory 2025-07-11 10:42:08 +09:00
Yu Watanabe
bdfb884237 TEST-17-UDEV: conditionalize test cases for testuser
Then, we can also run the test script in our local machine.
2025-07-11 10:42:08 +09:00
Yu Watanabe
a4a6e21673 udevadm: do not read udev rules files outside of the specified root directory
With this change, an invalid symlink and an empty file is silently
ignored. Hence, the test code is slightly updated.
2025-07-11 10:42:08 +09:00
Yu Watanabe
661b5bfd21 pretty-print: make conf_files_cat() not show files outside of the specified root.
Then, make the function show the original and resolved path if they are
different.

With this change, procfs needs to be mounted on /proc/, hence the test
code is slightly updated.
2025-07-11 10:42:08 +09:00
Yu Watanabe
86c4e42380 pretty-print: several cleanups for cat_files()
- drop redundant error messages in cat_files(), as cat_file() internally
  logs errors,
- show an empty line and filename before opening file, to make not mix
  any error messages with the previous file,
- drop unnecessary fflush(),
- use RET_GATHER() and continue to show files even if some files cannot
  be shown.
2025-07-11 10:42:08 +09:00