diff options
author | Laura Abbott <labbott@redhat.com> | 2019-10-23 14:53:43 -0400 |
---|---|---|
committer | Laura Abbott <labbott@redhat.com> | 2019-10-29 15:28:51 -0400 |
commit | 5648544aaba8a542ab14990ac83c4c401637aebf (patch) | |
tree | 0dc108ecef3ce200b4835f10c405e553fdec1781 /mod-extra-blacklist.sh | |
parent | 11fa12d6aafcc7da26fa11b58f79cfcec7721718 (diff) | |
download | kernel-5648544aaba8a542ab14990ac83c4c401637aebf.tar.gz kernel-5648544aaba8a542ab14990ac83c4c401637aebf.tar.xz kernel-5648544aaba8a542ab14990ac83c4c401637aebf.zip |
Add mod-internal package
Some of the downstream users want to package some modules for
internal use only. While Fedora isn't internal, it's still
useful to have packaging aligned. Add a few modules to this
package.
Diffstat (limited to 'mod-extra-blacklist.sh')
-rwxr-xr-x | mod-extra-blacklist.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/mod-extra-blacklist.sh b/mod-extra-blacklist.sh new file mode 100755 index 000000000..9569ef6f2 --- /dev/null +++ b/mod-extra-blacklist.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +buildroot="$1" +kernel_base="$2" + +blacklist() +{ + cat > "$buildroot/etc/modprobe.d/$1-blacklist.conf" <<-__EOF__ + # This kernel module can be automatically loaded by non-root users. To + # enhance system security, the module is blacklisted by default to ensure + # system administrators make the module available for use as needed. + # See https://access.redhat.com/articles/3760101 for more details. + # + # Remove the blacklist by adding a comment # at the start of the line. + blacklist $1 +__EOF__ +} + +check_blacklist() +{ + if modinfo "$1" | grep -q '^alias:\s\+net-'; then + mod="${1##*/}" + mod="${mod%.ko*}" + echo "$mod has an alias that allows auto-loading. Blacklisting." + blacklist "$mod" + fi +} + +foreachp() +{ + P=$(nproc) + bgcount=0 + while read mod; do + $1 "$mod" & + + bgcount=$((bgcount + 1)) + if [ $bgcount -eq $P ]; then + wait -n + bgcount=$((bgcount - 1)) + fi + done + + wait +} + +[ -d "$buildroot/etc/modprobe.d/" ] || mkdir -p "$buildroot/etc/modprobe.d/" +find "$buildroot/$kernel_base/extra" -name "*.ko*" | \ + foreachp check_blacklist |