Closed zrose584 closed 4 years ago
Could you try https://github.com/milabs/khook/tree/dev/khook branch?
It seems to work.
However, while khook-demo.ko
is loaded, it spams
...
[25385.551901] khook_inode_permission(00000000a6d102aa, 00000081) = 0
[25385.551902] khook_inode_permission(00000000e7f5063e, 00000081) = 0
[25385.551907] khook_inode_permission(000000000978fe32, 00000024) = 0
[25385.551907] khook_inode_permission(000000004458c1c4, 00000081) = 0
...
and this results in 100% CPU usage, even when not actively viewing kernlog in term.
Using dmesg | cut -c 39-54 | sort | uniq
, it seems like these are always the same 24-35 or so inodes.
Is this normal? What could be the cause of this?
edit:
after looking up the inode->i_ino
, these are some of the files
//var
/var/log
/usr/share/locale/kv/LC_MESSAGES
/lib/modules/4.19.0-6-amd64
/usr/share/locale/sc/LC_MESSAGES/iso_4217.mo
/usr/src/linux-headers-4.19.0-6-common/arch/mips/include/asm/mach-vr41xx/irq.h
//lib
/lib/x86_64-linux-gnu
/lib/modules
/lib/x86_64-linux-gnu/libc-2.28.so
/lib/x86_64-linux-gnu/libdl-2.28.so
/lib/x86_64-linux-gnu/libpthread-2.28.so
/lib/modules/4.19.0-6-amd64/modules.softdep
/lib/modules/4.19.0-6-amd64/modules.builtin.bin
/run/systemd/journal/flushed
/sys/kernel/debug/bdi
/
/sys/fs
/sys/fs/cgroup/rdma/cgroup.procs
/sys/fs/cgroup/cpu,cpuacct/cgroup.procs
and this results in 100% CPU usage
Could you comment-out printk
in demo and see how the CPU usage will change?
It is normal then. So printk
indirectly uses inode_permission
?
printk
writes to the kernel log which causes the journald
to fetch the data from the kernel log and save it to the file. The last operation triggers inode_permission
(which is hooked) so the printk
called again and so on
Solved via 79956e3fb60c66e9f7e6cddd2ebbf135ca5489fd
copied from here:
Host info: