update: userprog (tee, tsh, sleep, hex2bin)

This commit is contained in:
2026-01-01 04:22:30 +00:00
parent cf722d75ff
commit 79f46aa971
22 changed files with 1196 additions and 47 deletions
+62
View File
@@ -0,0 +1,62 @@
.section .data
msg_normal: .ascii "Normal exit.\n"
msg_secret: .ascii "SUCCESS! Secret function executed!\n"
.section .text
.global _start
# --------------------------------------------------------
# [ ]
# --------------------------------------------------------
secret_function:
# "SUCCESS! ..."
mov $4, %eax # sys_write
mov $1, %ebx # stdout
mov $msg_secret, %ecx
mov $35, %edx # length
int $0x80
#
xor %ebx, %ebx
mov $1, %eax # sys_exit
int $0x80
# --------------------------------------------------------
# [ ] 4 100
# --------------------------------------------------------
vuln_func:
# ( 4)
sub $4, %esp
# sys_read(stdin, buffer=esp, len=100)
mov $3, %eax # sys_read
xor %ebx, %ebx # stdin (0)
mov %esp, %ecx # buffer ( )
mov $100, %edx # [] 4 100 !
int $0x80
#
add $4, %esp
# [ ]
# (RET) ,
# RET ? -> !
ret
# --------------------------------------------------------
# [ ]
# --------------------------------------------------------
_start:
call vuln_func
# ( )
mov $4, %eax
mov $1, %ebx
mov $msg_normal, %ecx
mov $13, %edx
int $0x80
#
xor %ebx, %ebx
mov $1, %eax
int $0x80