From patchwork Fri Mar 1 19:40:33 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: 209074 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp134430dyc; Fri, 1 Mar 2024 12:22:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX/0JfXhST+syHlePMYMvuAfvyfEP3Rua++aW4eKRmAX3N6liXT3WYRY2K5Ywn07gI5/s7SU7/pP+eMFen8ewJqZvk9uw== X-Google-Smtp-Source: AGHT+IE9equVcxPzpXoiNA2AXMBHaTy7zNmSY7ItBtMQKVHtuWGUrpxao0yyMcxTen2CgExQ4ap2 X-Received: by 2002:a05:6808:1291:b0:3c1:88d1:f051 with SMTP id a17-20020a056808129100b003c188d1f051mr3364201oiw.31.1709324522340; Fri, 01 Mar 2024 12:22:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709324522; cv=pass; d=google.com; s=arc-20160816; b=iK6hX3EPQ4DT7H5T2b+aK5pjmYajgWd2vrRQjyZxsRLx1EV4ROR5RTtLXMq8McSEok 0YfuWcwrYjXCWMd6o8PantbTI69ZjC7T/nE34R1UPpeYT1ErvjAUsnY92xnoeaaMW92l 6qdAhG6DRh/n8g/k6uLNysVXG2mKbQdGTEXgwqaXPFh/S6GR8/rKWVoaKCYGAg/QXhZ3 0gfFaIq3ZTWiKoNGwPcjMOnRJoJYVWG9z8Mpbiuypt2ukfGggjDPPKSxlRTTHtJcns8+ tsCwd1UaDthETjGBAw71xWDToCYm8lREzRYwXw6LmZ+A65j8wwEp6zlSuY2tIkiA4NzV 3nGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BpqXJ/lwvMIYbzNZpRq0wAVeL/iFQENkAa0bt5dgsy4=; fh=MR/wbEn34JHmT+rtzWNq5RVU/RKi8DhjSvb3ywiuLkE=; b=zGGKUhliW6nmpSfhrg75PivuDQGaX0NI/EWrokf0WkBnrVbryERsXXuBjAng90K7dq Fyan7m4lV5NlEZS6oYuJ8UxTeapHMyQQLNj6hUQOq7OhfiDwbJHD8jBnshTn+1qu7fmW l9yzaTjbgk/xjj5a7jde67V+/MxAgxZez3EKC9a0cEIUtS4kesj8ZkadbSCpLa5D7M7N zUF0ZvxTSNqZxOZ1jgjY+rGul/bPQckBjHQ0WoKSDf0MDXkZXJazPYT2b3MfDTKoOgpD GOYzB9OkIUlJ1dXyshP06zqqRHt3jBuxmhF6f/Qb5/+Vw3dACRKCzoP4/z1yDVvSGU6c svmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=u9Fo3mrb; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89041-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89041-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id r4-20020a63d904000000b005dc4c1f8c5dsi4247173pgg.579.2024.03.01.12.22.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 12:22:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89041-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=u9Fo3mrb; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89041-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89041-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7CD09B2AC59 for ; Fri, 1 Mar 2024 19:42:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32A583D962; Fri, 1 Mar 2024 19:41:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="u9Fo3mrb" Received: from smtp-8faf.mail.infomaniak.ch (smtp-8faf.mail.infomaniak.ch [83.166.143.175]) (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 0DBE93B796 for ; Fri, 1 Mar 2024 19:40:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.166.143.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322057; cv=none; b=GeSY9RQeG8rHxsKbOLl7cEOki2GovEQ0vYKmNYduCh7Gk+VyfWmHzG3LFujKkR8mJTbLQMfOyYLY9UH9jsjlqBhgY67rlRp2BgyTDBuvKRXO2IyK4KxfnW4ZZN08WCyvbhAZbVi0nyh0hm8Md/5r+BnFdMQV3VOcpwBvYM9qVtg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322057; c=relaxed/simple; bh=ALcC3CaJfmLivYATmbVgo8sZG5WxbJSNk2vIXJaBKx4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EAXcmhhpP/ahmR6HNq5dGAGh1NeqU8ZmXsv+ctaO3WfIDMbFtaNPuu6FAuuLVfwGsBNYkHS3sj05usVpADVoROmqWrChcUZUseSGaDFS1UTD309YuQGpcuQCIfcZFuNcOjLw+zEXHE4w9OYOSVlLjF4vGTx3Mnecxw5HzdmlTl4= 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=u9Fo3mrb; arc=none smtp.client-ip=83.166.143.175 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 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 4Tmdjx2frwzktW; Fri, 1 Mar 2024 20:40:53 +0100 (CET) Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4Tmdjw3y19zq0s; Fri, 1 Mar 2024 20:40:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1709322053; bh=ALcC3CaJfmLivYATmbVgo8sZG5WxbJSNk2vIXJaBKx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u9Fo3mrbl+44096yxCQqPJrxB9Bv0UdKRFIxq9dJBpVvCydwx9rXQ6mjH/NsGOLfA 2bUnjD3vO4V6KmPD6bW8Y938TLqRPJMs4C0K1COoDdxa8dquqmPIFKJExCqnEdghWE Wc/zD+duRRuF5SzUY+RAhKgkL9Kr1oVplaska6p4= From: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= To: Brendan Higgins , David Gow , Kees Cook , Rae Moar , Shuah Khan Cc: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , Alan Maguire , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Ingo Molnar , James Morris , Luis Chamberlain , "Madhavan T . Venkataraman" , Marco Pagani , Paolo Bonzini , Sean Christopherson , Stephen Boyd , Thara Gopinath , Thomas Gleixner , Vitaly Kuznetsov , Wanpeng Li , Zahra Tarkhani , kvm@vger.kernel.org, linux-hardening@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-um@lists.infradead.org, x86@kernel.org Subject: [PATCH v2 3/7] kunit: Fix timeout message Date: Fri, 1 Mar 2024 20:40:33 +0100 Message-ID: <20240301194037.532117-4-mic@digikod.net> In-Reply-To: <20240301194037.532117-1-mic@digikod.net> References: <20240301194037.532117-1-mic@digikod.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Infomaniak-Routing: alpha X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792356670154364831 X-GMAIL-MSGID: 1792356670154364831 The exit code is always checked, so let's properly handle the -ETIMEDOUT error code. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240301194037.532117-4-mic@digikod.net --- Changes since v1: * Added 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);