Skip to content

Conversation

@danzatt
Copy link
Contributor

@danzatt danzatt commented Oct 13, 2025

In Flatcar we are using modprobe helpers that run depmod in temporary overlay. systemd-udevd.service may try to load drivers for some block devices (e.g. ZFS), which ends up calling our helpers, which invoke mount command. The mount syscalls are forbidden by the default systemd-udevd syscall filter.

@pothos
Copy link
Member

pothos commented Oct 13, 2025

Instead of patching the source, can we ship a unit drop in?

@github-actions
Copy link

github-actions bot commented Oct 13, 2025

@chewi
Copy link
Contributor

chewi commented Oct 13, 2025

Instead of patching the source, can we ship a unit drop in?

Indeed, that is what I was expecting. The SystemCallFilter setting is cumulative.

@pothos
Copy link
Member

pothos commented Oct 13, 2025

One can argue where this would go, e.g., we have some drop-ins in https://github.com/flatcar/init/tree/flatcar-master/systemd/system

@danzatt
Copy link
Contributor Author

danzatt commented Oct 16, 2025

I was discussing with @t-lo, and he suggested it would be better to ship it directly in a systemd package instead of baselayout. But yeah, it might be easier to ship it in init/baselayout so that we don't have to maintain yet another patch.

@pothos
Copy link
Member

pothos commented Oct 20, 2025

The package is also a good place: the drop-in file can be brought in through the ebuild installing it instead of a source patch

@chewi
Copy link
Contributor

chewi commented Oct 20, 2025

Our systemd package is currently forked from Gentoo, but ideally we would unfork it at some point. You could add the drop-in using a post_src_install function. We already do exactly this for timesyncd in sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-apps/systemd.

Copy link
Contributor

@chewi chewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to put this in the cros_post_src_install_timesync function. You can create another function called cros_post_src_install_udev.

@danzatt danzatt force-pushed the danzatt/fix-modprobe-via-udevd branch from a96a073 to 7ac5bbf Compare November 3, 2025 11:30
Comment on lines 17 to 28
mkdir -p "${dir}"
pushd "${dir}"
cat <<EOF >flatcar.conf || die
# In Flatcar we are using modprobe helpers that run depmod in temporary
# overlay. systemd-udevd.service may try to load drivers for some block devices
# (e.g. ZFS), which ends up calling our helpers, which invoke mount command.
# The mount syscalls are forbidden by the default systemd-udevd syscall filter.

[Service]
SystemCallFilter=@mount
EOF
popd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I should have spotted this before. You've based this on the other function, but it doesn't use || die enough and doesn't use ebuild helpers either. Don't feel you have to waste CI time running it again though, a local build is enough to check this.

Suggested change
mkdir -p "${dir}"
pushd "${dir}"
cat <<EOF >flatcar.conf || die
# In Flatcar we are using modprobe helpers that run depmod in temporary
# overlay. systemd-udevd.service may try to load drivers for some block devices
# (e.g. ZFS), which ends up calling our helpers, which invoke mount command.
# The mount syscalls are forbidden by the default systemd-udevd syscall filter.
[Service]
SystemCallFilter=@mount
EOF
popd
insinto "$(systemd_get_systemunitdir)/systemd-udevd.service.d"
newins - flatcar.conf <<EOF
# In Flatcar we are using modprobe helpers that run depmod in temporary
# overlay. systemd-udevd.service may try to load drivers for some block devices
# (e.g. ZFS), which ends up calling our helpers, which invoke mount command.
# The mount syscalls are forbidden by the default systemd-udevd syscall filter.
[Service]
SystemCallFilter=@mount
EOF

@danzatt
Copy link
Contributor Author

danzatt commented Nov 5, 2025

Thanks for the feedback! Updated the implementation to use proper ebuild helpers (insinto and newins) as suggested. The code now follows the recommended pattern and should be ready for merging. @chewi

@danzatt danzatt force-pushed the danzatt/fix-modprobe-via-udevd branch from 7ac5bbf to eaa4279 Compare November 5, 2025 08:36
Copy link
Contributor

@chewi chewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Sorry for all the round trips.

In Flatcar we are using modprobe helpers that run depmod in temporary
overlay. systemd-udevd.service may try to load drivers for some block
devices (e.g. ZFS), which ends up calling our helpers, which invoke
mount command. The mount syscalls are forbidden by the default
systemd-udevd syscall filter.

Signed-off-by: Daniel Zatovic <[email protected]>
@danzatt danzatt force-pushed the danzatt/fix-modprobe-via-udevd branch from eaa4279 to 8e94ac0 Compare November 5, 2025 16:53
@danzatt danzatt enabled auto-merge (squash) November 5, 2025 16:55
@danzatt danzatt disabled auto-merge November 5, 2025 17:17
@danzatt danzatt merged commit 2aaa758 into main Nov 5, 2025
4 of 5 checks passed
@chewi chewi deleted the danzatt/fix-modprobe-via-udevd branch November 14, 2025 10:42
@chewi
Copy link
Contributor

chewi commented Nov 14, 2025

Oops, this should have had a changelog entry. Please use the PR template in future.

@chewi
Copy link
Contributor

chewi commented Nov 14, 2025

The missing changelog has been added to 4515 and the fix (with the changelog) has been backported to 4459.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants