Why does my assembly network server application cause a segmentation fault?
I'm working on a network server application in assembly language so I can understand low level networking concepts.
So I've implemented a socket server using assembly language system calls, but I'm encountering a segmentation fault during execution.
I have complied the binary on an
Intel Core i7 12700K processor
running Ubuntu 22.04
and the NASM assembler
.
I wander what is causing the segmentation fault ?
6 Replies
@Marvee Amasi Since you compiled the code in
32-bit
mode (-f elf32
), re-check that your code is aligned with 32-bit
conventions and that you aren’t inadvertently mixing 64-bit
and 32-bit
instructions or registers, Also to accurately diagnose this issue you should use tools like gdb
to debug the binary
and locate where the segmentation
fault occurs and Identify the exact instruction causing the fault
Thanks @Enthernet Code , so I used a debugger I have noticed that rip is overwritten with a not existent address. So I have added an exit at the end and now I do not receive any segmentation fault. I think I did the right thing
That's Nice @Marvee Amasi
Thanks again , we could dodge using a debugger in many languages, but not assembly 😂