Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post-fs-data: Mount cacerts ourselves and unmount shadowed mount points #88

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

chenxiaolong
Copy link
Owner

During early boot, Magisk first runs all post-fs-data.sh scripts and then it mounts each module's <module dir>/system overrides. This breaks support for using custom CA certs via the system-ca-certs module if it just so happens that filesystem ordering causes Custota to be loaded before system-ca-certs. Custota's gathering of the system certs would run before system-ca-certs, but Magisk's mounting of the resulting files would run after.

To make things easier to troubleshoot, both modules now use the module ID as the arbitrary string for the source device for the mount instead of just tmpfs.

This commit additionally fixes another issue with the upcoming version of Magisk. Magisk appears to "clean up" shadowed mount points now instead of just keeping them around and relying on Linux's last mount point wins behavior. However, it seems to keep the first mount around instead of the last mount, breaking the usual assumptions. To avoid this, both modules will now unmount all previous mounts on the cacerts directories before creating the new bind mounts.

Fixes: #87

During early boot, Magisk first runs all `post-fs-data.sh` scripts and
then it mounts each module's `<module dir>/system` overrides. This
breaks support for using custom CA certs via the system-ca-certs module
if it just so happens that filesystem ordering causes Custota to be
loaded before system-ca-certs. Custota's gathering of the system certs
would run before system-ca-certs, but Magisk's mounting of the resulting
files would run after.

To make things easier to troubleshoot, both modules now use the module
ID as the arbitrary string for the source device for the mount instead
of just `tmpfs`.

This commit additionally fixes another issue with the upcoming version
of Magisk. Magisk appears to "clean up" shadowed mount points now
instead of just keeping them around and relying on Linux's last mount
point wins behavior. However, it seems to keep the first mount around
instead of the last mount, breaking the usual assumptions. To avoid
this, both modules will now unmount all previous mounts on the cacerts
directories before creating the new bind mounts.

Fixes: #87

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
@chenxiaolong chenxiaolong self-assigned this Oct 6, 2024
@chenxiaolong chenxiaolong merged commit 8276342 into master Oct 8, 2024
6 checks passed
chenxiaolong added a commit that referenced this pull request Oct 8, 2024
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
@chenxiaolong chenxiaolong deleted the cert-mount branch October 8, 2024 01:01
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.

9/DOWNLOAD_TRANSFER_ERROR
1 participant