Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp15688lqc; Thu, 29 Feb 2024 09:05:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWhsfQ1p3V7TWwLg9g1vEGifNmr+Alb6poT94zHDXZ0fm5L8gjpqBJHwRKGZaW8oNFzwlPQ14kYlG3QBLUTa/E2w7OrY1PiEUkACWE2+w== X-Google-Smtp-Source: AGHT+IG0i+3dFQwbWFXFnEOpSHKGa/u5F8OXrULLm7K+6I0eJtx/fGVpdqh1GNy17A87Wt9wtmf0 X-Received: by 2002:a05:6512:3e18:b0:513:2329:4308 with SMTP id i24-20020a0565123e1800b0051323294308mr2614157lfv.14.1709226326399; Thu, 29 Feb 2024 09:05:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709226326; cv=pass; d=google.com; s=arc-20160816; b=fjZTh7rAKLVh6wKMbhyO0r2qFhFf1PNc0L/GlUSgCMLalMTf+xT7pOBezYZMUkZwFd kaY1CWkttbFLnl5wWlGTeHwVEJUYRgibGhDdG0VAYHALTCRHoUtb+ixwW6oZp63bFgh7 VMenhDlM+aWpUEqv3FUpTz2Y325l1GXO8XZviAsF6uRxCuTlcYieO42JvT8zIT1en4dZ VIbwKIgQfWUe/w9lG2JbaJDmd5PP08ET9p+6IoW2AAoBgPg6Frym6iRNGl86zpVGyZa/ TjTdiUEG9iEsJZyGSL6O7Fb1K4J9p/kmoTBjn5IuiDTPg//QMsEXoytTrDclfAIqksdX VKtQ== 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=lESC8gxs86pPef6hNpQFjXj3/VCyI+yEnJq6wlPwrdo=; fh=MR/wbEn34JHmT+rtzWNq5RVU/RKi8DhjSvb3ywiuLkE=; b=IaHNCPDzUz4sd/yGO2xzKM7YlbPICKBQgD/BeW1GJXJq/Of2pljMEDYMaC6A5S5E8M L4xZwc/OjBuBghybvyirvPmz918WtHyIkmvfK+6oMbclOk70L6l83VQQO73mU7s1Ma9f C0aEp0LIXaE6+c6ldVRgVKJmQkQaOO+JozEcXQOzmsfew4oA4YloL37xA5t53meUlsx1 ZW0BkHDA2PEWtUFH37LzUbz+GRa4bdyl71FxXVQwiD1AhDDvSYODsHqZHWEnqS0nIr+K a8jtNWdYEI3y7ZRBjyp6sV033odQk1Kv2yeEVUGAlHyIOkr7x39CaR/yb4Usax9iXDD8 mSUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=mt5sEYwZ; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-87137-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87137-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k5-20020a508ac5000000b00565acc7e2ebsi711531edk.178.2024.02.29.09.05.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 09:05:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87137-linux.lists.archive=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=mt5sEYwZ; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-87137-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87137-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 21DEC1F256B2 for ; Thu, 29 Feb 2024 17:05:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E44494AEF8; Thu, 29 Feb 2024 17:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="mt5sEYwZ" Received: from smtp-42ac.mail.infomaniak.ch (smtp-42ac.mail.infomaniak.ch [84.16.66.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 387344AED4 for ; Thu, 29 Feb 2024 17:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709226277; cv=none; b=D5izlvNUxlz1dUZu/PHnv7U4q5ZhYs5TvQZk1hnY/eodCEse8pGEbN1wzWYyxUB7HgO75G2FGneL2Qlpn3I6EWypAaSMEkTWRcji+j5Lipd6reus00KAvafh+rz65OqLzrJbISr+T1WI9jh6x21hMgezKb4t0ytWAZcHusc5QL0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709226277; c=relaxed/simple; bh=iEMsEf9vHd9/SI1OU/FMhsYF3Xf0RZ6zSUY0txBsePY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=a4kr20MooM1EXk/lvpKBQy8kYIM8l/TqHvM6m8S6DC/gydqj5r/YsyZ/qj62hfS7KWBBMH2A1KnYRgcZOF22cxaz9Dp3dvojcY65V405L8z6fEF12X++ZLmY495Dh8W57rmxx1CY3q8TXWZqbIvXEDdn7ESuBdMvNFIMXnPHExE= 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=mt5sEYwZ; arc=none smtp.client-ip=84.16.66.172 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-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4TlyHs3xr2zMrktf; Thu, 29 Feb 2024 18:04:25 +0100 (CET) Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4TlyHr5l81zsG; Thu, 29 Feb 2024 18:04:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1709226265; bh=iEMsEf9vHd9/SI1OU/FMhsYF3Xf0RZ6zSUY0txBsePY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mt5sEYwZdJqMXsg2RNP3sZk7FXe2d42pQAwMlKqEqVeZoUnZxWKILpymJr3/osTy1 HATdiX6VsrwoP0gD2blvTb19qjeTYzsRp4SafqrsoXPddY8xyBu1Qc8e4S1DueQbzl Gv250bTvI44E66febWNikJHzk267euM4+x5fW+J8= 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 v1 2/8] kunit: Handle thread creation error Date: Thu, 29 Feb 2024 18:04:03 +0100 Message-ID: <20240229170409.365386-3-mic@digikod.net> In-Reply-To: <20240229170409.365386-1-mic@digikod.net> References: <20240229170409.365386-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 Signed-off-by: Mickaël Salaün --- 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