kpatch-test: Change DYNDEBUG_CONTROL setting to use sudo

Depending on environment, "Permission denied" error may occur
when /sys/kernel/debug/dynamic_debug/control setting.

Signed-off-by: Keiya Nobuta <nobuta.keiya@fujitsu.com>
This commit is contained in:
Keiya Nobuta 2021-11-02 13:05:57 +09:00
parent 61fc3f1077
commit 7612b4da68
1 changed files with 3 additions and 3 deletions

View File

@ -355,8 +355,8 @@ unload_all
save_dmesg
if [ "${DYNDEBUG_ENABLED}" == "1" ]; then
prev_dyndebug=$(grep klp_try_switch_task "${DYNDEBUG_CONTROL}" | awk '{print $3;}')
echo "func klp_try_switch_task +p" >"${DYNDEBUG_CONTROL}" 2>/dev/null
prev_dyndebug=$(sudo sh -c "grep klp_try_switch_task ${DYNDEBUG_CONTROL}" | awk '{print $3;}')
sudo sh -c "echo 'func klp_try_switch_task +p' > ${DYNDEBUG_CONTROL} 2>/dev/null"
fi
if [[ $QUICK != 1 ]]; then
@ -380,7 +380,7 @@ fi
unload_all
if [ "${DYNDEBUG_ENABLED}" == "1" ]; then
echo "func klp_try_switch_task ${prev_dyndebug}" >"${DYNDEBUG_CONTROL}" 2>/dev/null
sudo sh -c "echo \"func klp_try_switch_task ${prev_dyndebug}\" > ${DYNDEBUG_CONTROL} 2>/dev/null"
fi
if new_dmesg | grep -q "Call Trace"; then