Rename the module from p_lkrg to lkrg

This commit is contained in:
Solar Designer 2022-07-18 20:54:33 +02:00
parent e4c46d7d6b
commit 49a3117542
17 changed files with 34 additions and 34 deletions

View File

@ -42,7 +42,7 @@ jobs:
RUN git clean -dxfq
RUN gcc -v; cat /etc/os-release
RUN make -j\$(nproc) KERNELRELEASE=\$(cd /lib/modules; ls)
RUN file p_lkrg.ko
RUN file lkrg.ko
EOF
- run: docker build .

View File

@ -8,8 +8,8 @@
set -eux -o pipefail
if [ ! -d /sys/module/p_lkrg ]; then
modprobe p_lkrg
if [ ! -d /sys/module/lkrg ]; then
modprobe lkrg
fi
# Trigger loading vhost_vsock module (using UMH call to modprobe).

View File

@ -1,4 +1,4 @@
name = "p_lkrg"
name = "lkrg"
type = "module"
[[supported_kernels]]

View File

@ -9,7 +9,7 @@ P_OUTPUT = output
P_PWD ?= $(shell pwd)
P_KVER ?= $(shell uname -r)
P_BOOTUP_SCRIPT ?= scripts/bootup/lkrg-bootup.sh
TARGET := p_lkrg
TARGET := lkrg
ifneq ($(KERNELRELEASE),)
KERNEL := /lib/modules/$(KERNELRELEASE)/build
else

16
README
View File

@ -98,7 +98,7 @@ only proceed with installation if there are none.
You can do this for a freshly built LKRG (and while you're still in its top
level source code directory) with the following command:
sudo insmod output/p_lkrg.ko kint_enforce=1
sudo insmod output/lkrg.ko kint_enforce=1
Then check kernel messages for any potential errors, use the system for a long
while, and check again:
@ -110,7 +110,7 @@ might not require root.)
Unload LKRG from the kernel with:
sudo rmmod p_lkrg
sudo rmmod lkrg
so that it can then be loaded using the same procedure that's used on system
bootup and without the parameter override.
@ -142,7 +142,7 @@ for OpenRC:
for other:
sudo modprobe -v p_lkrg
sudo modprobe -v lkrg
Autoload on bootup
@ -160,9 +160,9 @@ for OpenRC:
for other:
sudo mkdir -p /etc/modules-load.d/ &&
echo p_lkrg | sudo tee /etc/modules-load.d/p_lkrg.conf
echo lkrg | sudo tee /etc/modules-load.d/lkrg.conf
Alternatively you can put the "modprobe p_lkrg" command into a system startup
Alternatively you can put the "modprobe lkrg" command into a system startup
script. Please note that ideally this command would run before sysctl files
(especially /etc/sysctl.d/01-lkrg.conf) are processed, or otherwise the LKRG
settings specified in those would not take effect.
@ -215,7 +215,7 @@ for OpenRC:
for other:
sudo modprobe -v -r p_lkrg
sudo modprobe -v -r lkrg
Upgrading
@ -248,13 +248,13 @@ already mentioned above and many more.
For freshly built LKRG, you can list the parameters with:
modinfo output/p_lkrg.ko
modinfo output/lkrg.ko
while you're still in LKRG's top level source code directory.
With LKRG installed on the system, you can list them with:
sudo modinfo p_lkrg
sudo modinfo lkrg
(Depending on system configuration, "modinfo" might not require root.)

View File

@ -1,9 +1,9 @@
PACKAGE_NAME="lkrg"
PACKAGE_VERSION="#MODULE_VERSION#"
#BUILT_MODULE_LOCATION[0]="output"
BUILT_MODULE_NAME[0]="p_lkrg"
BUILT_MODULE_NAME[0]="lkrg"
DEST_MODULE_LOCATION[0]="/updates/dkms"
DEST_MODULE_NAME[0]="p_lkrg"
DEST_MODULE_NAME[0]="lkrg"
REMAKE_INITRD="no"
AUTOINSTALL="yes"

View File

@ -1 +1 @@
#options p_lkrg log_level=4
#options lkrg log_level=4

View File

@ -1 +1 @@
p_lkrg
lkrg

View File

@ -1,9 +1,9 @@
PACKAGE_NAME="lkrg"
PACKAGE_VERSION="0.9.3"
#BUILT_MODULE_LOCATION[0]="output"
BUILT_MODULE_NAME[0]="p_lkrg"
BUILT_MODULE_NAME[0]="lkrg"
DEST_MODULE_LOCATION[0]="/updates/dkms"
DEST_MODULE_NAME[0]="p_lkrg"
DEST_MODULE_NAME[0]="lkrg"
REMAKE_INITRD="no"
AUTOINSTALL="yes"

View File

