lkrg-org / lkrg

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

Make logging of sysctl value changes more consistent #211

Closed solardiz closed 1 year ago

solardiz commented 1 year ago

We have inconsistent logging of sysctl value changes:

$ fgrep Changing src/modules/comm_channel/p_comm_channel.c
         p_print_log(P_LOG_STATE, "Changing 'kint_validate' from %d (%s) to %d (%s)",
         p_print_log(P_LOG_STATE, "Changing 'kint_enforce' from %d (%s) to %d (%s)",
         p_print_log(P_LOG_STATE, "Changing 'pint_validate' from %d (%s) to %d (%s)",
         p_print_log(P_LOG_STATE, "Changing 'pint_enforce' from %d (%s) to %d (%s)",
      p_print_log(P_LOG_STATE, "Changing 'interval' to %d", P_CTRL(p_interval));
      p_print_log(P_LOG_STATE, "Changing 'log_level' to %d (%s)",
            p_print_log(P_LOG_STATE, "Changing 'smep_enforce' from %d (%s) to %d (%s)",
            p_print_log(P_LOG_STATE, "Changing 'smap_enforce' from %d (%s) to %d (%s)",
         p_print_log(P_LOG_STATE, "Changing 'umh_validate' from %d (%s) to %d (%s)",
         p_print_log(P_LOG_STATE, "Changing 'umh_enforce' from %d (%s) to %d (%s)",
         p_print_log(P_LOG_STATE, "Changing 'pcfi_validate' from %d (%s) to %d (%s)",
         p_print_log(P_LOG_STATE, "Changing 'pcfi_enforce' from %d (%s) to %d (%s)",
            p_print_log(P_LOG_STATE, "Changing 'profile_validate' from %d (%s) to %d (%s)",
            p_print_log(P_LOG_STATE, "Changing 'profile_enforce' from %d (%s) to %d (%s)",

For all of these but log_level and interval, we include both the old and the new value. Also, for those where we log "Enabling" or "Disabling" instead of numeric values, we only do that when the value has changed. So it's illogical that for log_level and interval we log a "Changing" message that does not let us see whether the value has changed.