Managed to finally try GrapheneOS on my Pixel 6a but one thing that I've noticed is that proot-distro (userspace chroot utilizing ptrace) inside termux is rather slow -- takes like 15 seconds to open nvim. Did some stracing and noticed that nvim stats quite a number of non-existent files and such stat takes relatively huge amount of time counted in milliseconds. Came up with this simple test program for stating non-existent "foo" file 100000 of times:
#include <sys/stat.h>
int main() {
struct stat st;
for (int i = 0; i < 100000; i++) {
stat("foo", &st);
}
return 0;
}
- On a PC or on GrapheneOS in
termux directly it executes in no time (less than a second).
- On Pixel 4a running LineageOS inside
proot-distro it takes much more time: a bit more than 8 seconds.
- When I first tried it on GrapheneOS, probably 1-2 updates before latest stable, it took about 27 seconds.
- Now that I've tried with latest updates: first run took 1m35s, second 1m53s, third took 2m6s. So it's already prohibitively long and appears to take more time with each run.
Does anyone know what it's caused by? Is there some ptrace hardening? Can it be disabled for termux?