nemasu / asmttpd

Web server for Linux written in amd64 assembly.
GNU General Public License v2.0
3.03k stars 199 forks source link

I compiled It, get segmentation fault and cant curl it. #50

Closed margesch closed 3 years ago

margesch commented 4 years ago

I compiled it with nasm nasm -f elf64 main.asm -o main.o Then run ld -m elf_x86_64 main.o -o asmttpd Then on Ubuntu Subsystem Linux for Windows 10 after i chmod on it chmod -R 777 ./asmttpd I run it ./asmttpd web_root 8000 It gracefully try to bypass firewall by showing a pop up with option of Public and Private network. However it gives me segmentation fault (core dumped). And i can't curl on it, curl on localhost port 8000 connection refused. How to fix this?

nemasu commented 4 years ago

Hello, Hmm, I don't have WSL installed, maybe someone else could take a look at this?

margesch commented 4 years ago

So how to fix this did you figure it out? I try compiled release by all other versions , its just the same error. Try to run program in gdb: readelf -h ./asmttpd ./web_root | grep 'Entry point' Entry point: 0x400dba (gdb)b *0x400dba (gdb) Breakpoint 1 at: 0x400dba (gdb) r [Inferior 1 (process 39) exited normally] Try to modify source as well: cmp eax, 8 to cmp rax, 8 Try to remove segmentation fault as well main thread: mov rax, 8 ret Unfortunately how many effort i try still get segmentation fault. Notes: I just want to remove the segmentation fault (core dumped)?

ahmedalnuaimi commented 3 years ago

So how to fix this did you figure it out? I try compiled release by all other versions , its just the same error. Try to run program in gdb: readelf -h ./asmttpd ./web_root | grep 'Entry point' Entry point: 0x400dba (gdb)b *0x400dba (gdb) Breakpoint 1 at: 0x400dba (gdb) r [Inferior 1 (process 39) exited normally] Try to modify source as well: cmp eax, 8 to cmp rax, 8 Try to remove segmentation fault as well main thread: mov rax, 8 ret Unfortunately how many effort i try still get segmentation fault. Notes: I just want to remove the segmentation fault (core dumped)?

I could get it to run on WSL2 last year by changing the flags of sys_mmap_mem or sys_mmap_stack in syscall.asm