这是indexloc提供的服务,不要输入任何密码
Skip to content

[Bug]: Termux proceeses lose ability to read files after entering a pivot_root jail from shell (?) #4130

@maakiopus

Description

@maakiopus

Problem description

Termux loses the ability to read any files after I use unshare and pivot_root to shell into a ubuntu chroot
Which somehow causes termux-x11 to crash and termux to not be able to open any new sessions than already open

Steps to reproduce the behavior.

On a device rooted with kernelSU, run (might work with magisk aswell)

# Setup a mini root for pivot_root 
wget "https://dl-cdn.alpinelinux.org/alpine/v3.20/releases/aarch64/alpine-minirootfs-3.20.2-aarch64.tar.gz"
mkdir chroot
tar xvf "alpine-minirootfs-3.20.2-aarch64.tar.gz" -C chroot


# create a namespace and pivot_root into the chroot directory
su -c unshare -p -m -f sh -c \
	"echo noop;\
	mkdir -p chroot/old_root;\
	mount --bind chroot chroot;\
	busybox pivot_root chroot chroot/old_root;\
	/bin/mount proc -t proc /proc;\
	/bin/mount sys -t sysfs /sys;\
	/bin/mount --bind /old_root/dev /dev;\
	/bin/mount --bind /old_root/dev/pts /dev/pts;\
	/bin/mount --bind /old_root/storage/emulated/0 /sdcard;\
	/bin/mount --bind /old_root$PREFIX/tmp/ /tmp/;\
	/bin/su -l"

Script for convenience
repro.sh.txt

What is the expected behavior?

No crash of termux-x11 and other termux proceeses

System information

  • Termux application version: 0.119.0-beta.1
  • Android OS version: 14 UKQ1.240716.001
  • Device model: Xiaomi Pad 6 Running AOSPA

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions