All the credits go to: iximeow (aka pipeline staller)
See the thread for details.
-
Compile
nasm-stub.rs
rustc nasm-stub.rs
-
Install it as
/usr/local/bin/nasm-stub
cp nasm-stub /usr/local/bin/
-
Install binfmt handler
cp nasm.conf /etc/binfmt.d/
Note that we install the compiled stub as the handler for
;x08#!
head -c 4 helloworld.asm | hd 00000000 3b 08 23 21 |;.#!| 00000004
-
Activate handler
systemctl restart systemd-binfmt.service
-
Play
./helloworld