Repository navigation
Description
Kernel Version
4.19.191+ #1 SMP PREEMPT aarch64 (note: this is a kernel-independent capability handling bug in src/security/caps.c)
Kernel Source Link (REQUIRED)
Stock non-GKI 4.19 kernel (no custom kernel modifications; the same issue is purely caused by how APatch populates CapAmb/CapInh and how ds_apply_capability_hardening() only drops CapBnd).
Droidspaces Version
v7.2.0 (confirmed src/security/caps.c is unchanged on main at 77e63323)
Rooting Method
APatch (0f3f42ba:APatch(FolkPatch)) — verified that the exact same Artix rootfs works without issue on an identical TCL 9463A rooted with Magisk.
Device OEM & Model
TCL 9463A1
Android Version & ROM
Android 13 (TP1A.220624.014)
Execution Mode
Both
Networking Mode
NAT
Describe the Bug
On devices rooted with APatch, apd spawns both post-fs-data.sh (which launches droidspacesd) and su shells with all inheritable and ambient capabilities set (CapInh=0000003fffffffff, CapAmb=0000003fffffffff), whereas Android's PID 1 init and Magisk leave both at 0.
In src/security/caps.c, ds_apply_capability_hardening() drops 10 capabilities from the bounding set (prctl(PR_CAPBSET_DROP, ...)), but does not clear CapAmb (PR_CAP_AMBIENT_CLEAR_ALL) or CapInh (via capset()). As a result, PID 1 inside the container (and processes spawned via enter / run) inherit CapInh and CapAmb containing capabilities that are no longer in CapBnd:
CapInh: 0000003fffffffff
CapPrm: 0000003fffffffff
CapEff: 0000003fffffffff
CapBnd: 00000004ffe4fffb
CapAmb: 0000003fffffffff
When dbus-daemon starts inside the container (Artix OpenRC), it attempts to drop capabilities via libcap-ng and immediately fails:
dbus-daemon[1301]: Failed to start message bus: Failed to drop capabilities: Operation not permitted
Because dbus fails to start, NetworkManager cannot connect to D-Bus and stays inactive, so eth0 never obtains its NAT DHCP lease and the container has no network (Network is unreachable).
Additionally, leaving CapAmb=0000003fffffffff on container PID 1 means processes inside the container inherit ambient capabilities unexpectedly.
Steps to Reproduce
- Root a device with APatch (confirm
su -c 'grep ^Cap /proc/self/status'shows non-zeroCapInhandCapAmb). - Install and start an Artix Minimal (OpenRC) container in NAT mode.
- Observe
rc-statusinside the container:dbusis[ failed ],NetworkManageris[ inactive ], andeth0has no IPv4 address. - Run
dbus-daemon --system --nofork --print-addressas root inside the container → fails withFailed to drop capabilities: Operation not permitted. - Run
setpriv --inh-caps=-all --ambient-caps=-all dbus-daemon --system --nofork --print-address→ starts cleanly, andNetworkManagerimmediately brings upeth0with DHCP and working DNS.
Logs / Screenshots
Host PID 1 vs droidspacesd and su on APatch:
# Host /proc/1/status
Name: init
CapInh: 0000000000000000
CapPrm: 0000003fffffffff
CapEff: 0000003fffffffff
CapBnd: 0000003fffffffff
CapAmb: 0000000000000000
# Host droidspacesd (/proc/731/status) & APatch su shell
Name: droidspaces
CapInh: 0000003fffffffff
CapPrm: 0000003fffffffff
CapEff: 0000003fffffffff
CapBnd: 0000003fffffffff
CapAmb: 0000003fffffffff
Container PID 1 (/proc/1/status inside Artix):
CapInh: 0000003fffffffff
CapPrm: 0000003fffffffff
CapEff: 0000003fffffffff
CapBnd: 00000004ffe4fffb
CapAmb: 0000003fffffffff
After clearing ambient and inheritable caps (setpriv --inh-caps=-all --ambient-caps=-all grep ^Cap /proc/self/status):
CapInh: 0000000000000000
CapPrm: 00000004ffe4fffb
CapEff: 00000004ffe4fffb
CapBnd: 00000004ffe4fffb
CapAmb: 0000000000000000
Suggested Fix
In ds_apply_capability_hardening() (src/security/caps.c, called from src/boot/init.c:509, src/container/exec.c:168, and src/container/exec.c:350):
- Clear ambient capabilities with
prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0)(even before theDS_PRIV_NOCAPSearly return, since normal Linuxinitnever starts with ambient caps set). - Clear
inheritableviacapget()/capset()(withcap_user_header_tversion_LINUX_CAPABILITY_VERSION_3), so the subsequentexecve()starts the container's init / shell withCapInh=0,CapAmb=0, andCapPrm=CapEff=CapBnd.
Required Acknowledgments
- I have verified this is not a duplicate issue.
- I am using a kernel compiled strictly according to Droidspaces' official documentation.
- I am NOT using a kernel with 69+ random configs, CRC nukes, or a broken ABI.
- I have confirmed this issue persists in both Daemon and Direct modes.
- I admit that I am a clown for checking this box, confirming I have NOT read these rules.
- I admit I did zero research, didn't ask my AI waifu for a fix, and am dropping this here because I'm 100% sure the fault lies with Droidspaces.
Activity
ravindu644 commentedon Dec 3, 2026
Thanks for the detailed report, you were right, and it was worse than the dbus breakage. On a root exec the kernel sets the new permitted set to
bounding | inheritable, so with APatch's full inheritable set every capability we drop from the bounding set came straight back in the container. That's why your PID 1 hadCapPrm/CapEff = 3fffffffffnext to a hardenedCapBnd.Fixed in aeeafc4.
ds_apply_capability_hardening()now empties the inheritable set before the bounding drops.capset()trims ambient topermitted & inheritable, so that clears ambient as well, no separatePR_CAP_AMBIENT_CLEAR_ALLneeded. It covers boot,enterandrun, and does nothing on root solutions that already leave inheritable at zero (Magisk, KernelSU).I reproduced your cap state on a KernelSU device by raising inheritable + ambient to full before starting the container:
I couldn't test dbus itself on APatch, so please grab the build from this CI run and confirm that
dbusandNetworkManagercome up on your TCL: https://github.com/ravindu644/Droidspaces-OSS/actions/runs/47076370653 (artifactdroidspaces-artifacts). It will be in the next release.fix(security): clear inheritable caps before the bounding set drops