Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp509507lqg; Fri, 1 Mar 2024 11:45:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXeDKP6M1MV42RmloFKgK0hDZ/ii5sTdu23VrmLJm4I3ghUlX5jIgIGdILhcQIc9OZ/UDbWEN3GCdj51pAIqsD4XSnDO6WX58J9MClu+Q== X-Google-Smtp-Source: AGHT+IHN7uYz2Ul4SxWlygvqxOkDyb6Wa3WoQ2UKLCBPoq/Bx4wwbT/Hxsm0oNmBeA/yX+wv0QPe X-Received: by 2002:a17:902:e744:b0:1dc:b3bc:b7e1 with SMTP id p4-20020a170902e74400b001dcb3bcb7e1mr3602910plf.1.1709322303980; Fri, 01 Mar 2024 11:45:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709322303; cv=pass; d=google.com; s=arc-20160816; b=WQvu9leKf2io+oDOixv6yTJlsaX1Za+gp6pqdiLZdeEva5sQVkUm2pn9DXti5gfR5x c9qwggznXGftXxtIcgSZU4YOmi7+jweZ5IywFyL4oDSJDDLYRLEuCD2RUdCwkxSOLWmT CHITv2jgGH0k0NWUiGpKKhtr5E5DuDxtUHnH7CnfV115WRGiGb4aFc1wXKD5NTV+OukP nZQsAPo4AuszAX500DyF5klNEzqeHJytXgiLUHPIAdr6g2BgihEQPFaLh2IZvhLK1/hF rZaVV8xjFLXUn25C2+IgcEw/I+z+82wP6yFQm5NJf+Jib6ikWTkNb9qZ83ihgsG8WNOy bONw== 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=OYU6fZwq9JveuIJFo8/YL18COLSa74gbPtl5Oi/E0/E=; fh=zj59eJfuoJS12YRdWV193q90Nu3hwOsNjvEjXIcyXBw=; b=hYK/o3IY89lFfoUUCv9spio+w7DFwego5J240QFdAw1KutdG3pJMwt3m0V7YIiYQ4R L1KoxY9TcDuaLPrRGuEC7fkKsrAiTqvGaLUBKtzq5fJszMhdVrbLah5TrZJQcfvkcxq/ 8lQotPjIxibNZZzL5mlVPcrfGN2yyQ6C1R/yvyzd5+C4PK8fN6YW9s0lFzk1wH0AS+s8 eqp8UyIEOjY9toaIUk8D/5lJMRsse99Bkcc/WgOAgHUNYZGm5UbD8T3VKiedTajNu21s j2pF9BMZ/+BInIlxWLhjf7HgJhphUH9U6yzwvMkeWrAXnlepse7StlE/Glnvbc46x5dG nIIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=lktGmRmB; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89006-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89006-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o19-20020a170902e01300b001dcb3448ab5si3804776plo.611.2024.03.01.11.45.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:45:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89006-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=lktGmRmB; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-89006-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89006-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 D0583B210BC for ; Fri, 1 Mar 2024 19:20:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 771AA3A1BD; Fri, 1 Mar 2024 19:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="lktGmRmB" Received: from smtp-8faf.mail.infomaniak.ch (smtp-8faf.mail.infomaniak.ch [83.166.143.175]) (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 B4E8D39FDD; Fri, 1 Mar 2024 19:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.166.143.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709320807; cv=none; b=uskKY6uM0usgLIF8CclxYGRnpIL6Zc+BnkGHiAn5hZ4ADTPWgS8oQqBDKrKSAjq2pZbH3TK9k3nhF1VtPcnfb8Q4tS3KHom62E70blBdORosziXA/+XhHpl8NLeEwVfhZjTP/SyqZ2i0wp7tLDuA0rbUWSwGuOy+OT2ZhIgQlEU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709320807; c=relaxed/simple; bh=Swe/Qd9r++tAyJ9RTTXIMVdtbl0ZRCkDiMrhyMl4Y/U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZydpvFCDZ7LgphV6QYcBRwl9//uQTbW0KCYGfYMH7+8IBxuuno3nHjsiBHb8svwmei+uhFBRud65u6ZRrGKmtVr5ocL3WkBdBzAlvzTF+28JhjP+MPCG+a+lKHLeFES0f8TqgCHzf7/rEStB7SDcju18wYErAUTdOhL8OQKoLVg= 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=lktGmRmB; arc=none smtp.client-ip=83.166.143.175 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 4TmdFs5ByrzWxc; Fri, 1 Mar 2024 20:20:01 +0100 (CET) Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4TmdFr4x9XzMpnPn; Fri, 1 Mar 2024 20:20:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1709320801; bh=Swe/Qd9r++tAyJ9RTTXIMVdtbl0ZRCkDiMrhyMl4Y/U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lktGmRmB5jUGmygRJXVx3w6EV3a0DZTb+fL0YMAQUVn6UY6tLSvUrsV71IIHpR5FX qxh1iOBsRbD0j1QUslG9mjhRqgyWekJAvJVhwQjiv4OwW3RsUNfZ9wKQ7O5bHGYTk/ KGCYwD0LX3vUL7eYRcXxxH0H8C7z9+3+g9HzC8Tw= Date: Fri, 1 Mar 2024 20:19:50 +0100 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: David Gow Cc: Brendan Higgins , Kees Cook , 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 0/8] Run KUnit tests late and handle faults Message-ID: <20240301.gaiWei9eng4u@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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Infomaniak-Routing: alpha On Fri, Mar 01, 2024 at 03:15:08PM +0800, David Gow wrote: > On Fri, 1 Mar 2024 at 01:04, Mickaël Salaün wrote: > > > > Hi, > > > > Thanks very much. I think there's a lot going on in this series, and > it'd probably be easier to address if it were broken up a bit more. > > To take things one at a time: > > > This patch series moves KUnit test execution at the very end of kernel > > initialization, just before launching the init process. This opens the > > way to test any kernel code in its normal state (i.e. fully > > initialized). > > I like the general idea here, but there are a few things to keep in mind: > - We can already do this with tests built as modules. > - We have explicit support for testing __init code, so if we want to > keep that (and I think we do), we'll need to make sure that there > remains a way to run tests before __init. > - Behaviour changes here will need to be documented and tested well > across all tests and architectures, so it's not something I'd want to > land quickly. > - The requirement to have a root filesystem set up is another thing > we'll want to handle carefully. > - As-is, the patch seems to break arm64. Fair, I'll remove this patch from the next series. > > > > > This patch series also teaches KUnit to handle kthread faults as errors, > > and it brings a few related fixes and improvements. > > These seem very good overall. I want to look at the last location > stuff in a bit more detail, but otherwise this is okay. Thanks! > > Personally, I'd like to see this split out into a separate series, > partly because I don't want to delay it while we sort the other parts > of this series out, and partly because I have some other changes to > the thread context stuff I think we need to make. I'll do that today. > > > > > New tests check NULL pointer dereference and read-only memory, which > > wasn't possible before. > > These look interesting, but I don't like that they are listed as x86-specific. I was reluctant to make it more broadly available because I only tested on x86... > > > > > This is useful to test current kernel self-protection mechanisms or > > future ones such as Heki: https://github.com/heki-linux > > > > Regards, > > Thanks again. I'll do a more detailed review of the individual patches > next week, but I'm excited to see this overall. Good, you'll review the v2 then. > > Cheers, > -- David > > > > > > Mickaël Salaün (8): > > kunit: Run tests when the kernel is fully setup > > 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 faults > > > > include/kunit/test.h | 24 +++++- > > include/kunit/try-catch.h | 3 - > > init/main.c | 4 +- > > lib/bitfield_kunit.c | 8 +- > > lib/checksum_kunit.c | 2 +- > > lib/kunit/executor.c | 81 ++++++++++++++------ > > lib/kunit/kunit-example-test.c | 6 +- > > lib/kunit/kunit-test.c | 115 +++++++++++++++++++++++++++- > > lib/kunit/try-catch.c | 33 +++++--- > > lib/kunit_iov_iter.c | 70 ++++++++--------- > > tools/testing/kunit/kunit_kernel.py | 6 +- > > 11 files changed, 261 insertions(+), 91 deletions(-) > > > > > > base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b > > -- > > 2.44.0 > >