If you just set the environment variable (and use binfmt misc) it fails with a very weird error.
It can't run SUID executables.
I'm using this patch to work around some of this buy simply putting the path to the exe in the variable, however, it's not complete as I have to turn it off for SUID executables.
There are several ways this could be worked (all the way up to fakeroot/fakechroot support) but as I have solved my immediate problem (Which was to prevent x86 static executables running) it seemed best to just report this.
Commit 8952fce8 "linux-user: add option to intercept execve() syscalls" adds the ability to specify that only this copy of the QEMU executable will be used for execve.
It has some issues:
I'm using this patch to work around some of this buy simply putting the path to the exe in the variable, however, it's not complete as I have to turn it off for SUID executables.
There are several ways this could be worked (all the way up to fakeroot/fakechroot support) but as I have solved my immediate problem (Which was to prevent x86 static executables running) it seemed best to just report this.