Skip to content

Improve mount namespace transfer#89

Merged
JingMatrix merged 3 commits intomasterfrom
namespace
Feb 1, 2026
Merged

Improve mount namespace transfer#89
JingMatrix merged 3 commits intomasterfrom
namespace

Conversation

@JingMatrix
Copy link
Copy Markdown
Owner

On some device (Android 12, arm 32 bit), the mount namespace transfer could fail due to permission denial.

open mount namespace path [/proc/521/fd/9] failed with 13: Permission denied

We should thus implement a fallback mechanism of namespace transfer.

On certain devices (specifically observed on Android 12, arm32), the previous method of transferring the mount namespace failed with: `open mount namespace path [/proc/xxx/fd/y] failed with 13: Permission denied`.

This commit refactors the namespace transfer mechanism to use direct File Descriptor passing via Unix domain sockets (SCM_RIGHTS).

Changes:
- Replaced the protocol: The daemon now sends a status byte followed immediately by the FD using `send_fd`, rather than sending the PID and raw FD integer.
- The client no longer constructs a `/proc/...` string or calls `open()`. It receives the FD directly and passes it to `setns()`.
- Added a status byte check to the protocol to prevent stream desynchronization when the namespace is not cached.
@JingMatrix JingMatrix merged commit 038ab9e into master Feb 1, 2026
1 check passed
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.

[Bug] Crash Magisk "Restore the Magisk app" Support for Android 12 arm 32-bit device

1 participant