mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
26 lines
345 B
Bash
Executable File
26 lines
345 B
Bash
Executable File
#!/bin/sh
|
|
set -ex
|
|
insmod /fops.ko
|
|
mkdir -p /fops
|
|
mount -t debugfs none /fops
|
|
cd /fops/kernel_module_cheat
|
|
|
|
cat fops
|
|
# => abcd
|
|
# dmesg => open
|
|
# dmesg => read
|
|
# dmesg => len = [0-9]+
|
|
# dmesg => close
|
|
|
|
printf a >fops
|
|
# dmesg => open
|
|
# dmesg => write
|
|
# dmesg => len = 1
|
|
# dmesg => buf = a
|
|
# dmesg => close
|
|
|
|
cd /
|
|
umount /fops
|
|
rmdir /fops
|
|
rmmod fops
|