Differences between the outputs of the build code of the same program

I tried to repeat the buffer overflow example from this article by aleph one

I do this as a practice for a project in the computer security course that I take, so please, I really need your help. I followed suit while carrying out tasks along the way. My problem is that the assembler code downloaded gdbon my computer (I do it on a Debian Linux image running on VM Ware) is different from what is shown in the example in the article. There are some designs that I find confusing.

Here is the one from my computer: alt text

here is one from the article ...

Dump of assembler code for function main:
0x8000490 <main>:       pushl  %ebp
0x8000491 <main+1>:     movl   %esp,%ebp
0x8000493 <main+3>:     subl   $0x4,%esp
0x8000496 <main+6>:     movl   $0x0,0xfffffffc(%ebp)
0x800049d <main+13>:    pushl  $0x3
0x800049f <main+15>:    pushl  $0x2
0x80004a1 <main+17>:    pushl  $0x1
0x80004a3 <main+19>:    call   0x8000470 <function>
0x80004a8 <main+24>:    addl   $0xc,%esp
0x80004ab <main+27>:    movl   $0x1,0xfffffffc(%ebp)
0x80004b2 <main+34>:    movl   0xfffffffc(%ebp),%eax
0x80004b5 <main+37>:    pushl  %eax
0x80004b6 <main+38>:    pushl  $0x80004f8
0x80004bb <main+43>:    call   0x8000378 <printf>
0x80004c0 <main+48>:    addl   $0x8,%esp
0x80004c3 <main+51>:    movl   %ebp,%esp
0x80004c5 <main+53>:    popl   %ebp
0x80004c6 <main+54>:    ret
0x80004c7 <main+55>:    nop

As you can see, there are differences between them. I am confused and cannot fully understand the assembly code from my computer. I would like to know the differences between the two.

pushl push, mov vs movl .....

0xhexavalue(%register)?

, , .

UPDATE:

function :

, 1, 2 & 3, .

"esp" .

?

...

+3
3

, / . , -.

push vs. pushl () - , . , . Intel . mov movl. , , l, .

0xhexvalue(%register) hexvalue register. C *(register + hexvalue).

+4

. "movl" "move long" - .. 32- . . , , "l", (, EAX, 32- , EAX - 32- , ECX, 32- , ECX 32- ).

, , , .

+4

Aleph One 96-, . 14 GCC -, . (gcc -O0) (gcc -g), , /.

0

Source: https://habr.com/ru/post/1750335/


All Articles