HEX
Server: Apache/2.4.6 () OpenSSL/1.0.2k-fips PHP/8.3.8
System: Linux gateway.rmc-logistics.net 4.1.12-124.48.6.el7uek.x86_64 #2 SMP Tue Mar 16 14:57:50 PDT 2021 x86_64
User: apache (48)
PHP: 8.3.8
Disabled: NONE
Upload Files
File: //usr/libexec/microcode_ctl/reload_microcode
#! /bin/bash -efu

# Trigger microcode reload with additional check for BDW-EP that can have
# microcode reloaded only in case kernel has specific patches.
#
# SPDX-License-Identifier: CC0-1.0

export LC_ALL=C

CHECK_CAVEATS=/usr/libexec/microcode_ctl/check_caveats
IGNORE_HYPERVISOR="/etc/microcode_ctl/ignore-hypervisor-flag"

[ -e "$IGNORE_HYPERVISOR" ] || {
	if grep -q '^flags[[:space:]]*:.* hypervisor\( .*\)\?$' /proc/cpuinfo
	then
		exit 0
	fi
}

"$CHECK_CAVEATS" -m > /dev/null || exit 0
# For Intel, if the running microcode >= on-disk microcode, skip load.
if [ "$(/bin/sed -rn '1,/^$/s/^vendor_id[[:space:]]*: (.*)$/\1/p' /proc/cpuinfo)" = "GenuineIntel" ]; then
	ucode_filename=$(/usr/bin/printf "%02x-%02x-%02x" \
                $(/bin/sed -rn '1,/^$/{
                        s/^cpu family[[:space:]]*: (.*)$/\1/p;
                        s/^model[[:space:]]*: (.*)$/\1/p;
                        s/^stepping[[:space:]]*: (.*)$/\1/p;
                }' /proc/cpuinfo))

	ucode_file="/lib/firmware/$(uname -r)/intel-ucode/$ucode_filename"
	if [ ! -f "$ucode_file" ]; then
		ucode_file=/lib/firmware/intel-ucode/$ucode_filename
	fi

	running_ucode=$(/bin/sed -rn '1,/^$/s/^microcode[[:space:]]*: (.*)$/\1/p' /proc/cpuinfo)

	if [ -f $ucode_file -a -n "$running_ucode" ]; then
		new_ucode=$(od -An -j4 -N4 -tdI $ucode_file)
		if [ $(($running_ucode)) -ge $new_ucode ]; then
			echo "on-disk microcode is <= running microcode; not reloading"
			exit 0
		fi
	fi
fi

echo 2>/dev/null 1 > /sys/devices/system/cpu/microcode/reload || :

exit 0