From: Daniel McIlvaney Date: Fri, 28 Apr 2023 21:02:05 +0000 (-0700) Subject: fix(dracut-functions): avoid calling grep with PCRE (-P) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=67591e8855006eb02aa0ffab7349ab770e471473;p=thirdparty%2Fdracut.git fix(dracut-functions): avoid calling grep with PCRE (-P) Invoking grep in Perl mode requires JIT'ing the Perl regex. This can run into issues with SELinix policy which will generally try to limit use of execmem in general purpose scripts. This occurs since the JIT'd code will live in executable memory. The PCRE only '\K' command in the Perl REGEX can be replaced by a call to awk instead. --- diff --git a/dracut-functions.sh b/dracut-functions.sh index f55d5dd4d..b48c4b189 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -244,7 +244,7 @@ get_maj_min() { local _out if [[ $get_maj_min_cache_file ]]; then - _out="$(grep -m1 -oP "^$1 \K\S+$" "$get_maj_min_cache_file")" + _out="$(grep -m1 -oE "^$1 \S+$" "$get_maj_min_cache_file" | awk '{print $NF}')" fi if ! [[ "$_out" ]]; then