System Environment :
Ubuntu9.1 - Kernel2.6.31.14
- Details : Use the Kernel 2.6.31.12
I use it Although kernel versions released 2.6.32.xx. Because the kernel over 2.6.32.xx version is required higher version of GCC and diffrent setting of config installed on System.
#include <linux/kernel.h> printk(KERN_INFO "ESP0 = %lx, SS0 = %8hx, ESP1 = %lx, SS1 = %8hx, ESP2 = %lx, SS2 = %8hx\n", tss->x86_tss.sp0, tss->x86_tss.ss0, tss->x86_tss.sp1, tss->x86_tss.ss1, tss->x86_tss.sp2, tss->x86_tss.ss2); printk(KERN_INFO "CR3 = %lx, EIP = %lx, EFLAGS = %lx, EAX = %lx, ECX = %lx, EDX = %lx\n", tss->x86_tss.__cr3, tss->x86_tss.ip, tss->x86_tss.flags, tss->x86_tss.ax, tss->x86_tss.cx, tss->x86_tss.dx); printk(KERN_INFO "EBX = %lx, ESP = %lx, EBP = %lx, ESI = %lx, EDI = %lx\n", tss->x86_tss.bx, tss->x86_tss.sp, tss->x86_tss.bp, tss->x86_tss.si, tss->x86_tss.di); printk(KERN_INFO "ES = %8hx, CS = %8hx, SS = %8hx, DS = %8hx, FS = %8hx, GS = %8hx, LDT = %8hx\n", tss->x86_tss.es, tss->x86_tss.cs, tss->x86_s.ss, tss->x86_tss.ds, tss->x86_tss.fs, tss->x86_tss.gs, tss->x86_tss.ldt); |
I recommand you to refer to TSS(Task State Segment) in this blog.
if you wanna use environment of current linux on system, copy the ".config" file.
As a fllowing command line :
> cp /boot/config-2.6.31-14-generic /usr/src/linux-2.6.31.12/.config
(I was working on "/usr/src" directory)
> make
> make modules
> make modules_install
> make install
Otherwise, If you use following commands, grub config is set automatically.
> make-kpkg -> Grub config auto setting
> dpkg
But you may need img file of initrd to set config of grub.
How to make img file of initrd :
The Following command is used on Ubuntu System. But other systems(e.g. RedHat) use usally "mkinitrd" command.
Next, you have to insert fllowing code to "/boot/grub/grub.cfg" or "grub.conf" or "menu.lsst"
### BEGIN /etc/grub.d/20_linux ### menuentry "Ubuntu, Linux 2.6.31.12" { recordfail=1 if [ -n ${have_grubenv} ]; then save_env recordfail; fi set quiet=1 insmod ext2 set root=(hd0,1) search --no-floppy --fs-uuid --set c5ae961a-5dcc-4d7d-bdcb-7c5f097e3032 linux /boot/vmlinuz-2.6.31.12 root=UUID=c5ae961a-5dcc-4d7d-bdcb-7c5f097e3032 ro quiet splash initrd /boot/initrd.img-2.6.31.12 } menuentry "Ubuntu, Linux 2.6.31.12 (recovery mode)" { recordfail=1 if [ -n ${have_grubenv} ]; then save_env recordfail; fi insmod ext2 set root=(hd0,1) search --no-floppy --fs-uuid --set c5ae961a-5dcc-4d7d-bdcb-7c5f097e3032 linux /boot/vmlinuz-2.6.31.12 root=UUID=c5ae961a-5dcc-4d7d-bdcb-7c5f097e3032 ro single initrd /boot/initrd.img-2.6.31.12 } ### END /etc/grub.d/20_linux ### |
Then, you can confirm that print the register information of TSS of a victim process to "/var/log/messages" in every context switch.
'SPECIALTY > Linux' 카테고리의 다른 글
Makefile 만들기 (0) | 2010.03.26 |
---|---|
command for search text (0) | 2010.03.17 |
grep (0) | 2010.02.11 |
Evironment of Linux Server of ESOS Lab. (0) | 2010.02.08 |
install pear (0) | 2010.02.07 |