Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp495308lqg; Fri, 1 Mar 2024 11:16:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVg1SICOH0b4eg07+WSJK0jeozTV357pUspFvtBdbdB7wREP+fr7cujWNvedEwUYkjULda4y1AbH14Yoqc5wLUGjj3OlmqPAVuGa14Dxg== X-Google-Smtp-Source: AGHT+IFqlGxMozQN286Fl72en7Js+5h1XWMs2d70ZWGTZwekvvjAtjIgTMAGLpFTG+k49AY44JQM X-Received: by 2002:ac8:5a83:0:b0:42e:cbce:c285 with SMTP id c3-20020ac85a83000000b0042ecbcec285mr2648129qtc.0.1709320601773; Fri, 01 Mar 2024 11:16:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709320601; cv=pass; d=google.com; s=arc-20160816; b=Okl8CqlkcfOU5oPTWNfFxVilKoM6ZcWh2loQqrP/W7VzTegu/QneXVsPnbn8utZPUM GDY/mQTcDqF8aV1DAlTR9xDKbxiJyfxNV4twQptKvLMQcenX5Blly/KWqOVmk+lUn2HF b1IIyUCWiv8/9kF/I/rUPHBCqfEQmtcKl96hdlL86y8wpBw99GV3CgTEqHkSHW0r8z9h 9zjrIXXReB52GgP52+dsMIcPJqgasaneJD2tr47FfihcD/phkEOFLoigqhgVL+KK1Ri1 7zFQ86qvUd9t/wZjl2plIuw10vaZQeUdFCfWhbUiiWnlGWXtxcZMZsd4AWOD29crcdYJ 7AKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+NnesQ9cTDdJNQMHWQNTCgjmvn+eX+eTheBcFVBpUoI=; fh=mhEzn47WOVHmNZmWR30LihnThxm2bBnGi+HFEVcuJ8Q=; b=L2XQ/TBbYULrD+FTgqtBGrOoj2dpdiVEZN2mXG4POl2hHIx6B396yJqUB11jqdgWkl vEYg9X/O10FIpdLznN72l42aO0zV92WZtY1PWzKuXQm2fypUI1KDo9Cyc5hBgrp596OZ dxVCo4236A+2avHaLFxAglyGQGT1hnbBfimd0J20p7aKArVExPudxcc4kTVaQUu/qTbU iyduW9svmm3L3/EJ30ncZTY5t69KwuM+We0uokjTnSS9Lji7B/qjQ5QUb7Lt98L9uuyL tLaJGLSGAWnEjBmhrsww26O9dMh1k4Fa9v/MXWeaoma9LB6IvR0B50WC6i6MrBcLD1XF eEpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=ekdE8C1Y; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89004-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89004-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s18-20020a05622a179200b0042e4b2ca25asi4447150qtk.438.2024.03.01.11.16.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:16:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89004-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=ekdE8C1Y; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89004-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89004-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 5F1A61C21178 for ; Fri, 1 Mar 2024 19:16:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DE063B193; Fri, 1 Mar 2024 19:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="ekdE8C1Y" Received: from smtp-190f.mail.infomaniak.ch (smtp-190f.mail.infomaniak.ch [185.125.25.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 E55733A1A7 for ; Fri, 1 Mar 2024 19:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709320588; cv=none; b=M02lk4Lc74hOdfkSVjijUQMxOkA5yPFZQQivy1noRzL8ZhUDdB9aYJ7kAZOM9ovANmbonvGb5wQaYk5dNB2woOVvnTBrnSuBX1zAHs+T+Tn100SMyV0BN7V4nKO7pyNy/Cxe+fwbzYVrEp/U+Dq1Xl1YZ16/ZtSRujFsXXm0t2g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709320588; c=relaxed/simple; bh=Q7fU6Ub3q+6YxoCBFaoEp7a/GqkOwDsLuYbxuGhGrJY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kehAcMP1lKuM7LL+DpsX5fxZmnpQixZ+ZfiQVuUILrUs8ix3jnmv2DJ3Tr4WXziMA8Mk6ACd71U4dYWUY11Em1KxAlVR9pKt8XOMvNvlSkzbTc/mTJqZYCmSbFSQeL7tkNFhQyZ71duplmeMhClk47+Dwfvq2KNjuXbsHZmUMZc= 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=ekdE8C1Y; arc=none smtp.client-ip=185.125.25.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-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 4Tmd9Y1VK2zXyj; Fri, 1 Mar 2024 20:16:17 +0100 (CET) Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4Tmd9W6JqCzpmw; Fri, 1 Mar 2024 20:16:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1709320577; bh=Q7fU6Ub3q+6YxoCBFaoEp7a/GqkOwDsLuYbxuGhGrJY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ekdE8C1Ycehc5cU0FFdPBLOQIWYuuwCoAVIcd6blq2ECeRFY83hIegduUPkzETJSJ 1aED213nnnjEoQbHieGvuKeSAmm8UB1bPBZPlrobr+nQOfkOfTvxMUACoi0q1XEtyO 1h134Jafh7/zywAVozq8HQY0K0a+ZnyoDROUVHAo= Date: Fri, 1 Mar 2024 20:16:05 +0100 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: Kees Cook Cc: Brendan Higgins , David Gow , Rae Moar , Shuah Khan , 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: Re: [PATCH v1 8/8] kunit: Add tests for faults Message-ID: <20240301.aekiung2aL7K@digikod.net> References: <20240229170409.365386-1-mic@digikod.net> <20240229170409.365386-9-mic@digikod.net> <202402291027.6F0E4994@keescook> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202402291027.6F0E4994@keescook> X-Infomaniak-Routing: alpha On Thu, Feb 29, 2024 at 10:28:18AM -0800, Kees Cook wrote: > On Thu, Feb 29, 2024 at 06:04:09PM +0100, Mickaël Salaün wrote: > > The first test checks NULL pointer dereference and make sure it would > > result as a failed test. > > > > The second and third tests check that read-only data is indeed read-only > > and trying to modify it would result as a failed test. > > > > This kunit_x86_fault test suite is marked as skipped when run on a > > non-x86 native architecture. It is then skipped on UML because such > > test would result to a kernel panic. > > > > Tested with: > > ./tools/testing/kunit/kunit.py run --arch x86_64 kunit_x86_fault > > > > Cc: Brendan Higgins > > Cc: David Gow > > Cc: Rae Moar > > Cc: Shuah Khan > > Signed-off-by: Mickaël Salaün > > If we can add some way to collect WARN/BUG output for examination, I > could rewrite most of LKDTM in KUnit! I really like this! Thanks! About the WARN/BUG examination, I guess the easier way would be to do in in user space by extending kunit_parser.py. > > > --- > > lib/kunit/kunit-test.c | 115 ++++++++++++++++++++++++++++++++++++++++- > > 1 file changed, 114 insertions(+), 1 deletion(-) > > > > diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c > > index f7980ef236a3..57d8eff00c66 100644 > > --- a/lib/kunit/kunit-test.c > > +++ b/lib/kunit/kunit-test.c > > @@ -10,6 +10,7 @@ > > #include > > > > #include > > +#include > > #include > > > > #include "string-stream.h" > > @@ -109,6 +110,117 @@ static struct kunit_suite kunit_try_catch_test_suite = { > > .test_cases = kunit_try_catch_test_cases, > > }; > > > > +#ifdef CONFIG_X86 > > Why is this x86 specific? Because I didn't test on other architecture, and it looks it crashed on arm64. :) I'll test on arm64 and change this condition with !CONFIG_UML. > > -- > Kees Cook >