[Galaxy S III Original Android Development] Tungstwenty:
Does anyone gasp mount --bind?

I don't know it very well but have heard about it before and googled around.

I found this page and the 2nd answer almost gave a working solution :mad:

[COLOR="DarkRed"]~ # cd /data/local/tmp[/COLOR]
cd /data/local/tmp
[COLOR="DarkRed"]/data/local/tmp # df -h .[/COLOR]
df -h .
Filesystem Size Used Available Use% Mounted on
/res/dev/data 2.0G 1.8G 210.1M 90% [COLOR="Red"]/data[/COLOR]
[COLOR="DarkRed"]/data/local/tmp # mkdir _hidden_dir_[/COLOR]
mkdir _hidden_dir_
[COLOR="DarkRed"]/data/local/tmp # chown 0.0 _hidden_dir_[/COLOR]
chown 0.0 _hidden_dir_
[COLOR="DarkRed"]/data/local/tmp # chmod 755 _hidden_dir_[/COLOR]
chmod 755 _hidden_dir_
[COLOR="DarkRed"]/data/local/tmp # mkdir _hidden_dir_/system[/COLOR]
mkdir _hidden_dir_/system
[COLOR="DarkRed"]/data/local/tmp # chmod 755 _hidden_dir_/system[/COLOR]
chmod 755 _hidden_dir_/system
[COLOR="DarkRed"]/data/local/tmp # mkdir _hidden_dir_/system/xbin[/COLOR]
mkdir _hidden_dir_/system/xbin
[COLOR="DarkRed"]/data/local/tmp # chmod 755 _hidden_dir_/system/xbin[/COLOR]
chmod 755 _hidden_dir_/system/xbin
[COLOR="DarkRed"]/data/local/tmp # cp -p /system/xbin/su _hidden_dir_/system/xbin/[/COLOR]
cp -p /system/xbin/su _hidden_dir_/system/xbin/
[COLOR="DarkRed"]/data/local/tmp # id[/COLOR]
id
uid=0([COLOR="Green"]root[/COLOR]) gid=0(root)
[COLOR="DarkRed"]/data/local/tmp # su - shell[/COLOR]
su - shell
[COLOR="DarkRed"]shell@android:/data/local/tmp $ id[/COLOR]
id
uid=2000([COLOR="Green"]shell[/COLOR]) gid=2000(shell)
[COLOR="DarkRed"]shell@android:/data/local/tmp $ ./_hidden_dir_/system/xbin/su[/COLOR]
./_hidden_dir_/system/xbin/su
[COLOR="DarkRed"]shell@android:/data/local/tmp $ ./_hidden_dir_/system/xbin/su[/COLOR]
./_hidden_dir_/system/xbin/su
[COLOR="DarkRed"]shell@android:/data/local/tmp $ id[/COLOR]
id
uid=2000([COLOR="red"]shell[/COLOR]) gid=2000(shell)
[COLOR="DarkRed"]shell@android:/data/local/tmp $ mount | grep /data[/COLOR]
mount | grep /data
/res/dev/data on /data type ext4 (rw,[COLOR="red"]nosuid[/COLOR],nodev,noatime,barrier=1,data=ordered,noauto_da_alloc)
[COLOR="DarkRed"]shell@android:/data/local/tmp $ exit[/COLOR]
exit
[COLOR="DarkRed"]shell@android:/data/local/tmp $ exit[/COLOR]
exit
[COLOR="DarkRed"]/data/local/tmp # mount --bind /data/local/tmp/_hidden_dir_/system /tmp[/COLOR]
mount --bind /data/local/tmp/_hidden_dir_/system /tmp
[COLOR="DarkRed"]/data/local/tmp # mount | grep /tmp[/COLOR]
mount | grep /tmp
/res/dev/data on /tmp type ext4 ([COLOR="Red"]rw[/COLOR],[COLOR="red"]nosuid[/COLOR],nodev,noatime,barrier=1,data=ordered,noauto_da_alloc)
[COLOR="DarkRed"]/data/local/tmp # mount -o remount,ro,suid /tmp[/COLOR]
mount -o remount,ro,suid /tmp
[COLOR="red"]mount: mounting /res/dev/data on /tmp failed: Device or resource busy[/COLOR]
[COLOR="DarkRed"]/data/local/tmp # mount -o remount,ro /tmp[/COLOR]
mount -o remount,ro /tmp
[COLOR="red"]mount: mounting /res/dev/data on /tmp failed: Device or resource busy[/COLOR]
/data/local/tmp # mount -o remount,suid /tmp
mount -o remount,suid /tmp
[COLOR="DarkRed"]/data/local/tmp # mount | grep /tmp[/COLOR]
mount | grep /tmp
/res/dev/data on /tmp type ext4 (rw,nodev,noatime,barrier=1,data=ordered,noauto_da_alloc)
[COLOR="DarkRed"]/data/local/tmp # su - shell[/COLOR]
su - shell
[COLOR="DarkRed"]shell@android:/data/local/tmp $ id[/COLOR]
id
uid=2000(shell) gid=2000(shell)
[COLOR="DarkRed"]shell@android:/data/local/tmp $ /tmp/xbin/su[/COLOR]
/tmp/xbin/su
[COLOR="DarkRed"]shell@android:/data/local/tmp # id[/COLOR]
id
uid=0([COLOR="Green"]root[/COLOR]) gid=0(root)
[COLOR="DarkRed"]shell@android:/ # mount | grep /data[/COLOR]
mount | grep /data
/res/dev/data on /data type ext4 (rw,[COLOR="Green"]nosuid[/COLOR],nodev,noatime,barrier=1,data=ordered,noauto_da_alloc)
/res/dev/data on /tmp type ext4 (rw,nodev,noatime,barrier=1,data=ordered,noauto_da_alloc)

The remount with -o does work on a tmpfs, though. Tried it on one of the /mnt/xxx placeholders.

BUT, unlike suid which is kept independent for the 2 mounts pointing at the /data physical dev, ro is propagated. That's the reason for the "Device or resource busy" error and even if it worked it would render /data also ro. Any other mount options to circumvent that?

And something that's puzzling me: does the sdcard on the S3 use ext4 instead of vfat like the S2? Trying this same test on /sdcard fails for obvious reasons.