Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
margesch opened this issue Aug 15, 2020 · 3 comments
Closed

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

margesch opened this issue Aug 15, 2020 · 3 comments

Comments

@margesch
Copy link

margesch commented Aug 15, 2020

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
Copy link
Owner

nemasu commented Aug 16, 2020

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

@margesch
Copy link
Author

margesch commented Aug 29, 2020

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
Copy link

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

@nemasu nemasu closed this as completed Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants