Related question here which gives all the gory details (that I won't repeat in this question), motivations and context.

Android is a Linux kernel based system. I know quite well about mount(2) and mount(8) and the filesystems on Linux.

Can the SD card in a tablet be mounted (e.g. as an Ext4 file system) without the MS_NOSUID flag? If yes, how?

I am willing and capable of writing, cross-compiling, and building a statically linked ELF executable (for my ARM-based tablet), which is root-setuid and mixes the features of sudo and sash on my Debian system. I am capable of formatting some SD card (on my Debian) as an Ext4 filesystem. And if I know how to install and run it on my tablet, I will write that program as a GPLv3+ software (in C).

A related question is what exact cross GCC compiler should I use on Debian/x86-64 to target such an ARM tablet.


1 Answer 1

  • External storage (/sdcard) and physically external storage both are mounted by vold with nosuid irrespective of the filesystem, can't be mounted other way without root.
  • Both storages are accessible to apps as emulated filesystem (with fixed file permissions) or through SAF; both don't let files be executed.
  • You can move ELF executable to somewhere on /data e.g. to /data/local/tmp/ using adb shell or to /data/data/com.termux/files/home/ using Termux app. /data is formatted as ext4 or f2fs, lets file permissions be set, so you can execute files there. But that too is mounted with nosuid by default.
  • Android apps are run with all Linux capabilities dropped (empty bounding set and NO_NEW_PRIVS set), so they can't make use of setuid or file capabilities to elevate their privileges.

You may want to have a look at How Magisk works? or How to manually root a phone? to see how root works on Android devices, not possible with locked bootloader.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .