Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp783318lqt; Tue, 19 Mar 2024 03:56:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVVyMQt0v8R+7h/hsOB9bPCN8w9kEebE7ednfp/1LoGvFEnjO/0lbBG2mRHwxujbA9J08xCBZ3Lhfm3bvlit4RUoC4KInTun7Vg8Q97g== X-Google-Smtp-Source: AGHT+IEH0OK8/1+CVvkg9wu4HJszqZo7QC46gFjUqCX5KfkSEbVhAf2wTbqQdBX5ak0UDhGqpwWw X-Received: by 2002:a05:6808:130b:b0:3c3:80d9:77da with SMTP id y11-20020a056808130b00b003c380d977damr2838352oiv.42.1710845811630; Tue, 19 Mar 2024 03:56:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710845811; cv=pass; d=google.com; s=arc-20160816; b=0hAgvSEmWlgtrgQC9zGe8PIWOMOsU1awnjqZh+BbV/8XJxDSYAXF44gj4YuYhuZy1w ZO3IGKo1GAHQy7taLuZqexU9jIHxugXL7cRryGcW+DjnlKiuDuSLQhdaDlb4dMuYiO+N l5STNcAwqBR99D/lv9mytC6AOvy7AiKyCi5jhoqBAqevxqYiACoIDMy0oMVNTRDfMLIG dJ6O+7LicZBabOWvK87uYIXqHDvieIo8w05qvEZ8XviOLJfEmfeFgrF52CpCOV4b/9kv Hp/8UrQdjIhqaKNBhSev96K6cJWPMi0BojT4lZqa9Hm/K7s3Ed1lXNJ07VRAvTi2dC5/ kfsw== 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=gUjqkKLG6pDe2F5+j6eUEcsHwO1BSL6VifE3GADSfvI=; fh=xksad+Zzp83xTrVe2PmOl/WhHN932c88mU0+EksUUdg=; b=wiXxacEHbKRgrd9Tk3XiMlFQWa8lKmk5/IcCLod1iuBiVXTFof6LqZCXghvyPYCb5m ZQRkNnDUfImq8DOsJC6YQYUi88RVFhEwtKqZo0rfq8dPcuKFcig4b7EMvvVL3NsWb0Ov KoxniRmFS18/Cbmgk0lZuqUgMPwDadB4dsP3duEaxxKbyYzdV/vEyFrIFj+6m8Jnw9rN 4bt23PzBkdXxjoTTVg8V5Jr80NsKaBJLOFQDx7j02BK7M4i94b30+6esswRbp5oPr/cR QDuecJ+MjGHG/d/pJWuvOzQ5BoRPIy1/gofJlU2Dc9AvlAmA9p4ODy+TF45jYFEUa4hX 1aTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=V4dBTnlY; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-107425-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107425-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b2-20020a056a00114200b006e698118106si11372181pfm.286.2024.03.19.03.56.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 03:56:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107425-linux.lists.archive=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=V4dBTnlY; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-107425-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107425-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id AB37CB2164D for ; Tue, 19 Mar 2024 10:56:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE9257EF06; Tue, 19 Mar 2024 10:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="V4dBTnlY" Received: from smtp-bc0f.mail.infomaniak.ch (smtp-bc0f.mail.infomaniak.ch [45.157.188.15]) (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 CCF827E10E; Tue, 19 Mar 2024 10:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.157.188.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710845737; cv=none; b=ef3vk2cYoCsLmC7FgOZo1UdTqc1+cGVJHv50NNR41HYgahRvQXsAK8krjCYL1tcD+dHe8wRCbfq3izUaC2BgADTxfaY/p+RBKLxtzC6lVOEUKTDO/sGJDX5Ly+mTad+3s6COzlwCmKLXMGeZRaIoRlYTydBY4t+XH15ooXVJuZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710845737; c=relaxed/simple; bh=Q4UUhNwYZn+WDcIDuQ7Wlx71SgXa7nFVwqw5oSSibM4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GrlWdRxlFiQdZlXaGvREtNOEwtXShXeONCAmc0Af0r7N1sfKj48ABwEbygTKV+YAuiwt1ew4Ahp0vQw6zQP24gAMPr495JHOkUtHODSwoO+35TDJFf7OqhLqPT1rZBYqKJ8/cIWswZUhRXjHxZ83lehFoGcisdVuTyg1yCOz3EI= 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=V4dBTnlY; arc=none smtp.client-ip=45.157.188.15 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-0001.mail.infomaniak.ch (smtp-3-0001.mail.infomaniak.ch [10.4.36.108]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4TzT4H3R9zzLPZ; Tue, 19 Mar 2024 11:49:19 +0100 (CET) Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4TzT4G4jhgzMppDx; Tue, 19 Mar 2024 11:49:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1710845359; bh=Q4UUhNwYZn+WDcIDuQ7Wlx71SgXa7nFVwqw5oSSibM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4dBTnlYd4A0P0aoAur3y3VFlxA+lv/yfODZl4C1bFWuVVA0GCgov/qviWUHjb6d/ 98F/txkzdGUiMY6llvijE4GzskZi5hQSsha9ameMP3ioPjx3fWEXZow0TMB9o5NH5f oHBmuObh1szJXgOfAjs4cGlOOBbBE1WBVoJPtDzo= 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 , "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 , 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 v3 1/7] kunit: Handle thread creation error Date: Tue, 19 Mar 2024 11:48:51 +0100 Message-ID: <20240319104857.70783-2-mic@digikod.net> In-Reply-To: <20240319104857.70783-1-mic@digikod.net> References: <20240319104857.70783-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/20240319104857.70783-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