rust-teeny(opt): optimize size further

This commit is contained in:
2026-06-16 21:38:40 +02:00
parent 74b82edd18
commit 5bc6a32c6a
3 changed files with 15 additions and 3 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
Tiny stripped rust binary (8.6 KiB, x86_64, dynamic libc) that loads and executes a shellcode payload built into it.
Tiny stripped rust binary (8.0 KiB, x86_64, dynamic libc) that loads and executes a shellcode payload built into it.
## Building
@@ -13,3 +13,4 @@ The code is completely correct, checks `mmap` and `mprotect` succeeded, the code
- Memory mapping a RWX page directly, some protected kernel builds require `RW` -> `RX` transition though.
- Assuming mmap and mprotect succeeded, no modern kernel should fail on `mmap` even if out of memory, the mapping is done regardless and memory actually reserved once used. `mprotect` shouldn't fail either if done correctly (man page mentions failures because no memory, which I said shouldn't happen, invalid permission combinations and invalid, which don't happen if you do correct permissions and valid pointers, or rare permission cases).
- `no_std`, this barely needs std, could just hardcode the 3-4 syscalls present and don't use `std` at all. This code also hardcoded `libc` values before so that's not needed either, but I think `libc` has `no_std` support either way.
- 0.1 KiB can be removed if you get rid of `.gnu.hash` and `.gnu.version` sections, but I think those can be required on other machines, not on mine though.