]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
8 months agotest: Check that the journal file was actually created 36821/head
Daan De Meyer [Fri, 21 Mar 2025 12:23:31 +0000 (13:23 +0100)] 
test: Check that the journal file was actually created

If the test fails in the mkosi setup logic the journal file will never
be created so let's add some checks.

8 months agopackit: Remove --depth=1 from git clone
Daan De Meyer [Fri, 21 Mar 2025 12:34:11 +0000 (13:34 +0100)] 
packit: Remove --depth=1 from git clone

We need the full history to be able to checkout the right commit
afterwards.

8 months agonetworkd: add support for externally managed vxlan devices
Erik Larsson [Sun, 16 Mar 2025 11:25:35 +0000 (12:25 +0100)] 
networkd: add support for externally managed vxlan devices

With this a vxlan interface can be created which is managed by
for example a EVPN control plane.

8 months agonamespace: use EBADF where appropriate
Lennart Poettering [Tue, 18 Mar 2025 15:00:09 +0000 (16:00 +0100)] 
namespace: use EBADF where appropriate

8 months agopackit: Enable use_target_repo_for_fmf_url option (#36794)
Daan De Meyer [Thu, 20 Mar 2025 08:24:41 +0000 (09:24 +0100)] 
packit: Enable use_target_repo_for_fmf_url option (#36794)

Currently this is picked up from the main branch of the fork which is
suboptimal. The packit folks implemented this new option for us which
should fix the problem.

8 months agofmf: Use mkosi -f together with ToolsTreePackageDirectories= 36794/head
Daan De Meyer [Wed, 19 Mar 2025 13:08:49 +0000 (14:08 +0100)] 
fmf: Use mkosi -f together with ToolsTreePackageDirectories=

There's no need to build various systemd tools from source again to
build the mkosi image when we can just install the packages that were
already built from source into the tools tree so let's do that to avoid
unnecessary compiling.

8 months agofmf: Drop -f from subsequent mkosi sandbox calls
Daan De Meyer [Wed, 19 Mar 2025 13:07:42 +0000 (14:07 +0100)] 
fmf: Drop -f from subsequent mkosi sandbox calls

Only required for the first call to mkosi sandbox, after that we can
assume the tools tree has already been built.

8 months agofmf: Allow overriding the mkosi distribution and release used
Daan De Meyer [Wed, 19 Mar 2025 11:52:36 +0000 (12:52 +0100)] 
fmf: Allow overriding the mkosi distribution and release used

8 months agofmf: Download rpms manually instead of going via repositories
Daan De Meyer [Wed, 19 Mar 2025 11:39:18 +0000 (12:39 +0100)] 
fmf: Download rpms manually instead of going via repositories

This both makes the script more independent, and allows us to add support
for CBS (CentOS Community Build System) at the same time.

8 months agocore: Make DelegateNamespaces= work for user managers with CAP_SYS_ADMIN (#36771)
Yu Watanabe [Wed, 19 Mar 2025 21:28:18 +0000 (06:28 +0900)] 
core: Make DelegateNamespaces= work for user managers with CAP_SYS_ADMIN (#36771)

Currently DelegateNamespaces= only works for services spawned by the
system manager. User managers will always unshare the user namespace
first even if they're running with CAP_SYS_ADMIN.

Let's add support for DelegateNamespaces= for user managers if they're
running with CAP_SYS_ADMIN. By default, we'll still delegate all
namespaces
for user managers, but this can now be overridden by explicitly passing
DelegateNamespaces=.

If a user manager is running without CAP_SYS_ADMIN, the user manager is
still always unshared first just like before.

8 months agoSeveral fixlets for Coverity (#36791)
Lennart Poettering [Wed, 19 Mar 2025 21:27:00 +0000 (22:27 +0100)] 
Several fixlets for Coverity (#36791)

8 months agoIntroduce ConditionVersion (#36468)
Yu Watanabe [Wed, 19 Mar 2025 21:15:35 +0000 (06:15 +0900)] 
Introduce ConditionVersion (#36468)

Add a new condition which can check against systemd version.

        $ systemctl --version
        systemd 258 (258~devel-g53ca5f6)

        $ systemd-analyze condition 'ConditionVersion=systemd>255'
        test.service: ConditionVersion=>255 succeeded.

        $ systemd-analyze condition 'ConditionVersion=systemd>260'
        test.service: ConditionVersion=>260 failed.

        $ systemd-analyze condition 'ConditionVersion=systemd>=258'
        test.service: ConditionVersion=>=258 succeeded.

        $ systemd-analyze condition 'ConditionVersion=systemd>=257.1'
        test.service: ConditionVersion=>=257.1 succeeded.

        $ uname -r
        6.12.13-200.fc41.aarch64

        $ systemd-analyze condition 'ConditionVersion=kernel > 4.4'
        test.service: ConditionVersion=kernel > 4.4 succeeded.

        $ systemd-analyze condition 'ConditionVersion=kernel > 6.20'
        test.service: ConditionVersion=kernel > 6.20 failed.

        $ systemd-analyze condition 'ConditionVersion=kernel < 9.0'
        test.service: ConditionVersion=kernel < 9.0 succeeded.

8 months agocgroup: whenever we migrate a PID to a unit, explicitly drop unit from empty notifica...
Lennart Poettering [Wed, 19 Mar 2025 15:54:27 +0000 (16:54 +0100)] 
cgroup: whenever we migrate a PID to a unit, explicitly drop unit from empty notification queue

A unit might be pending in the empty queue still when we add a PID to
the cgroup. At that point, let's explicitly remove the unit from that
queue.

Fixes: #36781
8 months agotpm2-util: return better errors if we try to unlock a tpm key on the wrong tpm
Lennart Poettering [Wed, 19 Mar 2025 17:09:23 +0000 (18:09 +0100)] 
tpm2-util: return better errors if we try to unlock a tpm key on the wrong tpm

Let's improve error handling in case one tries to unlock a TPM2 locked
volume on a different machine via TPM than it was originally enrolled
on. Let's recognize this case and print a clearer error message.

8 months agovarious verity generator tweaks (#36802)
Daan De Meyer [Wed, 19 Mar 2025 18:26:03 +0000 (19:26 +0100)] 
various verity generator tweaks (#36802)

8 months agogenerator: skip fsck early for non-blockdev file systems, or file systems that are...
Lennart Poettering [Wed, 19 Mar 2025 14:15:10 +0000 (15:15 +0100)] 
generator: skip fsck early for non-blockdev file systems, or file systems that are always read-only

8 months agosd-event: make pidfd copy in event_add_child_pidref()
Lennart Poettering [Wed, 19 Mar 2025 14:11:58 +0000 (15:11 +0100)] 
sd-event: make pidfd copy in event_add_child_pidref()

So far we'd directly use the pidfd passed into event_add_child_pidref(),
hoping it would not be closed by the caller before we are done. This was
violated by vmspawn however.

Let's make this safe, and simply duplicate the fd, and make us
independent of the caller.

8 months agoveritysetup-generator: repeat format string arguments a bit less 36802/head
Lennart Poettering [Wed, 19 Mar 2025 09:06:10 +0000 (10:06 +0100)] 
veritysetup-generator: repeat format string arguments a bit less

8 months agoveritysetup-generator: specify source for generator_open_unit_file()
Lennart Poettering [Wed, 19 Mar 2025 09:05:50 +0000 (10:05 +0100)] 
veritysetup-generator: specify source for generator_open_unit_file()

8 months agoveritysetup-generator: exit on first error
Lennart Poettering [Wed, 19 Mar 2025 09:05:25 +0000 (10:05 +0100)] 
veritysetup-generator: exit on first error

8 months agoveritysetup: automatically generate unit name, instead of hardcoding it
Lennart Poettering [Wed, 19 Mar 2025 09:02:16 +0000 (10:02 +0100)] 
veritysetup: automatically generate unit name, instead of hardcoding it

8 months agofmf: Drop support for dist-git-source: true
Daan De Meyer [Wed, 19 Mar 2025 11:36:20 +0000 (12:36 +0100)] 
fmf: Drop support for dist-git-source: true

In preparation for moving the fmf stuff to the fedora spec repo instead
of maintaining it upstream, let's drop support for dist-git-source: true
which won't be needed anymore when we move the fmf stuff to the Fedora
spec repository.

8 months agofmf: Stop creating /etc/pacman.d/gnupg mountpoint
Daan De Meyer [Wed, 19 Mar 2025 10:09:43 +0000 (11:09 +0100)] 
fmf: Stop creating /etc/pacman.d/gnupg mountpoint

Not needed anymore with latest versions of mkosi.

8 months agofmf: Drop btrfs workaround
Daan De Meyer [Wed, 19 Mar 2025 10:09:04 +0000 (11:09 +0100)] 
fmf: Drop btrfs workaround

We switched to ext4 in mkosi.repart itself, so drop the workaround
in the fmf integration test script.

8 months agopackit: Use same specfile revision as mkosi uses
Daan De Meyer [Wed, 19 Mar 2025 10:03:05 +0000 (11:03 +0100)] 
packit: Use same specfile revision as mkosi uses

8 months agopackit: Enable use_target_repo_for_fmf_url option
Daan De Meyer [Wed, 19 Mar 2025 09:54:51 +0000 (10:54 +0100)] 
packit: Enable use_target_repo_for_fmf_url option

Currently this is picked up from the main branch of the fork which is
suboptimal. The packit folks implemented this new option for us which
should fix the problem.

8 months agouserdb: Add userdb.user.* and userdb.group.* credentials (#36740) 36834/head
Daan De Meyer [Wed, 19 Mar 2025 09:30:52 +0000 (10:30 +0100)] 
userdb: Add userdb.user.* and userdb.group.* credentials (#36740)

Let's allow providing extra userdb users and groups via credentials.
Similarly to systemd-udev-load-credentials.service, we ship
systemd-userdb-load-credentials.service which transform the JSON
user/group records provided via the corresponding credentials to static
userdb dropins in /run/userdb.

8 months agocore: Make DelegateNamespaces= work for user managers with CAP_SYS_ADMIN 36771/head
Daan De Meyer [Mon, 17 Mar 2025 10:35:23 +0000 (11:35 +0100)] 
core: Make DelegateNamespaces= work for user managers with CAP_SYS_ADMIN

Currently DelegateNamespaces= only works for services spawned by the
system manager. User managers will always unshare the user namespace
first even if they're running with CAP_SYS_ADMIN.

Let's add support for DelegateNamespaces= for user managers if they're
running with CAP_SYS_ADMIN. By default, we'll still delegate all namespaces
for user managers, but this can now be overridden by explicitly passing
DelegateNamespaces=.

If a user manager is running without CAP_SYS_ADMIN, the user manager is
still always unshared first just like before.

8 months agotest: Fix formatting
Daan De Meyer [Mon, 17 Mar 2025 15:25:19 +0000 (16:25 +0100)] 
test: Fix formatting

8 months agorun: Stop agents before we drop privileges
Daan De Meyer [Mon, 17 Mar 2025 15:01:26 +0000 (16:01 +0100)] 
run: Stop agents before we drop privileges

After dropping privileges, we won't be able to stop agents anymore
as our signals will get ignored.

8 months agosd_bus_open_user_machine(): Don't shortcut without necessary env
Daan De Meyer [Mon, 17 Mar 2025 11:28:37 +0000 (12:28 +0100)] 
sd_bus_open_user_machine(): Don't shortcut without necessary env

Don't shortcut if we don't have the necessary environment variables
set in sd_bus_open_user_machine().

8 months agocapability-util: Ignore unknown capabilities instead of aborting
Daan De Meyer [Mon, 17 Mar 2025 11:26:46 +0000 (12:26 +0100)] 
capability-util: Ignore unknown capabilities instead of aborting

capability_ambient_set_apply() can be called with capability sets
containing unknown capabilities. Let's not crash when this is the
case but instead ignore the unknown capabilities.

This fixes a crash when running the following command:

"systemd-run -p "AmbientCapabilities=~" --wait --pipe id"

Fixes d5e12dc75e0e356c62e514e9c347efb200fe60e0

8 months agoTEST-07-PID1.private-pids: Use --machine=testuser@.host instead of runas
Daan De Meyer [Tue, 18 Mar 2025 08:48:21 +0000 (09:48 +0100)] 
TEST-07-PID1.private-pids: Use --machine=testuser@.host instead of runas

Let's use the systemd way to run systemd-run as a different user instead
of setpriv.

8 months agoTEST-07-PID1.delegate-namespaces: Actually run the testcases
Daan De Meyer [Mon, 17 Mar 2025 10:31:48 +0000 (11:31 +0100)] 
TEST-07-PID1.delegate-namespaces: Actually run the testcases

8 months agoTEST-07-PID1.delegate-namespaces: Fix testcase_pid()
Daan De Meyer [Mon, 17 Mar 2025 20:22:49 +0000 (21:22 +0100)] 
TEST-07-PID1.delegate-namespaces: Fix testcase_pid()

Make sure the test has its own /proc and skip it in containers as
MountAPIVFS=yes in a container always results in a read-only /proc/sys
which means the test can't write to /proc/sys/kernel/ns_last_pid.

8 months agoTEST-07-PID1.delegate-namespaces: Make sure fully visible procfs is available
Daan De Meyer [Mon, 17 Mar 2025 15:20:00 +0000 (16:20 +0100)] 
TEST-07-PID1.delegate-namespaces: Make sure fully visible procfs is available

To be able to mount /proc inside an unprivileged user namespace, we have
to make sure a fully visible procfs is available on the host, so let's make
sure that's the case.

8 months agocore: Also check if we can mount /proc if pid namespace is delegated
Daan De Meyer [Mon, 17 Mar 2025 15:17:25 +0000 (16:17 +0100)] 
core: Also check if we can mount /proc if pid namespace is delegated

If the pid namespace is delegated, it doesn't matter if we have CAP_SYS_ADMIN,
we'll still fail to mount /proc if part of it is masked on the host so also
check if we can mount /proc if the pid namespace is delegated.

8 months agoTEST-07-PID1.delegate-namespaces: Fix testcase_network()
Daan De Meyer [Mon, 17 Mar 2025 10:31:28 +0000 (11:31 +0100)] 
TEST-07-PID1.delegate-namespaces: Fix testcase_network()

8 months agobus-unit-util: Fix DelegateNamespaces= parser
Daan De Meyer [Mon, 17 Mar 2025 10:29:48 +0000 (11:29 +0100)] 
bus-unit-util: Fix DelegateNamespaces= parser

Similarly to the config file parse method, let's fix the systemd-run
parser as well.

Follow up for 11b982053bdc31806e571ea0771d7f10cb276d69

8 months agoexec-invoke: Rename various variables from has_ to have_
Daan De Meyer [Mon, 17 Mar 2025 09:44:05 +0000 (10:44 +0100)] 
exec-invoke: Rename various variables from has_ to have_

All of these encode information of the current process, so have_ is
more approriate than has_, which refers to something else.

8 months agounits: Add systemd-machined.socket
Daan De Meyer [Tue, 18 Mar 2025 13:37:15 +0000 (14:37 +0100)] 
units: Add systemd-machined.socket

8 months agoptyfwd: use usec_add() 36791/head
Yu Watanabe [Wed, 19 Mar 2025 02:30:36 +0000 (11:30 +0900)] 
ptyfwd: use usec_add()

Fixes CID#1548038.

8 months agoio-util: add one more assertion for Coverity
Yu Watanabe [Wed, 19 Mar 2025 02:21:46 +0000 (11:21 +0900)] 
io-util: add one more assertion for Coverity

Fixes CID#1548067.

8 months agonspawn-oci: update overflow check
Yu Watanabe [Wed, 19 Mar 2025 02:12:33 +0000 (11:12 +0900)] 
nspawn-oci: update overflow check

Fixes CID#1548072.

8 months agosd-dhcp-client: use event_reset_time_relative()
Yu Watanabe [Wed, 19 Mar 2025 01:59:53 +0000 (10:59 +0900)] 
sd-dhcp-client: use event_reset_time_relative()

Fixes CID#1548073.

8 months agologs-show: comment out dead code
Yu Watanabe [Wed, 19 Mar 2025 01:51:35 +0000 (10:51 +0900)] 
logs-show: comment out dead code

Follow-up for 280e85224e6273f1835a41782f2e3abd7582dd2e.
Fixes CID#1548921 and CID#1548922.

8 months agologind-action: use BIT_SET() and SET_BIT()
Yu Watanabe [Wed, 19 Mar 2025 01:47:31 +0000 (10:47 +0900)] 
logind-action: use BIT_SET() and SET_BIT()

Hopefully fixes CID#1529417.

8 months agojournal: fix indentation
Yu Watanabe [Wed, 19 Mar 2025 01:38:53 +0000 (10:38 +0900)] 
journal: fix indentation

8 months agobus-unit-procs: add one more assertion for Coverity
Yu Watanabe [Wed, 19 Mar 2025 01:35:17 +0000 (10:35 +0900)] 
bus-unit-procs: add one more assertion for Coverity

Hopefully fixes CID#1562447.

8 months agoboot: always pass an array of PeSectionVector to pe_locate_sections()
Yu Watanabe [Wed, 19 Mar 2025 01:23:26 +0000 (10:23 +0900)] 
boot: always pass an array of PeSectionVector to pe_locate_sections()

Hopefully silences false-positive warnings by Coverity.
Fixes CID#1549198, CID#1549199, CID#1564903.

8 months agobitfield: check if specified index is non-negative
Yu Watanabe [Wed, 19 Mar 2025 00:38:36 +0000 (09:38 +0900)] 
bitfield: check if specified index is non-negative

Hopefully silences false-positive warnings by Coverity e.g. CID#1590746.

8 months agoUpdate TODO 36740/head
Daan De Meyer [Tue, 18 Mar 2025 10:24:38 +0000 (11:24 +0100)] 
Update TODO

8 months agomkosi: Create testuser at runtime
Daan De Meyer [Thu, 13 Mar 2025 14:27:03 +0000 (15:27 +0100)] 
mkosi: Create testuser at runtime

Now that we have userdb credentials, let's ship testuser as a userdb
credential instead of including it in the image.

8 months agouserdb: Add userdb.user.* and userdb.group.* credentials
Daan De Meyer [Thu, 13 Mar 2025 14:22:34 +0000 (15:22 +0100)] 
userdb: Add userdb.user.* and userdb.group.* credentials

Let's allow providing extra userdb users and groups via credentials.
Similarly to systemd-udev-load-credentials.service, we ship
systemd-userdb-load-credentials.service which transform the JSON
user/group records provided via the corresponding credentials to static
userdb dropins in /etc/userdb.

Replaces #33811

8 months agomkosi: Make sure systemd-userdbd.socket is enabled
Daan De Meyer [Tue, 18 Mar 2025 12:51:35 +0000 (13:51 +0100)] 
mkosi: Make sure systemd-userdbd.socket is enabled

8 months agomkosi: Add unix_chkpwd to sanitizer wrapped binaries
Daan De Meyer [Tue, 18 Mar 2025 21:45:17 +0000 (22:45 +0100)] 
mkosi: Add unix_chkpwd to sanitizer wrapped binaries

unix_chkpwd will retrieve the user name of the uid it is invoked as
and as such needs the asan workaround.

8 months agomkosi: Bump to Fedora 42
Daan De Meyer [Tue, 18 Mar 2025 19:35:59 +0000 (20:35 +0100)] 
mkosi: Bump to Fedora 42

Beta was just released, let's switch to Fedora 42 which coincidentally
also has a crucial fix for its nsswitch.conf to make the next commits
actually work.

8 months agoSeveral fixes and cleanups around sd_listen_fds() (#36788)
Daan De Meyer [Tue, 18 Mar 2025 19:10:33 +0000 (20:10 +0100)] 
Several fixes and cleanups around sd_listen_fds() (#36788)

8 months agoupdate TODO
Lennart Poettering [Tue, 18 Mar 2025 17:12:23 +0000 (18:12 +0100)] 
update TODO

8 months agonspawn: make failure in sd_listen_fds() critical 36788/head
Yu Watanabe [Tue, 18 Mar 2025 16:38:18 +0000 (01:38 +0900)] 
nspawn: make failure in sd_listen_fds() critical

Also, drop doubled call of sd_listen_fds().

8 months agooomd: do not ignore failure in sd_lisen_fds()
Yu Watanabe [Tue, 18 Mar 2025 16:33:54 +0000 (01:33 +0900)] 
oomd: do not ignore failure in sd_lisen_fds()

Also, use -EBADF for an invalid file descriptor.

8 months agovmspawn: do not use r for loop count
Yu Watanabe [Tue, 18 Mar 2025 16:35:13 +0000 (01:35 +0900)] 
vmspawn: do not use r for loop count

In a future, we may call some functions and r may be used for storing
error code of them. Let's not use r for the maximum number of loop count.

8 months agosd-varlink: fix overwrite of loop count
Yu Watanabe [Tue, 18 Mar 2025 16:33:09 +0000 (01:33 +0900)] 
sd-varlink: fix overwrite of loop count

Fixes a bug introduced by 206504a594492f4b97259bbe345dde4e520df7dc (v255).

8 months agoinitctl: fix error handling
Yu Watanabe [Tue, 18 Mar 2025 16:32:12 +0000 (01:32 +0900)] 
initctl: fix error handling

Fixes a bug introduced by cc090ca7fec93cd6b41bd7a756cd5fe32df44764 (v246).

8 months agonsresourced: fix assignment of target_gid
Yu Watanabe [Tue, 18 Mar 2025 09:53:59 +0000 (18:53 +0900)] 
nsresourced: fix assignment of target_gid

Follow-up for 00b1f6731398d02409cf7deb6b9b803969fda89f.

Fixes CID#1593901.

8 months agoman: base64 is not hex
Lennart Poettering [Tue, 18 Mar 2025 10:40:14 +0000 (11:40 +0100)] 
man: base64 is not hex

8 months agoTODO
Lennart Poettering [Tue, 18 Mar 2025 10:48:27 +0000 (11:48 +0100)] 
TODO

8 months agoupdate TODO
Lennart Poettering [Tue, 18 Mar 2025 09:45:21 +0000 (10:45 +0100)] 
update TODO

8 months agocondition: introduce ConditionVersion=/AssertVersion= 36468/head
Matteo Croce [Thu, 20 Feb 2025 12:07:24 +0000 (13:07 +0100)] 
condition: introduce ConditionVersion=/AssertVersion=

Add a new condition wich checks against systemd version.
Change condition_test_kernel_version() into a generic condition_test_version()
so most of the code can be reused.

    $ systemctl --version
    systemd 258 (258~devel-g53ca5f6)

    $ systemd-analyze condition 'ConditionVersion=systemd>255'
    test.service: ConditionVersion=>255 succeeded.

    $ systemd-analyze condition 'ConditionVersion=systemd>260'
    test.service: ConditionVersion=>260 failed.

    $ systemd-analyze condition 'ConditionVersion=systemd>=258'
    test.service: ConditionVersion=>=258 succeeded.

    $ systemd-analyze condition 'ConditionVersion=systemd>=257.1'
    test.service: ConditionVersion=>=257.1 succeeded.

    $ uname -r
    6.12.13-200.fc41.aarch64

    $ systemd-analyze condition 'ConditionVersion=kernel > 4.4'
    test.service: ConditionVersion=kernel > 4.4 succeeded.

    $ systemd-analyze condition 'ConditionVersion=kernel > 6.20'
    test.service: ConditionVersion=kernel > 6.20 failed.

    $ systemd-analyze condition 'ConditionVersion=kernel < 9.0'
    test.service: ConditionVersion=kernel < 9.0 succeeded.

8 months agocondition: align string table
Yu Watanabe [Tue, 18 Mar 2025 01:40:56 +0000 (10:40 +0900)] 
condition: align string table

8 months agoanalyze-condition: rewrite condition parser
Yu Watanabe [Tue, 18 Mar 2025 01:24:37 +0000 (10:24 +0900)] 
analyze-condition: rewrite condition parser

No functional change, just a refactoring.

8 months agogetty-generator: unify add_serial_getty() and add_container_getty()
Yu Watanabe [Mon, 17 Mar 2025 01:36:33 +0000 (10:36 +0900)] 
getty-generator: unify add_serial_getty() and add_container_getty()

This also makes the generator not trigger an assertion added by
1cd3c49d09bf78a2a2e4cf25cb3d388e1f08a709. If getty.ttys.container
credential contains a line prefixed with '/dev/', then the assertion
    assert(!path_startswith(tty, "/dev/"));
was triggered. This drops the offending assertion, and such lines
are handled gracefully now.

Also, an empty string, "/dev/", and "/dev/pts/" (that is, a directory
without tty name) are gracefully skipped now.

8 months agoxattr-util: refuse embedded NUL bytes in getxattr_at_malloc() (#36713)
Lennart Poettering [Tue, 18 Mar 2025 08:10:19 +0000 (09:10 +0100)] 
xattr-util: refuse embedded NUL bytes in getxattr_at_malloc() (#36713)

8 months agocgroup-util: remove cg_get_xattr(), it's apparently unused 36713/head
Lennart Poettering [Thu, 13 Mar 2025 11:45:31 +0000 (12:45 +0100)] 
cgroup-util: remove cg_get_xattr(), it's apparently unused

8 months agoxattr-util: rework getxattr_at_malloc()
Lennart Poettering [Wed, 12 Mar 2025 07:36:45 +0000 (08:36 +0100)] 
xattr-util: rework getxattr_at_malloc()

Let's return the size in a return parameter instead of the return value.
And if NULL is specified this tells us the caller doesn't care about the
size and expects a NUL terminated string. In that case look for an
embedded NUL byte, and refuse in that case.

This should lock things down a bit, as we'll systematically refuse
embedded NUL strings now when we expect strings.

8 months agohwdb: fix backspace not working on HP Pavilion laptop (#36777)
Sonia Zorba [Tue, 18 Mar 2025 00:25:51 +0000 (02:25 +0200)] 
hwdb: fix backspace not working on HP Pavilion laptop (#36777)

PR #34685 moved the handling of keys 66/65 from specific models to
generic HP laptops.

Key 66 has been linked to the `pickup_phone` function; however, this
action key is not available on all HP laptop models, particularly older
versions. On my HP Pavilion laptop, key 66 is mapped to the `backspace`
function, which caused the backspace key to stop working after the
change.

The following PR fixes the issue on my **HP Pavilion Laptop 15-eg0xxx**.
I have placed the modifications under the Pavilion section, but I cannot
guarantee that this solution will apply to all Pavilion models.

Additionally, I have included a line that checks for "HP" instead of
solely searching for "Hewlett-Packard," as my model is simply labeled as
HP.

8 months agosome user record fixes (#36776)
Yu Watanabe [Tue, 18 Mar 2025 00:24:05 +0000 (09:24 +0900)] 
some user record fixes (#36776)

Fixes: https://github.com/systemd/systemd/issues/36775
8 months agorun: Ref() the unit again after reconnecting to the bus
Mike Yuan [Mon, 17 Mar 2025 19:08:51 +0000 (20:08 +0100)] 
run: Ref() the unit again after reconnecting to the bus

Follow-up for c8f59296bff1ac1085c9073159ccaf8a333c5027

Currently, the unit is only reffed in transient_unit_set_properties()
via AddRef(), which however would be dropped if a reconnection
is attempted. Make sure to explicitly re-add reference in that case.

8 months agonsresourced,vmspawn: allow unpriv "tap" based networking in vmspawn (#36688)
Yu Watanabe [Mon, 17 Mar 2025 22:34:03 +0000 (07:34 +0900)] 
nsresourced,vmspawn: allow unpriv "tap" based networking in vmspawn (#36688)

This extends nsresourced to also allow delegation of a network tap
device (in addition to veth) to unpriv clients, with a strictly enforced
naming scheme.

also tightens security on a couple of things:

* enforces polkit on all nsresourced ops too (though by default still
everything is allowed)
* put a limit on delegated network devices
* forcibly clean up delegated network devices when the userns goes away

8 months agotree-wide: refuse user/group records lacking UID or GID 36776/head
Lennart Poettering [Mon, 17 Mar 2025 21:37:14 +0000 (22:37 +0100)] 
tree-wide: refuse user/group records lacking UID or GID

userdb allows user/group records without UID/GID (it only really
requires a name), in order to permit "unfixated" records. But that means
we cannot just rely on the field to be valid. And we mostly got that
right, but not everywhere. Fix that.

8 months agonspawn: go via user_record_home_directory() accessor for .home_directory UserRecord...
Lennart Poettering [Mon, 17 Mar 2025 21:22:59 +0000 (22:22 +0100)] 
nspawn: go via user_record_home_directory() accessor for .home_directory UserRecord field

Fixes: #36775
8 months agotree-wide: go via user_record_gid() accessor for UserRecord's .gid field
Lennart Poettering [Mon, 17 Mar 2025 21:21:58 +0000 (22:21 +0100)] 
tree-wide: go via user_record_gid() accessor for UserRecord's .gid field

Sometimes we went for the field directly, where we really should go via
the accessor. Fix it.

8 months agoupdate TODO 36688/head
Lennart Poettering [Mon, 10 Mar 2025 13:39:53 +0000 (14:39 +0100)] 
update TODO

8 months agotest: add test for nsresourced
Lennart Poettering [Tue, 11 Mar 2025 05:06:40 +0000 (06:06 +0100)] 
test: add test for nsresourced

8 months agonsresource: turn feature absence error into EOPNOTSUPP
Lennart Poettering [Wed, 12 Mar 2025 17:00:57 +0000 (18:00 +0100)] 
nsresource: turn feature absence error into EOPNOTSUPP

Let's make it easy for local clients to treat feature absence as a
simple EOPNOTSUPP check.

8 months agovarlink: add full introspection comments for io.systemd.NamespaceResource
Lennart Poettering [Tue, 11 Mar 2025 09:40:04 +0000 (10:40 +0100)] 
varlink: add full introspection comments for io.systemd.NamespaceResource

8 months agonsresourced: check polkit before executing our operations
Lennart Poettering [Mon, 10 Mar 2025 12:39:53 +0000 (13:39 +0100)] 
nsresourced: check polkit before executing our operations

Let's tighten rules on namespace operations: let's always ask PK for
permission before doing anything.

Note that if polkit is absent we'll still allow things, and the default
PK policy will also still allow things, but there's now a clear way how
people can not allow things if they want, by modifying the PK policy.

8 months agonsresourced: put a limit on delegated network interfaces too
Lennart Poettering [Mon, 10 Mar 2025 11:57:29 +0000 (12:57 +0100)] 
nsresourced: put a limit on delegated network interfaces too

8 months agonsresourced: explicitly remove network interfaces when their userns goes away
Lennart Poettering [Mon, 10 Mar 2025 11:39:35 +0000 (12:39 +0100)] 
nsresourced: explicitly remove network interfaces when their userns goes away

Let's tighten the screws a bit on the network interfaces we delegate,
and explicitly destroy them, just like we destroy delegated cgroups.

Ideally, this should happen automatically because the userns goes away
that pins the veth, or because the client holding an fd for a tap device
goes away as the userns goes away. But you never know who keeps a
reference, hence let's explicitly destroy this too.

8 months agovmspawn: support unpriv tap networking
Lennart Poettering [Mon, 10 Mar 2025 10:36:39 +0000 (11:36 +0100)] 
vmspawn: support unpriv tap networking

8 months agonsresource: add client-side wrapper for creating tap links
Lennart Poettering [Mon, 10 Mar 2025 10:36:05 +0000 (11:36 +0100)] 
nsresource: add client-side wrapper for creating tap links

8 months agonetwork: also manage namespace tap links
Lennart Poettering [Mon, 10 Mar 2025 10:20:29 +0000 (11:20 +0100)] 
network: also manage namespace tap links

8 months agonsresourced: add ability to delegate tap device
Lennart Poettering [Sun, 9 Mar 2025 07:14:09 +0000 (08:14 +0100)] 
nsresourced: add ability to delegate tap device

8 months agonsresourced: permit differing uid/gid
Lennart Poettering [Sun, 9 Mar 2025 07:13:07 +0000 (08:13 +0100)] 
nsresourced: permit differing uid/gid

8 months agonamespace: simplify apply_one_mount() a bit
Lennart Poettering [Mon, 10 Mar 2025 10:33:50 +0000 (11:33 +0100)] 
namespace: simplify apply_one_mount() a bit

Drop a bunch of unnecessary casts, format strings, and {} blocks.

8 months agonamespace-util: introduce userns_acquire_self_root()
Lennart Poettering [Mon, 10 Mar 2025 10:30:11 +0000 (11:30 +0100)] 
namespace-util: introduce userns_acquire_self_root()

This is a simple helper for creating a userns that just maps the
callers user to UID 0 in the namespace. This can be acquired unpriv,
which makes it useful for various purposes, for example for the logic in
is_idmapping_supported(), hence port it over.

(is_idmapping_supported() used a different mapping before, with the
nobody users, but there's no real reason for that, and we'll use
userns_acquire_self_root() elsewhere soon, where the root mapping is
important).

8 months agonamespace-util: make "setgroups" users property writable via userns_acquire()
Lennart Poettering [Mon, 10 Mar 2025 10:24:59 +0000 (11:24 +0100)] 
namespace-util: make "setgroups" users property writable via userns_acquire()

Unprivileged namespaces are only allowed if the "setgroups" file is set
to "deny" for processes. And we need to write it before writing the
gidmap. Hence add a parameter for that.

Then, also patch all current users to actually enable this. The usecase
generally don't need it (because they don't care about unprivileged
userns), but it doesn't hurt to enable the concept anyway in all current
users (none of them actually runs complex userspace in them, but they
mostly use userns_acquire() for idmapped mounts and similar).

Let's anyway make this option explicit in the function call, to indicate
that the concept exists and is applied.

8 months agobetter support for $COLORTERM (#36770)
Lennart Poettering [Mon, 17 Mar 2025 12:17:06 +0000 (13:17 +0100)] 
better support for $COLORTERM (#36770)

I recently noticed that our serial/VM terminals did not get fedora's
color shell prompt, nor got color support in "ls".

I spend a bit of time investigating and it's all a bit of a mess. If we
don't have any idea what kind of terminal we are talking to via serial
or hypervisor console then we so far just set TERM=vt220 as a reasonable
fallback: vt220 is quite universally defined in terminfo/termcap, and it
supports pageup/pagedown (unlike vt100).

However, real vt220 DEC terminals did not support color, and hence
termcap/terminfo says "no color, sorry". Which sucks, but actually
neither coreutils' "ls" (via `dircolors`) nor fedora's color shell
prompt actually care for termcap/terminfo. So why don't we get color?

In the coreutils case: it has it's own mini-database of terminals. A
very skewed one, where TERM=vt100 enables colors (and DEC vt100
definitely never ever had color support!), but vt220 does not. However,
what it actually does is check $COLORTERM. If that's set then it would
enable color.

In the fedora color prmpt case: it tries to derive color support by
looking for the word "color" in $TERM. Horrible hack if you ask me...

In order to make things better I did a bunch of things:

1. I think the idea of actually having a fully correct and up-to-date
termcap/terminfo database is kinda illusionary these days. But
apparently regarding color support $COLORTERM kinda took it place.
coreutils cares, and systemd itself cares too. To some point at least:
we consume it to determine color support, but we never propagate it in
nspawn, run0 and so on. So this PR fixes that.

2. Also, we are kinda stuck with vt220 I guess as default fallback for
serial terminals. But let's tweak it, and set $COLORTERM=truecolor as
default too. this means we default to a vt220 terminal, but with color.
Which is an ahistorical thing to do, but I think it's the best way out.

3. I also filed a bug against util-linux asking them to treat $COLORTERM
like $TERM, and let it propagate from getty into login shell:
https://github.com/util-linux/util-linux/issues/3463 – With that we
should get color support in ls by default now.

4. I also asked coreutils to treat vt220 the same as they already treat
vt100 and simply do color, even if though that's ahistorical:
https://github.com/coreutils/coreutils/issues/96

5. I then asked the fedora color prompt package to check $COLORTERM:
https://bugzilla.redhat.com/show_bug.cgi?id=2352650

6. I also asked the fedora ssh package to propagate $COLORTERM to remote
hosts by default, like they already cover $TERM. terminal emulators set
both these days generally, hence this would make sense.
https://bugzilla.redhat.com/show_bug.cgi?id=2352653

7. while at it, I figured it makes sense to not only propagate/consume
$COLORTERM at the same time as $TERM, but also consider $NO_COLOR. In
contrast to $COLORTERM for which no spec seems to exist, that one
actually does have a spec: https://no-color.org/

It might make sense for those interested in other distros than Fedora to
maybe ask for similar changes for their ssh and color shell prompt
packages (if they have something coresponding).

8 months agobuild: add C23 support (#35085)
Luca Boccassi [Mon, 17 Mar 2025 11:29:33 +0000 (11:29 +0000)] 
build: add C23 support (#35085)

To support C23, this introduces UTF8() macro to define UTF-8 literals,
as C23 changed char8_t from char to unsigned char.
This also makes pointer signedness warning critical, and updates C
standards table for tests.

8 months agoudev: several follow-ups and cleanups for builtin commands (#36768)
Lennart Poettering [Mon, 17 Mar 2025 09:42:55 +0000 (10:42 +0100)] 
udev: several follow-ups and cleanups for builtin commands (#36768)