2
2
Fork
You've already forked asmhttpd
0
A minimalist HTTP server for Linux, written in x86_64 assembly https://git.wbinvd.org/asmhttpd
  • Assembly 99.4%
  • Makefile 0.6%
Find a file
Calvin Owens 9295b1895e Fix unmapping logic to handle CONFIG_MSEAL_SYSTEM_MAPPINGS=y
On kernels built with this compile-time option enabled, it isn't
possible to remove the VDSO and its companion mappings:
 7f2a0adab000-7f2a0adaf000 r--p 00000000 00:00 0 [vvar]
 7f2a0adaf000-7f2a0adb1000 r--p 00000000 00:00 0 [vvar_vclock]
 7f2a0adb1000-7f2a0adb3000 r-xp 00000000 00:00 0 [vdso]
Add some fallback logic so the stack is still unmapped in this case:
 munmap(0x402000, 140737484148736) = -EPERM
 munmap(0x7ffc6c3af000, 15364063232) = 0
 munmap(NULL, 4198399) = 0
All this unmapping is just vanity anyway, so ignore errors from munmap()
in the hope of making this more future proof.
2026年05月10日 08:29:48 -07:00
.gitignore Rename project to "asmhttpd" 2013年03月24日 14:17:28 -05:00
asmhttpd.asm Fix unmapping logic to handle CONFIG_MSEAL_SYSTEM_MAPPINGS=y 2026年05月10日 08:29:48 -07:00
constants.inc Fix stale comments 2023年09月14日 03:37:24 -07:00
LICENSE Combine source into a single file 2021年11月15日 23:12:16 -08:00
MACROS Update MACROS 2021年11月15日 23:41:42 -08:00
Makefile Combine source into a single file 2021年11月15日 23:12:16 -08:00
README Actually reduce runtime usage to one 4K page 2021年12月04日 09:59:47 -08:00
syscall.inc Use decimal for syscall number constants 2021年11月25日 11:20:38 -08:00

asmhttpd - The tiniest webserver ever written
HOW TO BUILD:
-------------
	Just run "make". You will need NASM on your system.
HOW TO RUN:
-----------
	./asmhttpd /path/to/your/webroot
	sudo ./asmhttpd /path/to/your/webroot
If run as root, it will listen on port 80. Otherwise, it will use port 8080.
HOW TINY IS IT?
---------------
The entire text and data fit on a single 4K page:
 {0}[calvin ~] cat /proc/$(pgrep -n asmhttpd)/maps
 00401000-00402000 r-xp 00001000 00:16 2483272 asmhttpd
Each client allocates an additional 4K page and a thread while connected.
The code is written in a monolithic "branching tree" style with no functions,
and uses registers for all local variables. RAM is only used for buffering the
HTTP request, and for building structures necessary for system calls.
Because there is no stack, and the targets of all branch instructions are
constants, traditional buffer overflow exploits are impossible.