fix: replace undefined LOADED_MODULE_NAME with MODULE_NAME in apply() functions#323
Open
george-petrakis wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several kernel module hardening scripts used
$LOADED_MODULE_NAMEinside theirapply()functions without ever defining it at the script level. Withset -uactive, this caused an immediate unbound variable crash (exit 1) any time a script ran inenabledmode.The variable
LOADED_MODULE_NAMEis intentionally defined indisable_usb_storage.shbecause the modprobe name (usb-storage) differs from the name as it appears in/proc/modules(usb_storage). The affected scripts have no such distinction — their module names are identical in both contexts — so the correct variable isMODULE_NAME, which is whataudit()already used consistently in all of these files.Affected scripts
11 in
bin/hardening/, 2 inversions/default/:disable_cramfs,disable_dccp,disable_freevxfs,disable_hfs,disable_hfsplusdisable_jffs2,disable_rds,disable_sctp,disable_squashfs,disable_tipc,disable_udfversions/default/1.1.1.5_disable_squashfs.sh,versions/default/1.1.1.6_disable_udf.shRoot cause
Copy-paste from
disable_usb_storage.shwithout carrying over theLOADED_MODULE_NAMEdefinition.