Skip to content
Advertisement

Tag: assembly

ELF label address

I have the following code in .s file: Its object file has the following: After linking, it becomes: How does the argument 0x0 to pushq at byte 20 of the object file gets converted to 0x400578 in the final executable? Which section of the object file contains this information? Answer You answered your own question: After linking…. Here is a

Buffer Overflow: NOP sled not working [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 5 years ago. Improve this question Hey I’m trying to do a buffer overflow on a basic C program,

Reading user input as an integer

I wrote an Assembly program (x86_64 Linux NASM) that prints an integer to console, based in the algorithm suggested my the comments in this post, which is basically this: All works just fine under the following script: After compiling it, the number 567 gets printed on the screen (console). But if I try to do the same but allowing the

Scanf a char pointer in Assembly

So I have a task to do, which requires from me to scanf a char* in assembly. I tried this code: It writes down first printf correctly, then it waits for input (so scanf works), but then when I enter anything -> Segmentation fault. I know, that the char* should be somehow initialized, but how can I do it from

What is the difference between retq and ret?

Let’s consider the following program, which computes an unsigned square of the argument: This is properly compiled by as, but disassembles to Is there any difference between ret and retq? Answer In long (64-bit) mode, you return (ret) by popping a quadword address from the stack to %rip. In 32-bit mode, you return (ret) by popping a dword address from

push/pop segmentation fault in simple multiplication function

my teacher is doing a crash course in assembly with us, and I have no experience in it whatsoever. I am supposed to write a simple function that takes four variables and calculates (x+y)-(z+a) and then prints out the answer. I know it’s a simple problem, but after hours of research I am getting no where, any push in the

Running 32-bit code in 64-bit process on Linux – memory access

I’m experimenting with running 32-bit code inside a 64-bit Linux process. The 32-bit code is completely self-contained, it makes direct IA32 system calls on its own. If I were to load this code in a 32-bit process, it would run just fine. Initially, I thought I could just allocate a stack for the 32-bit code, switch to it and everything

Advertisement