Level 1: Divide-by-zero exception analysis
input the command
cp /data/workspace/myshixun/exp1/1.1.tgz ~/os
cd ~/os/linux-0.11-lab
tar -zxvf ../1.1.tgz 1.1
rm -rf cur
ln -s 1.1 cur
cd 1.1/linux
make
Open another terminal
cd ~/os/linux-0.11-lab
./rungdb
Enter in the original terminal
cd ../..
./mygdb
debug gdb input
b main.c:147
c
x/6i $eip
si
si
si
info registers
si
info registers
Terminal picture after debugging
Finally remember to kill to exit gdb. Prevent it from affecting the next level
1. In the assembly instruction fragment corresponding to the statement "jiffies =jiffies/0;" in function main, there is an idiv instruction. What is the address of this instruction? (0x0000690e) 2. Before the idiv instruction is executed, the current instruction
position What are (CS:EIP) and stack position (SS:ESP) respectively? (0xf:0x690e) and (0x17:0x25760)
3. After executing the instruction using the si command, what are the new instruction position and stack position respectively? ( 0x8:0x814b) and (0x10:0x1fa2c)
4. What are the recovery point positions and user stack positions saved in the stack at this time? (0xf:0x690e) and (0x17:0x25760)
Level 2: int instruction analysis
Environmental preparation
cp /data/workspace/myshixun/exp2/1.tgz ~/os
cd ~/os/linux-0.11-lab
tar -zxvf ../1.tgz 1
rm -rf cur
ln -s 1 cur
cd 1/linux
make
Enter the gdb debugging input (see the previous level for gdb debugging)
b task1
c
x/5i $eip
si
x/5i $eip
info registers
si
info registers
x/5wx $esp
Level 3: iret instruction analysis
In the second level environment, debug gdb and enter
b task1
c
x/5i $eip
si
x/5i $eip
info registers
si
bt
disas
b *0x795e
c
x/5i $eip
info registers
x/5wx $esp
si
info registers