Pagini
Workshops
Parteneri
Download and unzip the tasks archive sesiune-04 on the virtual machine.
cd /usr/src/linux
file vmlinux
# nm vmlinux | grep sys_call_table # cat System.map | grep sys_call_table
gdb –quiet vmlinux
sys_fork
functionx/x 0x123
where 0x123 is an address obtained above from the symbol table.jiffies
variable.myproc
module from 0-gdb directory with debug options make COPTS=-g
.insmod myproc.ko
.cat /sys/module/myproc/sections/.text
.add-symbol-file myproc.o load_address
.echo d > /proc/sysrq-trigger
, display all currently held locksecho m > /proc/sysrq-trigger
, output current memory information to the console echo p > /proc/sysrq-trigger
, output the current registers and flags to the consoleecho q > /proc/sysrq-trigger
, display all active high-resolution timers and clock sourcesecho c > /proc/sysrq-trigger
, generate a kernel panicdmesg
to check the results.penguin.c
implements a simple kernel modules that brings alive a penguin. kmemleak
to solve the problem:echo clear > /sys/kernel/debug/kmemleak
insmod penguin.ko
rmmod penguin.ko
echo scan > /sys/kernel/debug/kmemleak
udp_table_init
?crusher.c
is a simple module which allocates memory and accesses it in different forms.CRUSH_MODE
to generate the following types of errros:nc -lu 6000
.echo c > /proc/sysrq-trigger
.simple.ko
module defines and exports myvar
variable, simplet.ko
modifies it and data_breakpoint.ko
adds a hardware breakpoint in order to monitor the variable. Follow the steps below:simple.ko
and load it: ./build.sh simple; insmod simple/simple.ko
data_breakpoint.ko
and load it: ./build.sh data_breakpoint; insmod data_breakpoint/data_breakpoint.ko ksym=myvar
simplet.ko
and load it: ./build.sh simplet; insmod simple/simplet.ko
data_breakpoint.ko
: ksym=variable_to_monitor
.5-kprobe/
, one for each type of kprobe.