From patchwork Fri Mar 1 19:40:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= X-Patchwork-Id: 21238 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp115143dyc; Fri, 1 Mar 2024 11:43:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUo+lflYJDeg4i5bcLpNM+0X1ocfbcg0j/TLLC1LPDppjW+IBtF4MNPx4cfLx2K+9MVbuQqqERP37bmVykQ8StNh+m/Yw== X-Google-Smtp-Source: AGHT+IEqeRJz0j+ssiQhPiDmRySMCpNe4b86JtuPLIk8ss9Y/GDmO6Bn7ZKbFf/8FFjFT0SD5yeL X-Received: by 2002:a17:906:c792:b0:a3f:56da:5a40 with SMTP id cw18-20020a170906c79200b00a3f56da5a40mr1897860ejb.23.1709322186932; Fri, 01 Mar 2024 11:43:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709322186; cv=pass; d=google.com; s=arc-20160816; b=l8XhatpkoKW4W3mXHyikygURXCOZwc2+mXMjr5lee3YZCU3uxl+oOWMTNDH7U8zx4q kYwkAVc+m0n+OD/+CtwegjlKeY5vXFr8xj4HBvV7fnT9Yk/5kfWm6pdd4p3MG1Qp0WRn h3IkSW/hljeKBWzynKG8VQASDuJob/ZLQ7ndDmy5/MsZGNukng5tDMnXWJkuslRWaw58 BWbXBVfmL4e569OUCBBG68cYQMAuQwOlWTYUR5OKdC1+hVWYp06NZiB2zDLvCUMfZM8H fzrrlKOZZDr/iOQgFVVl5o6/eMlR44sFxpZHgR3p4Bejp2C4bjwv3GgviYgyuCOFHSlP YYzw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=aHlsqS+r2zHvt2nrY27JAGMMOJGL5E/nzaw8d+fXqiw=; fh=MR/wbEn34JHmT+rtzWNq5RVU/RKi8DhjSvb3ywiuLkE=; b=vcaTzsJtG3gyWxt8RBkAxCme7fZAHURIfpeiBc+TzLuT0cctqNzrSHIbMePjvpXRS6 ZWDirqOl12GE+TOCXte77CLUy/JVwp+pby3GxZ17bZWZNRqW4IuuK0161pldB96kv1uf pSFZKyt5dYfev6yq/sUZ02rylnOsLItjgLPkdmT2u5tBO9Byf6/EyZ5YnG0E/Tp+P9Rb hWaQWZtxYwLJ7yWiKpmCvWuN37a9qvFVuW+aOsbWhISz1Qw/zgxV+8aIsDE2YyzDwOA5 klphXE7auBpQ7E8EL09hK2+PFqy1ScBCm76BEvtgAHZmE/7BD37sKUygyQiIsGUOjXM/ D+SQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=OSrVYlnh; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89038-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89038-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dp1-20020a170906c14100b00a43f923c727si1792998ejc.87.2024.03.01.11.43.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:43:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89038-ouuuleilei=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=OSrVYlnh; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89038-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89038-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 7E5281F2462F for ; Fri, 1 Mar 2024 19:41:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D933E3D0C5; Fri, 1 Mar 2024 19:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="OSrVYlnh" Received: from smtp-190b.mail.infomaniak.ch (smtp-190b.mail.infomaniak.ch [185.125.25.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 AF0103A8C2 for ; Fri, 1 Mar 2024 19:40:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322054; cv=none; b=o/0Uy/w+aJm1r4CagMDlUt8tyYky7Lgtah56S6CHJMWey58l146q9zNprurNcxtrs4zr8l7h+J5441/AgiPDJrjKsdcqZHrP2kVCXS3RB3+mp7ZhQ5eKT+uWJmueCdUgd92pHzegxP82dU0VQE/akfFwCEna//nm3rRT2gcyWwg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322054; c=relaxed/simple; bh=2OrWNccpx9RIERKaD1LaWkqEFkrgGuR3iwbvIXZvKD4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=CkLmskzNSpwNFFB9NKRagE1WUVyaqWb2lSUZJJ+X4gc0WaHZ8ik0x1hu3DOGropmmeQnLzt2yIMZwbKq7ej5lioGWDpEcyANAJste3Nwf0yq72qHofdt6m5foVQTjNUjM7l0QJcREBzPxTVUAtcn1p0GqqPDeE5WuNFxmTY6i5k= 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=OSrVYlnh; arc=none smtp.client-ip=185.125.25.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-3-0000.mail.infomaniak.ch (smtp-3-0000.mail.infomaniak.ch [10.4.36.107]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4Tmdjs4TkfznjY; Fri, 1 Mar 2024 20:40:49 +0100 (CET) Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4Tmdjr32Rnz3b; Fri, 1 Mar 2024 20:40:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1709322049; bh=2OrWNccpx9RIERKaD1LaWkqEFkrgGuR3iwbvIXZvKD4=; h=From:To:Cc:Subject:Date:From; b=OSrVYlnhvWxkk6XfcuTUYzkKfO5Jtwoju81YMT1NYRVqiaCeI2z+/tpHnjDdsMyJ/ lO3wu1Mf2w3OCerCjG/QoY9ouNjpOioGbIAvyPlnKE+Yha7vtzB2yRgOXpH95GuzTB 5SOB3hqc0ZR5ETY+eNpo67Mod+PwaxNqurlhLF8M= From: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= To: Brendan Higgins , David Gow , Kees Cook , Rae Moar , Shuah Khan Cc: =?utf-8?q?Micka=C3=ABl_Sala=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 0/7] Handle faults in KUnit tests Date: Fri, 1 Mar 2024 20:40:30 +0100 Message-ID: <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 X-Infomaniak-Routing: alpha X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792354221375975058 X-GMAIL-MSGID: 1792354221375975058 Hi, This patch series teaches KUnit to handle kthread faults as errors, and it brings a few related fixes and improvements. I removed the previous patch that moved the KUnit test execution at the very end of kernel initialization. We'll address that with a separate series. A new test case check NULL pointer dereference, which wasn't possible before. This is useful to test current kernel self-protection mechanisms or future ones such as Heki: https://github.com/heki-linux Previous version: v1: https://lore.kernel.org/r/20240229170409.365386-1-mic@digikod.net Regards, Mickaël Salaün (7): kunit: Handle thread creation error kunit: Fix kthread reference kunit: Fix timeout message kunit: Handle test faults kunit: Fix KUNIT_SUCCESS() calls in iov_iter tests kunit: Print last test location on fault kunit: Add tests for fault include/kunit/test.h | 24 ++++++++++++++++++--- include/kunit/try-catch.h | 3 --- lib/kunit/kunit-test.c | 45 ++++++++++++++++++++++++++++++++++++++- lib/kunit/try-catch.c | 33 +++++++++++++++++----------- lib/kunit_iov_iter.c | 18 ++++++++-------- 5 files changed, 95 insertions(+), 28 deletions(-) base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b