@ -12,6 +12,6 @@ type banner >/dev/null 2>&1 && banner build $KERNELRELEASE >&2
make -j$(nproc) $@
# Install if compiled.
[ -e p_lkrg.ko ] && [ -v DESTDIR ] &&
install -Dpm 644 p_lkrg.ko $DESTDIR/lib/modules/$KERNELRELEASE/extra/p_lkrg.ko &&
[ -e lkrg.ko ] && [ -v DESTDIR ] &&
install -Dpm 644 lkrg.ko $DESTDIR/lib/modules/$KERNELRELEASE/extra/lkrg.ko &&
cp -av ./ $DESTDIR/lkrg/ || :

View File

@ -12,7 +12,7 @@ if test -x /usr/bin/dracut; then
# Register our module in kmod database.
depmod -a $KERNELRELEASE
# Install module into (and force load early in) initrd.
dracut --force --force-drivers p_lkrg /boot/initrd.img-$KERNELRELEASE $KERNELRELEASE
dracut --force --force-drivers lkrg /boot/initrd.img-$KERNELRELEASE $KERNELRELEASE
# Delete default cmdline which contains 'quiet splash' to see full boot log.
sed -i /GRUB_CMDLINE_LINUX_DEFAULT/d /etc/default/grub
update-grub

View File

@ -3,8 +3,8 @@
description="Linux Kernel Runtime Guard"
command="/sbin/modprobe"
command_args="-v p_lkrg"
unload_command_args="-v -r p_lkrg"
command_args="-v lkrg"
unload_command_args="-v -r lkrg"
runlevel_command="/sbin/runlevel"
grep_command="/bin/grep"
@ -21,10 +21,10 @@ start() {
stop() {
# for more info about runlevels (e.g. "S", "0", "1", "6") check: man 8 init
if $runlevel_command | $grep_command -q ' [S016]$'; then
ebegin "Stopping \"lkrg\" service without unloading \"p_lkrg\" module from the kernel"
ebegin "Stopping \"lkrg\" service without unloading \"lkrg\" module from the kernel"
eend $?
else
ebegin "Unloading \"p_lkrg\" module from the kernel"
ebegin "Unloading \"lkrg\" module from the kernel"
$command $unload_command_args
eend $?
fi

View File

@ -17,9 +17,9 @@ ConditionKernelCommandLine=!nolkrg
[Service]
Type=oneshot
ExecStart=/sbin/modprobe -v p_lkrg
ExecStart=/sbin/modprobe -v lkrg
ExecStartPost=/sbin/sysctl -p /etc/sysctl.d/01-lkrg.conf
ExecStop=/sbin/modprobe -v -r p_lkrg
ExecStop=/sbin/modprobe -v -r lkrg
RemainAfterExit=yes
[Install]

View File

@ -38,14 +38,14 @@ EOC
MAKEFILE=$(cat <<EOC
# SPDX-License-Identifier: GPL-2.0-only
obj-\$(CONFIG_SECURITY_LKRG) := p_lkrg.o
obj-\$(CONFIG_SECURITY_LKRG) := lkrg.o
ifeq (\$(SECURITY_LKRG_DEBUG), on)
ccflags-m := -ggdb -DP_LKRG_DEBUG_BUILD -finstrument-functions
ccflags-y := \${ccflags-m}
p_lkrg-objs += modules/print_log/p_lkrg_debug_log.o
lkrg-objs += modules/print_log/p_lkrg_debug_log.o
endif
$(sed -n '/^$(TARGET)-objs += .* \\/,/[^\]$/ {s|src/||; s|$(TARGET)|p_lkrg|; p}' "$BASEDIR/../Makefile")
$(sed -n '/^$(TARGET)-objs += .* \\/,/[^\]$/ {s|src/||; s|$(TARGET)|lkrg|; p}' "$BASEDIR/../Makefile")
EOC
)

View File

@ -125,7 +125,7 @@ do { \
p_debug_log(P_LOG_DEBUG, "Restoring KOBJ[0x%lx] for [%s]", \
(unsigned long)&p_mod->mkobj.kobj,p_mod->name); \
if ( (p_ret = kobject_add(&p_mod->mkobj.kobj, p_kobj_parent, \
"p_lkrg")) < 0) { \
"lkrg")) < 0) { \
p_print_log(P_LOG_WATCH, "Failed to restore KOBJ"); \
return; \
} \

View File

@ -466,7 +466,7 @@ static int __init p_lkrg_register(void) {
#endif
#else
if ( (p_hot_cpus = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
"x86/p_lkrg:online",
"x86/lkrg:online",
p_cpu_online_action,
p_cpu_dead_action)) < 0) {
p_print_log(P_LOG_FATAL, "Can't register hot CPU plug[in/out] handler");

View File

@ -389,7 +389,7 @@ static inline int p_lkrg_counter_lock_val_read(p_lkrg_counter_lock *p_arg) {
/* End */
/*
* p_lkrg modules
* LKRG modules
*/
#include "modules/print_log/p_lkrg_print_log.h" // printing, error and debug module
#include "modules/hashing/p_lkrg_fast_hash.h" // Hashing module