Quickpost: Machine Code Infinite Loop
2022-4-30 16:4:25 Author: blog.didierstevens.com(查看原文) 阅读量:25 收藏

Quickpost: Machine Code Infinite Loop

Someone asked me what the byte sequence is for an infinite loop in x86 machine code (it’s something you could use while debugging, for example).

That byte sequence is just 2 bytes long: EB FE.

It’s something you can check with nasm, for example.

File jump-infinite-loop.asm:

BITS 32

loop1:
    jmp loop1
loop2:
    jmp short loop2
    jmp $
    jmp short $
    jmp short -2

nasm jump-infinite-loop.asm -l jump-infinite-loop.lst

File jump-infinite-loop.lst:

     1                                  BITS 32
     2                                  
     3                                  loop1:
     4 00000000 EBFE                        jmp loop1
     5                                  loop2:
     6 00000002 EBFE                        jmp short loop2
     7 00000004 EBFE                        jmp $
     8 00000006 EBFE                        jmp short $
     9 00000008 EB(FE)                      jmp short -2

Quickpost info


No comments yet.


文章来源: https://blog.didierstevens.com/2022/04/30/quickpost-machine-code-infinite-loop/
如有侵权请联系:admin#unsafe.sh