Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp508198lqg; Fri, 1 Mar 2024 11:42:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUdOZYa23I7ecfJYPhASSP3sp+mnkDvKczREdy6WsnYKd+PGYpXyvOKjZc5FrRxQW6qmcoGzbvU1CynLbFSEuEtZF6bNfK53nOcbIC9+Q== X-Google-Smtp-Source: AGHT+IHb7B8ViCtaOXwS3BXNK9s4GK9jVAIPSbFx4bW3Z0AGGVTG3rdD0tCRa90D+wSsPAfe/ycy X-Received: by 2002:a05:6870:d610:b0:21e:7c86:6656 with SMTP id a16-20020a056870d61000b0021e7c866656mr2861205oaq.29.1709322140364; Fri, 01 Mar 2024 11:42:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709322140; cv=pass; d=google.com; s=arc-20160816; b=GrvAGE95G5i3mBf2C1SH7VXvZT49MpKMwRfszpZOPC3fdAwcXgea1fHnVo8clA62F4 5C6hY8c2jLYuYnJ2dwuWjAkLyTjoGsvg4aV7PpdZt9ZftTnoZ45HF58TPnsYiihq6/1r gmWUySGZu6duG3S7DE1ySy7mPzpgDyJYIsALQgu0etOAQAh0fVM5aq85NOeMnnRQtjgG BTrmR/SnUrhOGa9/W0AjG3NZqOoFb85+KnxlhI1KK5sQM1F3ewDKAAQkl7mlVpI969CV zpNzSCF+lqfDz429IZBEtiwTBvAQkgAi05TY4zGPsmLJUY6piLA1a5U/MMHvHlaeZoSs rXgQ== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89039-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h1-20020ac87141000000b0042ec7832b18si2093411qtp.541.2024.03.01.11.42.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:42:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89039-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89039-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 755E01C25B28 for ; Fri, 1 Mar 2024 19:41:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 812DD3C46D; Fri, 1 Mar 2024 19:40:56 +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 ; 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=20Sala=C3=BCn?= To: Brendan Higgins , David Gow , Kees Cook , Rae Moar , Shuah Khan Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=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 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: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Infomaniak-Routing: alpha 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 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-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; } -- 2.44.0