From patchwork Thu Nov 21 11:11:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Guo X-Patchwork-Id: 13881840 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2FC374068 for ; Thu, 21 Nov 2024 11:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187542; cv=none; b=ev581GW/8S2axUtY13CiMvNQufQA5ZcD78j7UeRRV89yfAW4se6RNOWpSuMfmP8HXGVC5ZlaL9rafvRWnjaes8Irz5ROXk9P2LSalP6MeecLfqxjXkLoNBEZv3frZQqlpWz3LjyLhGPxWnD3/HEmCZn7dR3P0DSdUYiuAi9FhWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187542; c=relaxed/simple; bh=0RoZ1k0MIgJtAZZxA/cydZniSVik3az1/fVvoPV/yVY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=KH9u/pAZxp5SClhlssHn08rMaEv411YIjVgudOm5W7atCY69gJ1cbVa53zDn+uFMrTI0VDzKMJwBP3e3B9VH6PXS7LbdLO/WsBtlDWELro5KifpVmRV+D9SXEfSCI8Pwl5GeBNmuoIh7HCuE7R1LLo6heQ1Evkde7IqWTtDQ6m0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=lkr0OnMc; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="lkr0OnMc" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1732187536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QC2F/Cd3ACvzMp5vlB3mOJU9ZI9rcfOM57+5Z/lBLds=; b=lkr0OnMc/EuTVAPMOcLvk0SbwXKHIPI2zqoChck/Hp4gumMm+pD0uTYiJWu6OuO1YJ/Ssg vLobk25mOBjyuGIQavvaRncaYx3vQaU6lh1OZSNj1w/Up/vyok29z11bmOcNhA50CqtX9y uqspN0hhX8Qqw8+el8/wAiPkWiRnDSc= From: George Guo To: jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, joe.lawrence@redhat.com, shuah@kernel.org Cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, George Guo Subject: [PATCH livepatch/master v1 1/6] selftests/livepatch: fix test-callbacks.sh execution error Date: Thu, 21 Nov 2024 19:11:30 +0800 Message-Id: <20241121111135.2125391-1-dongtai.guo@linux.dev> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT From: George Guo The script test-callbacks.sh fails with the following error: $ sudo ./test-callbacks.sh TEST: target module before livepatch ... not ok - expected + result test_klp_callbacks_mod: test_klp_callbacks_mod_init % insmod test_modules/test_klp_callbacks_demo.ko livepatch: enabling patch 'test_klp_callbacks_demo' -livepatch: 'test_klp_callbacks_demo': initializing patching transition +transition: 'test_klp_callbacks_demo': initializing patching transition test_klp_callbacks_demo: pre_patch_callback: vmlinux test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': starting patching transition -livepatch: 'test_klp_callbacks_demo': completing patching transition +transition: 'test_klp_callbacks_demo': starting patching transition +transition: 'test_klp_callbacks_demo': completing patching transition test_klp_callbacks_demo: post_patch_callback: vmlinux test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': patching complete +transition: 'test_klp_callbacks_demo': patching complete % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled -livepatch: 'test_klp_callbacks_demo': initializing unpatching transition +transition: 'test_klp_callbacks_demo': initializing unpatching transition test_klp_callbacks_demo: pre_unpatch_callback: vmlinux test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': starting unpatching transition -livepatch: 'test_klp_callbacks_demo': completing unpatching transition +transition: 'test_klp_callbacks_demo': starting unpatching transition +transition: 'test_klp_callbacks_demo': completing unpatching transition test_klp_callbacks_demo: post_unpatch_callback: vmlinux test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state -livepatch: 'test_klp_callbacks_demo': unpatching complete +transition: 'test_klp_callbacks_demo': unpatching complete % rmmod test_klp_callbacks_demo % rmmod test_klp_callbacks_mod test_klp_callbacks_mod: test_klp_callbacks_mod_exit ERROR: livepatch kselftest(s) failed The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values. This patch updates the expected test output to reflect the new log format. Signed-off-by: George Guo --- .../selftests/livepatch/test-callbacks.sh | 188 +++++++++--------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/tools/testing/selftests/livepatch/test-callbacks.sh b/tools/testing/selftests/livepatch/test-callbacks.sh index 32b150e25b10..08a33c15bb29 100755 --- a/tools/testing/selftests/livepatch/test-callbacks.sh +++ b/tools/testing/selftests/livepatch/test-callbacks.sh @@ -38,23 +38,23 @@ check_result "% insmod test_modules/$MOD_TARGET.ko $MOD_TARGET: ${MOD_TARGET}_init % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH % rmmod $MOD_TARGET $MOD_TARGET: ${MOD_TARGET}_exit" @@ -83,26 +83,26 @@ unload_mod $MOD_TARGET check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init $MOD_TARGET: ${MOD_TARGET}_init % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH % rmmod $MOD_TARGET $MOD_TARGET: ${MOD_TARGET}_exit" @@ -133,26 +133,26 @@ check_result "% insmod test_modules/$MOD_TARGET.ko $MOD_TARGET: ${MOD_TARGET}_init % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % rmmod $MOD_TARGET $MOD_TARGET: ${MOD_TARGET}_exit $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away livepatch: reverting patch '$MOD_LIVEPATCH' on unloading module '$MOD_TARGET' $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH" @@ -179,12 +179,12 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init @@ -196,12 +196,12 @@ $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going livepatch: reverting patch '$MOD_LIVEPATCH' on unloading module '$MOD_TARGET' $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH" @@ -221,19 +221,19 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH" @@ -258,13 +258,13 @@ check_result "% insmod test_modules/$MOD_TARGET.ko $MOD_TARGET: ${MOD_TARGET}_init % insmod test_modules/$MOD_LIVEPATCH.ko pre_patch_ret=-19 livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition test_klp_callbacks_demo: pre_patch_callback: vmlinux livepatch: pre-patch callback failed for object 'vmlinux' livepatch: failed to enable patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': canceling patching transition, going to unpatch -livepatch: '$MOD_LIVEPATCH': completing unpatching transition -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': canceling patching transition, going to unpatch +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete insmod: ERROR: could not insert module test_modules/$MOD_LIVEPATCH.ko: No such device % rmmod $MOD_TARGET $MOD_TARGET: ${MOD_TARGET}_exit" @@ -297,12 +297,12 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % echo -19 > /sys/module/$MOD_LIVEPATCH/parameters/pre_patch_ret % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' @@ -311,12 +311,12 @@ livepatch: pre-patch callback failed for object '$MOD_TARGET' livepatch: patch '$MOD_LIVEPATCH' failed for module '$MOD_TARGET', refusing to load module '$MOD_TARGET' insmod: ERROR: could not insert module test_modules/$MOD_TARGET.ko: No such device % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH" @@ -346,14 +346,14 @@ $MOD_TARGET_BUSY: busymod_work_func enter $MOD_TARGET_BUSY: busymod_work_func exit % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init @@ -365,14 +365,14 @@ $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going livepatch: reverting patch '$MOD_LIVEPATCH' on unloading module '$MOD_TARGET' $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH % rmmod $MOD_TARGET_BUSY $MOD_TARGET_BUSY: ${MOD_TARGET_BUSY}_exit" @@ -426,10 +426,10 @@ $MOD_TARGET_BUSY: ${MOD_TARGET_BUSY}_init $MOD_TARGET_BUSY: busymod_work_func enter % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': starting patching transition % insmod test_modules/$MOD_TARGET.ko livepatch: applying patch '$MOD_LIVEPATCH' to loading module '$MOD_TARGET' $MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_COMING] Full formed, running module_init @@ -439,12 +439,12 @@ $MOD_TARGET: ${MOD_TARGET}_exit livepatch: reverting patch '$MOD_LIVEPATCH' on unloading module '$MOD_TARGET' $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': reversing transition from patching to unpatching -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': reversing transition from patching to unpatching +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET_BUSY -> [MODULE_STATE_LIVE] Normal state -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH % rmmod $MOD_TARGET_BUSY $MOD_TARGET_BUSY: busymod_work_func exit @@ -469,34 +469,34 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH2 % rmmod $MOD_LIVEPATCH" @@ -525,27 +525,27 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_LIVEPATCH2.ko replace=1 livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % rmmod $MOD_LIVEPATCH2 % rmmod $MOD_LIVEPATCH" From patchwork Thu Nov 21 11:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Guo X-Patchwork-Id: 13881841 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 828049474 for ; Thu, 21 Nov 2024 11:12:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187554; cv=none; b=IQgn5QaO00I6vsZKgTCV6b/Pc8Sg3ig1IX3eVB9HELDrpFdkrS42viVooZXROQ7Mi8pHJDySCbBus73XDzJvfkbgdPJQ27/bK1Nl/HQkOKwbIW18MGgZsX03dwtHD9hM4wI4TloZmOqeHig0GKXc+yvrJyDlZWg8kPTbcXsqh5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187554; c=relaxed/simple; bh=xNxTv9EmQivtywSeSyU7TTAQ2BE6SPdTXU2ukLe3Xeo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e5+xxk/p7Oer0xSOR+VibjLuoPXUbu1oua66bglZ+4LCZEFfL/VVbsL697KyLkLBCKTnknXIslrjGOEc7xlyTbvuvw9O7z6wYRGDeV15MWdygTBfd+KhhwKujx256i2IqjYQ5UBGkx1HHil3p7RrDiUR+1AGXfOdpywye6Ov8aI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ZOCFJ551; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ZOCFJ551" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1732187550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OguGIC+UK9KIfqIm01474ZxDlRYYb/Skb7YJ5uXjK70=; b=ZOCFJ551iJ3juuDetBDEzQ35KuXadEyN9xyV1rJSesxk72Um4Lq25KkY7U/UgvuHxCHaBo k8YYN2/WCHsDJ4zWr6KEfWdv9m/d57IrJyJc+5Sb6ubLAfK/yyUPr+XzhvoXW+0GdZUXQX LbPeVoIVbRnihP4T4aemfiDsK7QoxR8= From: George Guo To: jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, joe.lawrence@redhat.com, shuah@kernel.org Cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, George Guo , George Guo Subject: [PATCH livepatch/master v1 2/6] selftests/livepatch: fix test-ftrace.sh execution error Date: Thu, 21 Nov 2024 19:11:31 +0800 Message-Id: <20241121111135.2125391-2-dongtai.guo@linux.dev> In-Reply-To: <20241121111135.2125391-1-dongtai.guo@linux.dev> References: <20241121111135.2125391-1-dongtai.guo@linux.dev> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT The script test-ftrace.sh fails with the following error: $ sudo ./test-ftrace.sh TEST: livepatch interaction with ftrace_enabled sysctl ... not ok - expected + result livepatch: kernel.ftrace_enabled = 0 % insmod test_modules/test_klp_livepatch.ko livepatch: enabling patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': initializing patching transition -livepatch: failed to register ftrace handler for function 'cmdline_proc_show' (-16) +transition: 'test_klp_livepatch': initializing patching transition livepatch: failed to patch object 'vmlinux' livepatch: failed to enable patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': canceling patching transition, going to unpatch -livepatch: 'test_klp_livepatch': completing unpatching transition -livepatch: 'test_klp_livepatch': unpatching complete +transition: 'test_klp_livepatch': canceling patching transition, going to unpatch +transition: 'test_klp_livepatch': completing unpatching transition +transition: 'test_klp_livepatch': unpatching complete insmod: ERROR: could not insert module test_modules/test_klp_livepatch.ko: Device or resource busy livepatch: kernel.ftrace_enabled = 1 % insmod test_modules/test_klp_livepatch.ko livepatch: enabling patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': initializing patching transition -livepatch: 'test_klp_livepatch': starting patching transition -livepatch: 'test_klp_livepatch': completing patching transition -livepatch: 'test_klp_livepatch': patching complete +transition: 'test_klp_livepatch': initializing patching transition +transition: 'test_klp_livepatch': starting patching transition +transition: 'test_klp_livepatch': completing patching transition +transition: 'test_klp_livepatch': patching complete livepatch: sysctl: setting key "kernel.ftrace_enabled": Device or resource busy % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled -livepatch: 'test_klp_livepatch': initializing unpatching transition -livepatch: 'test_klp_livepatch': starting unpatching transition -livepatch: 'test_klp_livepatch': completing unpatching transition -livepatch: 'test_klp_livepatch': unpatching complete +transition: 'test_klp_livepatch': initializing unpatching transition +transition: 'test_klp_livepatch': starting unpatching transition +transition: 'test_klp_livepatch': completing unpatching transition +transition: 'test_klp_livepatch': unpatching complete % rmmod test_klp_livepatch ERROR: livepatch kselftest(s) failed The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values. This patch updates the expected test output to reflect the new log format. Signed-off-by: George Guo --- .../selftests/livepatch/test-ftrace.sh | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/livepatch/test-ftrace.sh b/tools/testing/selftests/livepatch/test-ftrace.sh index 730218bce99c..04561e433e05 100755 --- a/tools/testing/selftests/livepatch/test-ftrace.sh +++ b/tools/testing/selftests/livepatch/test-ftrace.sh @@ -37,27 +37,26 @@ unload_lp $MOD_LIVEPATCH check_result "livepatch: kernel.ftrace_enabled = 0 % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition -livepatch: failed to register ftrace handler for function 'cmdline_proc_show' (-16) +transition: '$MOD_LIVEPATCH': initializing patching transition livepatch: failed to patch object 'vmlinux' livepatch: failed to enable patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': canceling patching transition, going to unpatch -livepatch: '$MOD_LIVEPATCH': completing unpatching transition -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': canceling patching transition, going to unpatch +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete insmod: ERROR: could not insert module test_modules/$MOD_LIVEPATCH.ko: Device or resource busy livepatch: kernel.ftrace_enabled = 1 % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': patching complete livepatch: sysctl: setting key \"kernel.ftrace_enabled\": Device or resource busy % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH" From patchwork Thu Nov 21 11:11:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Guo X-Patchwork-Id: 13881842 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6FAA1D12E0 for ; Thu, 21 Nov 2024 11:12:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187563; cv=none; b=VVRrCx4kj70nJ1TL4u6ssn4j97Gaw4Nc1DL60RciGKVcojuQZlKoiGu9I80sg4F0aSGJmNI8oE5ntpQiOrMtlAcPcMgvf/G0VCzyCyaHOt5bSL3f0OheNHVdQzzpqLEDA2OpecF64qZ72JLB1dv9IXM0eblGbPIvaqQd9BMduTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187563; c=relaxed/simple; bh=cuSWXdblIY4jzjhsbnCq7V0LEkWVfYfZ9OO8BaovfQ4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Kc3s3DuxoENTzTnwOqikEZtT0Bdh/urIJkwxXPHVW1ZcMy73CW1NawdYbZ20ebJART6Z9gQhF6GVRy/XoMST79vv+wn+U7nu3In/XasHPDoG0tn2pbW2dbGd1jYfcoT2CuFQCf+/9Lz7GwWlzZEqjxee7Y/xyLKzB1loNTJB8WU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=bSdBf8Ud; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="bSdBf8Ud" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1732187560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Maji7FxozMUFLkaNeeOZzfTm4x1U5petjUrW+pAnx8M=; b=bSdBf8UddCdj/BfpeG7XflSm6+KUfbBntOpTyHItXufBhf/F+U8mWsspupm4ohXmCNRQ9m 7jw9CaN9O3w4cs/7Js1I0tEVORBqcLMq8BaMjtC9D3uW+l8exPI+VDv9//fO/RSFT0thT7 u7Cv6xNIZGd+bm4k9JmajQXjUeoAaQs= From: George Guo To: jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, joe.lawrence@redhat.com, shuah@kernel.org Cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, George Guo Subject: [PATCH livepatch/master v1 3/6] selftests/livepatch: fix test-livepatch.sh execution error Date: Thu, 21 Nov 2024 19:11:32 +0800 Message-Id: <20241121111135.2125391-3-dongtai.guo@linux.dev> In-Reply-To: <20241121111135.2125391-1-dongtai.guo@linux.dev> References: <20241121111135.2125391-1-dongtai.guo@linux.dev> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT From: George Guo The script test-callbacks.sh fails with the following error: $ sudo ./test-livepatch.sh TEST: basic function patching ... not ok - expected + result % insmod test_modules/test_klp_livepatch.ko livepatch: enabling patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': initializing patching transition -livepatch: 'test_klp_livepatch': starting patching transition -livepatch: 'test_klp_livepatch': completing patching transition -livepatch: 'test_klp_livepatch': patching complete +transition: 'test_klp_livepatch': initializing patching transition +transition: 'test_klp_livepatch': starting patching transition +transition: 'test_klp_livepatch': completing patching transition +transition: 'test_klp_livepatch': patching complete % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled -livepatch: 'test_klp_livepatch': initializing unpatching transition -livepatch: 'test_klp_livepatch': starting unpatching transition -livepatch: 'test_klp_livepatch': completing unpatching transition -livepatch: 'test_klp_livepatch': unpatching complete +transition: 'test_klp_livepatch': initializing unpatching transition +transition: 'test_klp_livepatch': starting unpatching transition +transition: 'test_klp_livepatch': completing unpatching transition +transition: 'test_klp_livepatch': unpatching complete % rmmod test_klp_livepatch ERROR: livepatch kselftest(s) failed The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values. This patch updates the expected test output to reflect the new log format. Signed-off-by: George Guo --- .../selftests/livepatch/test-livepatch.sh | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/tools/testing/selftests/livepatch/test-livepatch.sh b/tools/testing/selftests/livepatch/test-livepatch.sh index bd13257bfdfe..1297a6bf2bdd 100755 --- a/tools/testing/selftests/livepatch/test-livepatch.sh +++ b/tools/testing/selftests/livepatch/test-livepatch.sh @@ -35,15 +35,15 @@ fi check_result "% insmod test_modules/$MOD_LIVEPATCH1.ko livepatch: enabling patch '$MOD_LIVEPATCH1' -livepatch: '$MOD_LIVEPATCH1': initializing patching transition -livepatch: '$MOD_LIVEPATCH1': starting patching transition -livepatch: '$MOD_LIVEPATCH1': completing patching transition -livepatch: '$MOD_LIVEPATCH1': patching complete +transition: '$MOD_LIVEPATCH1': initializing patching transition +transition: '$MOD_LIVEPATCH1': starting patching transition +transition: '$MOD_LIVEPATCH1': completing patching transition +transition: '$MOD_LIVEPATCH1': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH1/enabled -livepatch: '$MOD_LIVEPATCH1': initializing unpatching transition -livepatch: '$MOD_LIVEPATCH1': starting unpatching transition -livepatch: '$MOD_LIVEPATCH1': completing unpatching transition -livepatch: '$MOD_LIVEPATCH1': unpatching complete +transition: '$MOD_LIVEPATCH1': initializing unpatching transition +transition: '$MOD_LIVEPATCH1': starting unpatching transition +transition: '$MOD_LIVEPATCH1': completing unpatching transition +transition: '$MOD_LIVEPATCH1': unpatching complete % rmmod $MOD_LIVEPATCH1" @@ -79,31 +79,31 @@ grep 'live patched' /proc/meminfo > /dev/kmsg check_result "% insmod test_modules/$MOD_LIVEPATCH1.ko livepatch: enabling patch '$MOD_LIVEPATCH1' -livepatch: '$MOD_LIVEPATCH1': initializing patching transition -livepatch: '$MOD_LIVEPATCH1': starting patching transition -livepatch: '$MOD_LIVEPATCH1': completing patching transition -livepatch: '$MOD_LIVEPATCH1': patching complete +transition: '$MOD_LIVEPATCH1': initializing patching transition +transition: '$MOD_LIVEPATCH1': starting patching transition +transition: '$MOD_LIVEPATCH1': completing patching transition +transition: '$MOD_LIVEPATCH1': patching complete $MOD_LIVEPATCH1: this has been live patched % insmod test_modules/$MOD_REPLACE.ko replace=0 livepatch: enabling patch '$MOD_REPLACE' -livepatch: '$MOD_REPLACE': initializing patching transition -livepatch: '$MOD_REPLACE': starting patching transition -livepatch: '$MOD_REPLACE': completing patching transition -livepatch: '$MOD_REPLACE': patching complete +transition: '$MOD_REPLACE': initializing patching transition +transition: '$MOD_REPLACE': starting patching transition +transition: '$MOD_REPLACE': completing patching transition +transition: '$MOD_REPLACE': patching complete $MOD_LIVEPATCH1: this has been live patched $MOD_REPLACE: this has been live patched % echo 0 > /sys/kernel/livepatch/$MOD_REPLACE/enabled -livepatch: '$MOD_REPLACE': initializing unpatching transition -livepatch: '$MOD_REPLACE': starting unpatching transition -livepatch: '$MOD_REPLACE': completing unpatching transition -livepatch: '$MOD_REPLACE': unpatching complete +transition: '$MOD_REPLACE': initializing unpatching transition +transition: '$MOD_REPLACE': starting unpatching transition +transition: '$MOD_REPLACE': completing unpatching transition +transition: '$MOD_REPLACE': unpatching complete % rmmod $MOD_REPLACE $MOD_LIVEPATCH1: this has been live patched % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH1/enabled -livepatch: '$MOD_LIVEPATCH1': initializing unpatching transition -livepatch: '$MOD_LIVEPATCH1': starting unpatching transition -livepatch: '$MOD_LIVEPATCH1': completing unpatching transition -livepatch: '$MOD_LIVEPATCH1': unpatching complete +transition: '$MOD_LIVEPATCH1': initializing unpatching transition +transition: '$MOD_LIVEPATCH1': starting unpatching transition +transition: '$MOD_LIVEPATCH1': completing unpatching transition +transition: '$MOD_LIVEPATCH1': unpatching complete % rmmod $MOD_LIVEPATCH1" @@ -158,41 +158,41 @@ grep 'live patched' /proc/meminfo > /dev/kmsg check_result "% insmod test_modules/$MOD_LIVEPATCH1.ko livepatch: enabling patch '$MOD_LIVEPATCH1' -livepatch: '$MOD_LIVEPATCH1': initializing patching transition -livepatch: '$MOD_LIVEPATCH1': starting patching transition -livepatch: '$MOD_LIVEPATCH1': completing patching transition -livepatch: '$MOD_LIVEPATCH1': patching complete +transition: '$MOD_LIVEPATCH1': initializing patching transition +transition: '$MOD_LIVEPATCH1': starting patching transition +transition: '$MOD_LIVEPATCH1': completing patching transition +transition: '$MOD_LIVEPATCH1': patching complete $MOD_LIVEPATCH1: this has been live patched % insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': patching complete % insmod test_modules/$MOD_LIVEPATCH3.ko livepatch: enabling patch '$MOD_LIVEPATCH3' -livepatch: '$MOD_LIVEPATCH3': initializing patching transition +transition: '$MOD_LIVEPATCH3': initializing patching transition $MOD_LIVEPATCH3: pre_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH3': starting patching transition -livepatch: '$MOD_LIVEPATCH3': completing patching transition +transition: '$MOD_LIVEPATCH3': starting patching transition +transition: '$MOD_LIVEPATCH3': completing patching transition $MOD_LIVEPATCH3: post_patch_callback: vmlinux -livepatch: '$MOD_LIVEPATCH3': patching complete +transition: '$MOD_LIVEPATCH3': patching complete % insmod test_modules/$MOD_REPLACE.ko replace=1 livepatch: enabling patch '$MOD_REPLACE' -livepatch: '$MOD_REPLACE': initializing patching transition -livepatch: '$MOD_REPLACE': starting patching transition -livepatch: '$MOD_REPLACE': completing patching transition -livepatch: '$MOD_REPLACE': patching complete +transition: '$MOD_REPLACE': initializing patching transition +transition: '$MOD_REPLACE': starting patching transition +transition: '$MOD_REPLACE': completing patching transition +transition: '$MOD_REPLACE': patching complete $MOD_REPLACE: this has been live patched % rmmod $MOD_LIVEPATCH3 % rmmod $MOD_LIVEPATCH2 % rmmod $MOD_LIVEPATCH1 $MOD_REPLACE: this has been live patched % echo 0 > /sys/kernel/livepatch/$MOD_REPLACE/enabled -livepatch: '$MOD_REPLACE': initializing unpatching transition -livepatch: '$MOD_REPLACE': starting unpatching transition -livepatch: '$MOD_REPLACE': completing unpatching transition -livepatch: '$MOD_REPLACE': unpatching complete +transition: '$MOD_REPLACE': initializing unpatching transition +transition: '$MOD_REPLACE': starting unpatching transition +transition: '$MOD_REPLACE': completing unpatching transition +transition: '$MOD_REPLACE': unpatching complete % rmmod $MOD_REPLACE" From patchwork Thu Nov 21 11:11:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Guo X-Patchwork-Id: 13881843 Received: from out-187.mta0.migadu.com (out-187.mta0.migadu.com [91.218.175.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FDC61D4169 for ; Thu, 21 Nov 2024 11:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187569; cv=none; b=Y3LU2Z39Bkfxk55tyGhd4h9upU8z6W5IMRqVu+luC9DV7sWdnyAjGIaZlsw4tWB4XLFUczjAPsjZ8VQewpl2+g7/n2sA8cxQtC3Qt6j8G01LRLOR7WY4eS7EJwb47xcl/CUk2VMiJzK/6+7FH1meJVpJexAuA/6Y/dMkbu5/3m4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187569; c=relaxed/simple; bh=RRtJFy3H+j5Va2Ad03syX0ml7ZhdIHJZUwcDEOUERak=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=klI8p7KWLMVOW99QG98/Hh7u1lgVxJdft13wemE2UVfLbHbf2o2KKjrco2jRWPkJcfxRYjWpD5KphTa7pgUrs69U8iqelwuamboHVZs68KAMveQp8hQABwZU6YQd7t/W7KBtvdSivWtXyhCIzOEqtym/wWLl2VCYY47H/fXCBQA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=kBCwBzxn; arc=none smtp.client-ip=91.218.175.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="kBCwBzxn" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1732187565; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MgYqTMe5Lo0DxiDXXWlq/mu1KpAbTwPFzNCKycN/3KA=; b=kBCwBzxn8dV1dQvTC1NtvK2wUI5wbJzztiZJ6bEP+vWgDZO8b9fDT8qrfLaHtaykjAgiyq 6Je7JPeFq4XFf0fAs4ZFX5ceNmVcis0zm4sqfGO24ht+lplF2Kg9ZACJT4hlz/zLX4+7k9 a+DteLKcyBczGn7FCOXkU2g8keZUxKQ= From: George Guo To: jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, joe.lawrence@redhat.com, shuah@kernel.org Cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, George Guo Subject: [PATCH livepatch/master v1 4/6] selftests/livepatch: fix test-state.sh execution error Date: Thu, 21 Nov 2024 19:11:33 +0800 Message-Id: <20241121111135.2125391-4-dongtai.guo@linux.dev> In-Reply-To: <20241121111135.2125391-1-dongtai.guo@linux.dev> References: <20241121111135.2125391-1-dongtai.guo@linux.dev> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT From: George Guo $ sudo ./test-state.sh TEST: system state modification ... not ok - expected + result % insmod test_modules/test_klp_state.ko livepatch: enabling patch 'test_klp_state' -livepatch: 'test_klp_state': initializing patching transition +transition: 'test_klp_state': initializing patching transition test_klp_state: pre_patch_callback: vmlinux test_klp_state: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: 'test_klp_state': starting patching transition -livepatch: 'test_klp_state': completing patching transition +transition: 'test_klp_state': starting patching transition +transition: 'test_klp_state': completing patching transition test_klp_state: post_patch_callback: vmlinux test_klp_state: fix_console_loglevel: fixing console_loglevel -livepatch: 'test_klp_state': patching complete +transition: 'test_klp_state': patching complete % echo 0 > /sys/kernel/livepatch/test_klp_state/enabled -livepatch: 'test_klp_state': initializing unpatching transition +transition: 'test_klp_state': initializing unpatching transition test_klp_state: pre_unpatch_callback: vmlinux test_klp_state: restore_console_loglevel: restoring console_loglevel -livepatch: 'test_klp_state': starting unpatching transition -livepatch: 'test_klp_state': completing unpatching transition +transition: 'test_klp_state': starting unpatching transition +transition: 'test_klp_state': completing unpatching transition test_klp_state: post_unpatch_callback: vmlinux test_klp_state: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: 'test_klp_state': unpatching complete +transition: 'test_klp_state': unpatching complete % rmmod test_klp_state ERROR: livepatch kselftest(s) failed The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values. This patch updates the expected test output to reflect the new log format. Signed-off-by: George Guo --- .../testing/selftests/livepatch/test-state.sh | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/tools/testing/selftests/livepatch/test-state.sh b/tools/testing/selftests/livepatch/test-state.sh index 10a52ac06185..887e9b4e8a77 100755 --- a/tools/testing/selftests/livepatch/test-state.sh +++ b/tools/testing/selftests/livepatch/test-state.sh @@ -21,23 +21,23 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: fix_console_loglevel: fixing console_loglevel -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': initializing unpatching transition $MOD_LIVEPATCH: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH: restore_console_loglevel: restoring console_loglevel -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition $MOD_LIVEPATCH: post_unpatch_callback: vmlinux $MOD_LIVEPATCH: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH" @@ -53,34 +53,34 @@ unload_lp $MOD_LIVEPATCH2 check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': initializing patching transition $MOD_LIVEPATCH: pre_patch_callback: vmlinux $MOD_LIVEPATCH: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition $MOD_LIVEPATCH: post_patch_callback: vmlinux $MOD_LIVEPATCH: fix_console_loglevel: fixing console_loglevel -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': patching complete % insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux $MOD_LIVEPATCH2: allocate_loglevel_state: space to store console_loglevel already allocated -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux $MOD_LIVEPATCH2: fix_console_loglevel: taking over the console_loglevel change -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % rmmod $MOD_LIVEPATCH % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH2: restore_console_loglevel: restoring console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux $MOD_LIVEPATCH2: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % rmmod $MOD_LIVEPATCH2" @@ -98,44 +98,44 @@ unload_lp $MOD_LIVEPATCH3 check_result "% insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux $MOD_LIVEPATCH2: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux $MOD_LIVEPATCH2: fix_console_loglevel: fixing console_loglevel -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % insmod test_modules/$MOD_LIVEPATCH3.ko livepatch: enabling patch '$MOD_LIVEPATCH3' -livepatch: '$MOD_LIVEPATCH3': initializing patching transition +transition: '$MOD_LIVEPATCH3': initializing patching transition $MOD_LIVEPATCH3: pre_patch_callback: vmlinux $MOD_LIVEPATCH3: allocate_loglevel_state: space to store console_loglevel already allocated -livepatch: '$MOD_LIVEPATCH3': starting patching transition -livepatch: '$MOD_LIVEPATCH3': completing patching transition +transition: '$MOD_LIVEPATCH3': starting patching transition +transition: '$MOD_LIVEPATCH3': completing patching transition $MOD_LIVEPATCH3: post_patch_callback: vmlinux $MOD_LIVEPATCH3: fix_console_loglevel: taking over the console_loglevel change -livepatch: '$MOD_LIVEPATCH3': patching complete +transition: '$MOD_LIVEPATCH3': patching complete % rmmod $MOD_LIVEPATCH2 % insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux $MOD_LIVEPATCH2: allocate_loglevel_state: space to store console_loglevel already allocated -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux $MOD_LIVEPATCH2: fix_console_loglevel: taking over the console_loglevel change -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH2: restore_console_loglevel: restoring console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux $MOD_LIVEPATCH2: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % rmmod $MOD_LIVEPATCH2 % rmmod $MOD_LIVEPATCH3" @@ -151,26 +151,26 @@ unload_lp $MOD_LIVEPATCH2 check_result "% insmod test_modules/$MOD_LIVEPATCH2.ko livepatch: enabling patch '$MOD_LIVEPATCH2' -livepatch: '$MOD_LIVEPATCH2': initializing patching transition +transition: '$MOD_LIVEPATCH2': initializing patching transition $MOD_LIVEPATCH2: pre_patch_callback: vmlinux $MOD_LIVEPATCH2: allocate_loglevel_state: allocating space to store console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting patching transition -livepatch: '$MOD_LIVEPATCH2': completing patching transition +transition: '$MOD_LIVEPATCH2': starting patching transition +transition: '$MOD_LIVEPATCH2': completing patching transition $MOD_LIVEPATCH2: post_patch_callback: vmlinux $MOD_LIVEPATCH2: fix_console_loglevel: fixing console_loglevel -livepatch: '$MOD_LIVEPATCH2': patching complete +transition: '$MOD_LIVEPATCH2': patching complete % insmod test_modules/$MOD_LIVEPATCH.ko livepatch: Livepatch patch ($MOD_LIVEPATCH) is not compatible with the already installed livepatches. insmod: ERROR: could not insert module test_modules/$MOD_LIVEPATCH.ko: Invalid parameters % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH2/enabled -livepatch: '$MOD_LIVEPATCH2': initializing unpatching transition +transition: '$MOD_LIVEPATCH2': initializing unpatching transition $MOD_LIVEPATCH2: pre_unpatch_callback: vmlinux $MOD_LIVEPATCH2: restore_console_loglevel: restoring console_loglevel -livepatch: '$MOD_LIVEPATCH2': starting unpatching transition -livepatch: '$MOD_LIVEPATCH2': completing unpatching transition +transition: '$MOD_LIVEPATCH2': starting unpatching transition +transition: '$MOD_LIVEPATCH2': completing unpatching transition $MOD_LIVEPATCH2: post_unpatch_callback: vmlinux $MOD_LIVEPATCH2: free_loglevel_state: freeing space for the stored console_loglevel -livepatch: '$MOD_LIVEPATCH2': unpatching complete +transition: '$MOD_LIVEPATCH2': unpatching complete % rmmod $MOD_LIVEPATCH2" exit 0 From patchwork Thu Nov 21 11:11:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Guo X-Patchwork-Id: 13881844 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77D5E1D47C0 for ; Thu, 21 Nov 2024 11:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187574; cv=none; b=EKJZJuKLzUVIoZge3PlEzV5OUF/+wNDWzus2e41G+2eI/M/ALdHc/UgkbCM1B5EskbSLT2rlPYCRtdXIQr8RdzqPSAX+Seaqsdqx+v71eJ05aQDf0wXw/NBRGs5baKJqPVc0hcHTqZSxP7mQH21mJ9an+mMM5fpIk3VYzo5m97E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187574; c=relaxed/simple; bh=NaCa9ic4fK0FA3M6dlX08gXSUhjXD1mlxn3SJNVLMQY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DOMt/3oGgMJk57eG7nElcpdBdAb+GXp8FOo1gImqtuDmJohRa/6pHnU+yapEM5Ih1ENB4XQ90BNYJwT+ufpmblhIpHLDiK5XQDk034KrRjloBsVZwQcfoND4288M8IhHDfileG3AUSnbk9LfyZt9Rw4WmlgUfPALFoa0O2dzfFI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=fqfKs6xh; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="fqfKs6xh" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1732187570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7RY+9QBcT+pSq0hO9Bjo07xtHlAvNSWQsuP/+tIPeRM=; b=fqfKs6xh+DxfvcqeVVp7uT/0aCNIxsiEq2h7kQx1Qw+vUYs4C0dXaU0+DA3bZGrSLLOzHQ 3qPu6gDa9yEhh8I/8pTjRyOWH2bJ0sS+J00o1A9HpO+s+mTkGgP2S6obG+BVgMMHWOoMTb 5enRTTa9HxLdPcss7fl/EPua0nsbczA= From: George Guo To: jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, joe.lawrence@redhat.com, shuah@kernel.org Cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, George Guo Subject: [PATCH livepatch/master v1 5/6] selftests/livepatch: fix test-syscall.sh execution error Date: Thu, 21 Nov 2024 19:11:34 +0800 Message-Id: <20241121111135.2125391-5-dongtai.guo@linux.dev> In-Reply-To: <20241121111135.2125391-1-dongtai.guo@linux.dev> References: <20241121111135.2125391-1-dongtai.guo@linux.dev> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT From: George Guo The script test-syscall.sh fails with the following error: $ sudo ./test-syscall.sh TEST: patch getpid syscall while being heavily hammered ... not ok - expected + result % insmod test_modules/test_klp_syscall.ko klp_pids=18484,18485,18486,18487,18488,18489,18490,... livepatch: enabling patch 'test_klp_syscall' -livepatch: 'test_klp_syscall': initializing patching transition -livepatch: 'test_klp_syscall': starting patching transition -livepatch: 'test_klp_syscall': completing patching transition -livepatch: 'test_klp_syscall': patching complete +transition: 'test_klp_syscall': initializing patching transition +transition: 'test_klp_syscall': starting patching transition +transition: 'test_klp_syscall': completing patching transition +transition: 'test_klp_syscall': patching complete test_klp_syscall: Remaining not livepatched processes: 0 % echo 0 > /sys/kernel/livepatch/test_klp_syscall/enabled -livepatch: 'test_klp_syscall': initializing unpatching transition -livepatch: 'test_klp_syscall': starting unpatching transition -livepatch: 'test_klp_syscall': completing unpatching transition -livepatch: 'test_klp_syscall': unpatching complete +transition: 'test_klp_syscall': initializing unpatching transition +transition: 'test_klp_syscall': starting unpatching transition +transition: 'test_klp_syscall': completing unpatching transition +transition: 'test_klp_syscall': unpatching complete % rmmod test_klp_syscall ERROR: livepatch kselftest(s) failed The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values. This patch updates the expected test output to reflect the new log format. Signed-off-by: George Guo --- .../testing/selftests/livepatch/test-syscall.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/livepatch/test-syscall.sh b/tools/testing/selftests/livepatch/test-syscall.sh index 289eb7d4c4b3..6493e1115add 100755 --- a/tools/testing/selftests/livepatch/test-syscall.sh +++ b/tools/testing/selftests/livepatch/test-syscall.sh @@ -41,16 +41,16 @@ unload_lp $MOD_SYSCALL check_result "% insmod test_modules/$MOD_SYSCALL.ko klp_pids=$pid_list livepatch: enabling patch '$MOD_SYSCALL' -livepatch: '$MOD_SYSCALL': initializing patching transition -livepatch: '$MOD_SYSCALL': starting patching transition -livepatch: '$MOD_SYSCALL': completing patching transition -livepatch: '$MOD_SYSCALL': patching complete +transition: '$MOD_SYSCALL': initializing patching transition +transition: '$MOD_SYSCALL': starting patching transition +transition: '$MOD_SYSCALL': completing patching transition +transition: '$MOD_SYSCALL': patching complete $MOD_SYSCALL: Remaining not livepatched processes: 0 % echo 0 > /sys/kernel/livepatch/$MOD_SYSCALL/enabled -livepatch: '$MOD_SYSCALL': initializing unpatching transition -livepatch: '$MOD_SYSCALL': starting unpatching transition -livepatch: '$MOD_SYSCALL': completing unpatching transition -livepatch: '$MOD_SYSCALL': unpatching complete +transition: '$MOD_SYSCALL': initializing unpatching transition +transition: '$MOD_SYSCALL': starting unpatching transition +transition: '$MOD_SYSCALL': completing unpatching transition +transition: '$MOD_SYSCALL': unpatching complete % rmmod $MOD_SYSCALL" exit 0 From patchwork Thu Nov 21 11:11:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Guo X-Patchwork-Id: 13881845 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FEE31D63DC for ; Thu, 21 Nov 2024 11:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187579; cv=none; b=if2ecCuCH+gvCb8X8eHD4bLvKo1l/RVyGBf9P6Et2PF91lG8srOPzu9ZVqg4+nAxNgFsL2rR1wn5TLcthwHCapG6uWhxPQI+AieW8xhSAqeqY6H2R96ufa7CB0a1BtGmA67cr0+dKiO8paDEzVmIC0BAfqR7qcwrvc/pR69h+GE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732187579; c=relaxed/simple; bh=VE7MUh5+iQwKTqpfwZLY1fHwwKqkM6/FBkofRYDxa4A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jvn77Cfzer3tzek+fj/3+p3lrf0wyuuFjNSHgTJcbbtgY6jXf9TxYnO2osotsJxsFP0WSPwKI9izB/2o7gW6aqqJY5WIP4eIWlk6xYjrvTz+5cuAnZ5Bcsxe5G4rvRJl1NjUjfOZPQsO7sst2awT2w2tSdeoACcNCIHCLpjZFCY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=v0DFFyY3; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="v0DFFyY3" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1732187575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=76vuuYqaL6aHm6G8MsofNUQkaRfjxHCsBlGojg6fu/w=; b=v0DFFyY3c+fP379s2O8ntaMxncgP50oL8ok+XwJR+nv8GTJaaRM1sY7EDLEHdCEWopAzr6 s/wXD2j+z57GgD3is8vJF6bR92EpA05HOie6UyhKBUeBJy9u8Uu3x69w60SLsI7+nA7nX3 V43XaTup8AB7rlCPqqD9S9TRHRygSFg= From: George Guo To: jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, joe.lawrence@redhat.com, shuah@kernel.org Cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, George Guo Subject: [PATCH livepatch/master v1 6/6] selftests/livepatch: fix test-sysfs.sh execution error Date: Thu, 21 Nov 2024 19:11:35 +0800 Message-Id: <20241121111135.2125391-6-dongtai.guo@linux.dev> In-Reply-To: <20241121111135.2125391-1-dongtai.guo@linux.dev> References: <20241121111135.2125391-1-dongtai.guo@linux.dev> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT From: George Guo The script test-sysfs.sh fails with the following error: $ sudo ./test-sysfs.sh TEST: sysfs test ... not ok - expected + result % insmod test_modules/test_klp_livepatch.ko livepatch: enabling patch 'test_klp_livepatch' -livepatch: 'test_klp_livepatch': initializing patching transition -livepatch: 'test_klp_livepatch': starting patching transition -livepatch: 'test_klp_livepatch': completing patching transition -livepatch: 'test_klp_livepatch': patching complete +transition: 'test_klp_livepatch': initializing patching transition +transition: 'test_klp_livepatch': starting patching transition +transition: 'test_klp_livepatch': completing patching transition +transition: 'test_klp_livepatch': patching complete % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled -livepatch: 'test_klp_livepatch': initializing unpatching transition -livepatch: 'test_klp_livepatch': starting unpatching transition -livepatch: 'test_klp_livepatch': completing unpatching transition -livepatch: 'test_klp_livepatch': unpatching complete +transition: 'test_klp_livepatch': initializing unpatching transition +transition: 'test_klp_livepatch': starting unpatching transition +transition: 'test_klp_livepatch': completing unpatching transition +transition: 'test_klp_livepatch': unpatching complete % rmmod test_klp_livepatch ERROR: livepatch kselftest(s) failed The issue arises due to a mismatch in expected log output during livepatch transition. Specifically, the logs previously contained "livepatch:" but have now been updated to "transition:". This results in test failures when comparing the output with the expected values. This patch updates the expected test output to reflect the new log format. Signed-off-by: George Guo --- .../testing/selftests/livepatch/test-sysfs.sh | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/tools/testing/selftests/livepatch/test-sysfs.sh b/tools/testing/selftests/livepatch/test-sysfs.sh index 05a14f5a7bfb..f9a27505d7a4 100755 --- a/tools/testing/selftests/livepatch/test-sysfs.sh +++ b/tools/testing/selftests/livepatch/test-sysfs.sh @@ -30,15 +30,15 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/$MOD_LIVEPATCH.ko livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH" start_test "sysfs test object/patched" @@ -59,12 +59,12 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/test_klp_callbacks_demo.ko livepatch: enabling patch 'test_klp_callbacks_demo' -livepatch: 'test_klp_callbacks_demo': initializing patching transition +transition: 'test_klp_callbacks_demo': initializing patching transition test_klp_callbacks_demo: pre_patch_callback: vmlinux -livepatch: 'test_klp_callbacks_demo': starting patching transition -livepatch: 'test_klp_callbacks_demo': completing patching transition +transition: 'test_klp_callbacks_demo': starting patching transition +transition: 'test_klp_callbacks_demo': completing patching transition test_klp_callbacks_demo: post_patch_callback: vmlinux -livepatch: 'test_klp_callbacks_demo': patching complete +transition: 'test_klp_callbacks_demo': patching complete % insmod test_modules/test_klp_callbacks_mod.ko livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init @@ -76,12 +76,12 @@ test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled -livepatch: 'test_klp_callbacks_demo': initializing unpatching transition +transition: 'test_klp_callbacks_demo': initializing unpatching transition test_klp_callbacks_demo: pre_unpatch_callback: vmlinux -livepatch: 'test_klp_callbacks_demo': starting unpatching transition -livepatch: 'test_klp_callbacks_demo': completing unpatching transition +transition: 'test_klp_callbacks_demo': starting unpatching transition +transition: 'test_klp_callbacks_demo': completing unpatching transition test_klp_callbacks_demo: post_unpatch_callback: vmlinux -livepatch: 'test_klp_callbacks_demo': unpatching complete +transition: 'test_klp_callbacks_demo': unpatching complete % rmmod test_klp_callbacks_demo" start_test "sysfs test replace enabled" @@ -97,15 +97,15 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/$MOD_LIVEPATCH.ko replace=1 livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH" start_test "sysfs test replace disabled" @@ -120,15 +120,15 @@ unload_lp $MOD_LIVEPATCH check_result "% insmod test_modules/$MOD_LIVEPATCH.ko replace=0 livepatch: enabling patch '$MOD_LIVEPATCH' -livepatch: '$MOD_LIVEPATCH': initializing patching transition -livepatch: '$MOD_LIVEPATCH': starting patching transition -livepatch: '$MOD_LIVEPATCH': completing patching transition -livepatch: '$MOD_LIVEPATCH': patching complete +transition: '$MOD_LIVEPATCH': initializing patching transition +transition: '$MOD_LIVEPATCH': starting patching transition +transition: '$MOD_LIVEPATCH': completing patching transition +transition: '$MOD_LIVEPATCH': patching complete % echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled -livepatch: '$MOD_LIVEPATCH': initializing unpatching transition -livepatch: '$MOD_LIVEPATCH': starting unpatching transition -livepatch: '$MOD_LIVEPATCH': completing unpatching transition -livepatch: '$MOD_LIVEPATCH': unpatching complete +transition: '$MOD_LIVEPATCH': initializing unpatching transition +transition: '$MOD_LIVEPATCH': starting unpatching transition +transition: '$MOD_LIVEPATCH': completing unpatching transition +transition: '$MOD_LIVEPATCH': unpatching complete % rmmod $MOD_LIVEPATCH" exit 0