Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1184995lqe; Mon, 8 Apr 2024 00:49:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVIRYPlekQX2e3c9udL6DWZAU6dsO74H2iD12aawRHACtauocyrb/iz+dBmYjjbYKc3QzEqpmIphJSYJj2NQkb9L1qQywHgz73w0WLgKA== X-Google-Smtp-Source: AGHT+IH2DJZR7EqnACRdebkTUULEBiAlVTrqHuu5qwnN+eYoO5ttIqgIdfHC2q5jjdPKSWjBfdIo X-Received: by 2002:ac2:47f7:0:b0:516:d303:53a3 with SMTP id b23-20020ac247f7000000b00516d30353a3mr5283478lfp.38.1712562576245; Mon, 08 Apr 2024 00:49:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712562576; cv=pass; d=google.com; s=arc-20160816; b=yQyqT2YnJmYy7BOTW1bNWoq85E+pD11n+6jP87y6a9uk61VPgqO/RPJ87Bk82sVAhq /UZ/VygdS7FsPIEEmJupHyC0fThHnSLy5wQvI+THE4gdmG8TmwKZS5CAuVrksjGtlQbq zLgm29GlhPB/ky1FMCn8RJiXkaLCFWzGM8/nNYPJmXXgm1crvci8+GrsjfQiczLIyFcH P6cLSCPZHxabT6Jj8c7BpDaiY0VZ0bjYj70amgOGqz0XRr1hHKZFHz39qy/opMHGoZ8j 6m+YEz1BalacY0NuaSMgROlGH2lIq6x+rOP5aA2hOR5IvNdE4EZFHgNX3zNCcPPejKJt EzCw== 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=ZztxV+95yCxOm9Q6iR94v4Q49bL3lRxgXMt4Jlm2Ios=; fh=ebRmPuOzT/NtOLoMMfuhuYI4lG8a7a9TwT5pL03u+Ns=; b=W+Bo5bWmN50ZY9mvF1YN6DA+P7cBZVCB9C6G3tu6W0kj8wWsIvjjxdtuXn6deqGrgh q/NlJBB/IPkVhstT1J+Dr1IOwHCllPoBsdcX+vwB+3OD87c0++DTRr0DrTYICIhA2ipX P3+O3Hl3HzPdQjayGNIWktCckUmgNTSIYpQu/tzdTbpmNgGWsvQwCUP2IpLJemdxaELL TRy4zT89I2IzO/53Hz7NNlTHL1j5GT0cIYqU1fsgkWHq+GT4id3rKMihj/MIwNx5Qpq7 nPCPrVfQwKwBZF5WhaUMbqMstm/oZFZBc4UcrNucJVJtPZuM0Yr37jNjG+TqlRQ3zpyu un2g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=gudJfyv8; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-134939-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134939-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x73-20020a50bacf000000b0056bdd1184edsi3526615ede.483.2024.04.08.00.49.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 00:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134939-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=gudJfyv8; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-134939-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134939-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 EFE411F211DA for ; Mon, 8 Apr 2024 07:49:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 691114EB3A; Mon, 8 Apr 2024 07:47:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="gudJfyv8" Received: from smtp-42a9.mail.infomaniak.ch (smtp-42a9.mail.infomaniak.ch [84.16.66.169]) (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 0035528E0F; Mon, 8 Apr 2024 07:47:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712562425; cv=none; b=OxWWySL5RNJ4NBL4tG+mjW/VN9jkfjiKBorl4mvN0c7RmNrVlhDw1HV6IGV0C82VVEXP8ZYFo/kWkJtgPpgHpOI1o9tMb9QmsM6KyCZd090xSfCCIYdi5SB0v+WNYBsWUh9MqTalDBUN/Bqtzi3eq/uOMvHgjRBzu4tl0o2QKrU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712562425; c=relaxed/simple; bh=D9YH4Sh4CL5memGtOap6zXb11ax+yAGeO1p+lPfMKeQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jgMC3pxofOy75s7N+IWP2+hK4wFe4slXK9XR87WV3pjBdyTJE9R2KvbMLmBDg43P0r373jMEg2n0oZ4Pu4+3xrpvekCgI4JXhS9/LKQnoJlaaSIiPVUcG59Hss0covRCjzQKXUnchlezvghNNJXeOBs2xW5/h2S+Oks5Bnqo6RU= 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=gudJfyv8; arc=none smtp.client-ip=84.16.66.169 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-0000.mail.infomaniak.ch (smtp-4-0000.mail.infomaniak.ch [10.7.10.107]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4VCh4X59ClzQ6b; Mon, 8 Apr 2024 09:46:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1712562412; bh=D9YH4Sh4CL5memGtOap6zXb11ax+yAGeO1p+lPfMKeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gudJfyv8xv3LsbE8AjiGjXm1dcThRZhmdQa7BHsFq7fhDuJonaMBlORbQhzTK4PyY nz5G3rh2hnjYoy/xIUH/HnoRvo7YhvEktWOXxWu3L8DtSuxrOIp7vG0PVPt2/48QDs sHplU64y9r6Bjn0B0h8oApD9dXHFnynmrutNAIeQ= Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4VCh4X11c5zgkB; Mon, 8 Apr 2024 09:46:52 +0200 (CEST) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: Brendan Higgins , David Gow , Rae Moar , Shuah Khan Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=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 1/7] kunit: Handle thread creation error Date: Mon, 8 Apr 2024 09:46:19 +0200 Message-ID: <20240408074625.65017-2-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-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: Shuah Khan Reviewed-by: Kees Cook Reviewed-by: Rae Moar Reviewed-by: David Gow Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240408074625.65017-2-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 | 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