From patchwork Mon Apr 8 07:46:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= X-Patchwork-Id: 13620693 Received: from smtp-bc0d.mail.infomaniak.ch (smtp-bc0d.mail.infomaniak.ch [45.157.188.13]) (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 9064D25632 for ; Mon, 8 Apr 2024 07:47:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.157.188.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712562425; cv=none; b=OT7VNETqKuQQ3kDQkcf9lowzooOJ9xGYYjN7GQfjbGDapicCJe3Me9+svKNKAne1ze0Fc8Y0YhVPu3YJ7E1ZZHoEIaASeMUUl/ThbhJk4oHt/jcu8X0GcUeIlSTLy+siuVQY1o25EJYoGmCFt+t4GddJNpMlzskhKIx9WfbfEYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712562425; c=relaxed/simple; bh=VJFdkTh/km1xtMPWkzEpkJ8emx8mB7Rg9MPUkxvmsXE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ePiZy3W8tYzLKJ1jwX1pRH3QeFtRQiylU1Z0KkPMe4zPMWkABKZAzVnzRyQI71ZTxG7zy8KId/8R2WoX1hZag/knMSWqJmFRZ9yBeF+WrSZw2hAznq5Ysm3QdVaU+taYw0bZuwj2oMROYZ/PQSaDCw+qVQWVwitDhF+z3/GirZE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=JZCVGpxy; arc=none smtp.client-ip=45.157.188.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="JZCVGpxy" Received: from smtp-4-0001.mail.infomaniak.ch (smtp-4-0001.mail.infomaniak.ch [10.7.10.108]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4VCh4b1KGpzRYZ; Mon, 8 Apr 2024 09:46:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1712562415; bh=VJFdkTh/km1xtMPWkzEpkJ8emx8mB7Rg9MPUkxvmsXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZCVGpxyC7wKt8SCE6iK+589pz7mFMBMA3DXgacDAOlCOjKvUbv/j3UjwrzZFY14H LHrlonbXugFii0J+GC+mtMsWQF5J2VUmFQpbaleRc1LAckqrm11EO514SIkieYYl/p xJ1y/I7xuVXbdqIayYGjxst6c2/qDTomhUUdr/DQ= Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4VCh4Z2gXbzn4w; Mon, 8 Apr 2024 09:46:54 +0200 (CEST) From: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= To: Brendan Higgins , David Gow , Rae Moar , Shuah Khan Cc: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , Alan Maguire , Borislav Petkov , Dave Hansen , "Eric W . Biederman" , "H . Peter Anvin" , Ingo Molnar , James Morris , Kees Cook , Luis Chamberlain , "Madhavan T . Venkataraman" , Marco Pagani , Paolo Bonzini , Sean Christopherson , Stephen Boyd , Thara Gopinath , Thomas Gleixner , Vitaly Kuznetsov , Zahra Tarkhani , kunit-dev@googlegroups.com, kvm@vger.kernel.org, linux-hardening@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, linux-um@lists.infradead.org, x86@kernel.org Subject: [PATCH v4 RESEND 3/7] kunit: Fix timeout message Date: Mon, 8 Apr 2024 09:46:21 +0200 Message-ID: <20240408074625.65017-4-mic@digikod.net> In-Reply-To: <20240408074625.65017-1-mic@digikod.net> References: <20240408074625.65017-1-mic@digikod.net> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Infomaniak-Routing: alpha The exit code is always checked, so let's properly handle the -ETIMEDOUT error code. Cc: Brendan Higgins Cc: Shuah Khan Reviewed-by: Kees Cook Reviewed-by: David Gow Reviewed-by: Rae Moar Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240408074625.65017-4-mic@digikod.net --- Changes since v2: * Add Rae's and David's Reviewed-by. Changes since v1: * Add Kees's Reviewed-by. --- lib/kunit/try-catch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/kunit/try-catch.c b/lib/kunit/try-catch.c index 73f5007f20ea..cab8b24b5d5a 100644 --- a/lib/kunit/try-catch.c +++ b/lib/kunit/try-catch.c @@ -79,7 +79,6 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context) time_remaining = wait_for_completion_timeout(&try_completion, kunit_test_timeout()); if (time_remaining == 0) { - kunit_err(test, "try timed out\n"); try_catch->try_result = -ETIMEDOUT; kthread_stop(task_struct); } @@ -94,6 +93,8 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context) try_catch->try_result = 0; else if (exit_code == -EINTR) kunit_err(test, "wake_up_process() was never called\n"); + else if (exit_code == -ETIMEDOUT) + kunit_err(test, "try timed out\n"); else if (exit_code) kunit_err(test, "Unknown error: %d\n", exit_code);