Message ID | 20240301194037.532117-2-mic@digikod.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-89039-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp115184dyc; Fri, 1 Mar 2024 11:43:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX4rO1AlnwMG2qtFtfv3DccWfpv/OdLWeyYfy0fJ+EhFJlsJTBf/saVrDwNWv4ykOtBkPqZNKQZdZAbiYMYhhp1Daumig== X-Google-Smtp-Source: AGHT+IGCKcwEIQuCLa0IPvLl8J60YXZrSs+NPWRCWqjSKqvI1SRl87pxtD9kkqaP8VaqBH6uo6bf X-Received: by 2002:aa7:c3d5:0:b0:566:b924:23e9 with SMTP id l21-20020aa7c3d5000000b00566b92423e9mr2336314edr.20.1709322194460; Fri, 01 Mar 2024 11:43:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709322194; cv=pass; d=google.com; s=arc-20160816; b=liOSJECWx/2EcCdu2DihYMNy+4pEW6ueGbTli5Fg0ckA+vITTpCPInwxOkyNggkYRX toW69zRWEDeOuLAxZt2YnkdqmdAUEAHLE0jOWgXv3gWEOhp/HSyimvPC/lTzHdKoBJ/j vkQnjW12DHJw8QKZH181JWEZs1fTDeIuWgYfbgdfPAWUajkxgELPxIfcFGmTV82enNjx vxaQqRbB+CceFf3X7LQVzyJDHGieqkJpoS61eo8PIhfyfMFKZknhQYC+pSEQbmBD+Jb8 NgjHarZJNbOVn6gHiAEIbfG+p1ubJ2gcAebtH8+vv6gt0CUXPk8K+E2MRmZBOiV9nao+ qp7g== 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=LC5EKLQTepdq2jdkga3aCWt3tJPeoAKukrYc+lqhvRM=; fh=MR/wbEn34JHmT+rtzWNq5RVU/RKi8DhjSvb3ywiuLkE=; b=O1Lk4RZL5CjWqIKD47waieqiY8osdchs8nKisbERSteF1/IroXQkSsxwHq5H7y7Erf 5Crk5VhD3Iw+pfep5VaOnF3vJODTKf84/twVJ8e2rke7GkJiziPCmIjiAV1r2f+6+a01 zZq2Nz0kQzuGrXaYI0JRHAke3oZj02wHpDxU3ku8D60KJFxBEJHBQzuRRnffsHHwo8Yb JY7jYu0w4m+fSroGNTa/yzW8FcIW7JsB4atRiMJGmDARReKIy5q84v+Qan8aw3Z4Su5H Iy1eTxJ2SoU3UY+6YU89+u7WGjeMYGOUg9yB226ctXdWTZV4GMqP3uVPuKtnBmcu3OuQ NiBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b="Vd+N/tIg"; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89039-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89039-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p26-20020a50cd9a000000b00566f9fae366si100625edi.223.2024.03.01.11.43.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:43:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89039-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b="Vd+N/tIg"; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89039-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89039-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 934EE1F27295 for <ouuuleilei@gmail.com>; Fri, 1 Mar 2024 19:42:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA62C3D552; Fri, 1 Mar 2024 19:40:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="Vd+N/tIg" Received: from smtp-bc0b.mail.infomaniak.ch (smtp-bc0b.mail.infomaniak.ch [45.157.188.11]) (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 7200F3B199 for <linux-kernel@vger.kernel.org>; Fri, 1 Mar 2024 19:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.157.188.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322055; cv=none; b=b9JYfis7n19s67lvE4A/HR9oHNtL61WRQFiFxKbmvkGpWPl0BaejzSFo+ew+c+FBOcpmTmjGbDm9lWMJbyIbwojxm2bKa20z0nSF6l0RZPV4VcB/gvGtk7FvFSwEMVtAfEcJDJ5uJE9BhTUkXCyxyRoWb+CHYMnZyTjN+G9VSG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322055; c=relaxed/simple; bh=jkhmQz7nkMs7xp2ykDqNMWSLInw6oMw8Eref1dxaomo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fS4/eWTJVykNiYcf9/yLuYwPO97GKcHcKjHRcngcj4KC62JYa6sWYcW3eeiBNnwHLqS76Td+dMJfFj3oTJjvulHRSVgz5hD3QbNUcTIBCaPS6X0B+eCXjtM4aOKVI3Fn1rxEhK0EzXXlKkh5DPOZ+4ZN4ZUbi+5slQgfKkw06Mo= 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=Vd+N/tIg; arc=none smtp.client-ip=45.157.188.11 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 4Tmdjt5ghXzkK1; Fri, 1 Mar 2024 20:40:50 +0100 (CET) Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4Tmdjt0SPqznyw; Fri, 1 Mar 2024 20:40:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1709322050; bh=jkhmQz7nkMs7xp2ykDqNMWSLInw6oMw8Eref1dxaomo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vd+N/tIgA2C6MTwZX8etILLsyzDPCEdWFm06zVVXnd3T/PZeUUlbXgO+5vW7bM1VX o6oY/T9zP+sgCjKPE9FQgDuYo3APtqNDmKr1JS8HLqpFP2xMdLnE2q1lZherO6MoI2 KHqktHrPWkaKpsb0ZNB4JKViPBvmEt0V5Tsu7CKw= From: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= <mic@digikod.net> To: Brendan Higgins <brendanhiggins@google.com>, David Gow <davidgow@google.com>, Kees Cook <keescook@chromium.org>, Rae Moar <rmoar@google.com>, Shuah Khan <skhan@linuxfoundation.org> Cc: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= <mic@digikod.net>, Alan Maguire <alan.maguire@oracle.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, "H . Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>, James Morris <jamorris@linux.microsoft.com>, Luis Chamberlain <mcgrof@kernel.org>, "Madhavan T . Venkataraman" <madvenka@linux.microsoft.com>, Marco Pagani <marpagan@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Sean Christopherson <seanjc@google.com>, Stephen Boyd <sboyd@kernel.org>, Thara Gopinath <tgopinath@microsoft.com>, Thomas Gleixner <tglx@linutronix.de>, Vitaly Kuznetsov <vkuznets@redhat.com>, Wanpeng Li <wanpengli@tencent.com>, Zahra Tarkhani <ztarkhani@microsoft.com>, 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 1/7] kunit: Handle thread creation error Date: Fri, 1 Mar 2024 20:40:31 +0100 Message-ID: <20240301194037.532117-2-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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Infomaniak-Routing: alpha X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792354229616745012 X-GMAIL-MSGID: 1792354229616745012 |
Series |
Handle faults in KUnit tests
|
|
Commit Message
Mickaël Salaün
March 1, 2024, 7:40 p.m. UTC
Previously, if a thread creation failed (e.g. -ENOMEM), the function was called (kunit_catch_run_case or kunit_catch_run_case_cleanup) without marking the test as failed. Instead, fill try_result with the error code returned by kthread_run(), which will mark the test as failed and print "internal error occurred...". Cc: Brendan Higgins <brendanhiggins@google.com> Cc: David Gow <davidgow@google.com> Cc: Rae Moar <rmoar@google.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Mickaël Salaün <mic@digikod.net> Link: https://lore.kernel.org/r/20240301194037.532117-2-mic@digikod.net --- Changes since v1: * Added Kees's Reviewed-by. --- lib/kunit/try-catch.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/lib/kunit/try-catch.c b/lib/kunit/try-catch.c index f7825991d576..a5cb2ef70a25 100644 --- a/lib/kunit/try-catch.c +++ b/lib/kunit/try-catch.c @@ -69,6 +69,7 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context) try_catch, "kunit_try_catch_thread"); if (IS_ERR(task_struct)) { + try_catch->try_result = PTR_ERR(task_struct); try_catch->catch(try_catch->context); return; }