lkrg-org / lkrg

Linux Kernel Runtime Guard
https://lkrg.org
Other
404 stars 72 forks source link

Overlay cleanup #224

Closed solardiz closed 1 year ago

solardiz commented 1 year ago

Description

This simplifies the changes introduced in #217.

How Has This Been Tested?

Built and loaded for/into a kernel where ovl_dentry_is_whiteout is expected. Saw the expected log messages (unchanged from before, except that the word funcion is dropped for consistency with other current LKRG messages) for the case of no overlay loaded yet. Did a modprobe overlay, found ovl_dentry_is_whiteout in /sys/kernel/debug/kprobes/list. Unloaded and reloaded LKRG (with rmmod and insmod), saw no messages about inability to hook ovl_dentry_is_whiteout that time, saw that it is hooked per /sys/kernel/debug/kprobes/list.

Did not test the logic beyond successful hooking of what's expected. That is, did not test the off count check code path in the hook.

Meanwhile, 12 successful and 6 in progress CI checks in my fork.

solardiz commented 1 year ago

did not test the off count check code path in the hook.

However, made sure the expected version of it is compiled in, by temporarily inserting a #error near it in:

#if P_OVL_OVERRIDE_SYNC_MODE == 2
   return p_off == 3 * p_global_cnt_cookie;
#else
   return p_off == 2 * p_global_cnt_cookie;
#endif
solardiz commented 1 year ago

CI is all green both here and in my fork. @Adam-pi3 OK to merge?

ajakk commented 1 year ago

This works for me too!

Adam-pi3 commented 1 year ago

Done