Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 2bd8e863 authored by UpInTheAir's avatar UpInTheAir Committed by alexax66
Browse files

cifs: enable mounting cifs drives visible to all apps


Restrict slave mountspace so Dalvik apps can mount system-wide volumes

Android 4.2 implements multi-user storage using per-process mount
namespaces. Everything under / (the entire filesystem hierarchy) is
marked as a recursive-slave mountspace for all zygote instances. This is
done so that user-storage sandbox mounts under /storage/emulated are hidden
from other apps and users.

Unfortunately this means that any Dalvik app (actually, any program whose
clone/fork ancestry includes a Dalvik zygote, which is everything except
services spawned directly from init) cannot mount system-wide volumes.
Thus, apps like CifsManager are effectively broken in Android 4.2, since
its cifs mounts are only visible to the CifsManager app itself. All other
apps see empty mountpoints instead of the mounted volume. Furthermore,
Linux provides no provision for a process to escape a recursive-slave
mountspace in versions prior to Linux 3.8 (setns syscall).

Here, we restrict rootfs-slave calls to /storage (and, due to a possible
kernel bug, /mnt/shell/emulated) so that Dalvik apps can mount system-wide
volumes elsewhere (with appropriate permission, as in earlier versions of
Android), while retaining full multi-user storage compatibility. It is
made available as a kernel-based workaround for instances where libdvm can
not be modified.

This change requires that a tmpfs volume is mounted as /storage in init.rc.
If this volume is unavailable, then we falls back to the previous behavior
of marking the entire filesystem hierarchy as slave.

*** Do not commit to CyanogenMod Project kernels, as a similar workaround
for this problem is patched in Zygote/Dalvik/libdvm instead. ***

Signed-off-by: default avatarUpInTheAir <upintheair.xda@gmail.com>

Used commit: https://github.com/Hybridmax/G92XF_Mystery_Kernel_Old/commit/cfa13e6b0b99ca3a5a0483bed79962360ef58b3e
parent 96ff03c9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment