Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp66034lqc; Thu, 29 Feb 2024 10:24:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUkY3yzNtwqLNt5l1Nazg4wIn2GXtM2JCxjNKUEBdOiVxV/ZqMA9ih4CT8zKNWw2aBu/BLYfBaFiFk07Asg/qzYqs4/m55ZGxpAi7SbvA== X-Google-Smtp-Source: AGHT+IF1ExHAu+GkePstpL01g8MaHB/5Wg0glXkzF3cKaqo6zBuDcZvhLTsj75j2r8GWdA+pLukV X-Received: by 2002:a17:906:7f12:b0:a3f:da1c:ae4c with SMTP id d18-20020a1709067f1200b00a3fda1cae4cmr2283319ejr.54.1709231073877; Thu, 29 Feb 2024 10:24:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709231073; cv=pass; d=google.com; s=arc-20160816; b=uCnGQl07WVlJipksEIs7Mw9BwUIUbXL2HZ5tPXC9UaMRVdPvdlkuZ7sBDyQAPsG0Vt QQmizYb14uhsLjXAs2y9W9EMOknAn1wapL5U7x+zmOqP4/rGK1EqCwbIURAbLk5DSiCM 7qPHw8/eeXpsOexR1rzv54iAd5agcHWnMvHtnp9P460i1avGxAnssjlw1a6Az4JcHOII ViH3HYr7hvC6uL9FGY9EH36W7BUhQHpKif7a+k5EZAs2Kr3yAuGVF4sr6vwFSEEvIN6N tXGc1qHiCECaK9FxGEfBfq/BWAvuIcATQ0OuLjQyKj0kuhQoJXZvkXqw+yfBQmYYC6u4 miQw== 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=Pi3TKYGbYkDedreuD0VF7nTXnRCpQ3DLSOdVsFC+ytE=; fh=zx7YBjKITbfOExFV/dOQ5J0oZaUQk/s9YA0aCytvacU=; b=Fbx7GKNrOTPQMHYyvuERT777K3Ze9O1WcJ3FUDjlOsaVL58kzsRLz7WSA39/Al6AWd 0KpU4ZcUCoEN8rAqF6esaPORhUXcFlAo0qTt6Jk96tzL/fV5XpK7+cjYrrNYKDdUDwvH jNB9F9xBUtNYTdsm1InXezywuAURjBOxHTeJ7E8phsChASOSqeKJdvd6TRHORr7soeSw NxBRtvevKWq0MyUYhfSg0xVG5T/g3goG7Q6XWnJ1SevK4M1r8rSKfvxKmGqvsBVwvoRP uPd1oOjAo1v0XVK/TuQb4TfEKQI1rxDVBGnRguaieozu1c8uyaERmiBx1GOK5NkYm905 7oUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DGB8d3AQ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-87278-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87278-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gl14-20020a170906e0ce00b00a3ec680ee34si748029ejb.469.2024.02.29.10.24.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:24:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87278-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DGB8d3AQ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-87278-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87278-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 9B1791F26A82 for ; Thu, 29 Feb 2024 18:24:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B7887A159; Thu, 29 Feb 2024 18:24:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DGB8d3AQ" Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAD807A127 for ; Thu, 29 Feb 2024 18:24:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709231062; cv=none; b=SKQX0WYcLICfsxyeInRXkl79wI2JFHZarwbOgDY/Yqo8h5Qc4S9qBboFur7X9xnFEFoYdUdifRPMYFeWpcVaw/arlcrCbJHrsOUkHRVaMCZTC7pZjA3RBGyP0TyJ8YUj8SUA4tDQJBWExIogGTh55qKALJ2f2Ltx+kbw0Eix3eI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709231062; c=relaxed/simple; bh=Y9KRbZhBlGJ/L8+onTzy/F5qfnhONJecU4/IHZrT6pA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X6ofKnBKToJwnIv6sp1scP85SsZnNjpobUa+Wem1bt1FCwKxTWBqo8ObZW8SOwJbbgaCqWH8+NcesszmcyX7+C8kp+lZhS7wlHWiErPdRLMrKzrgx1S4oeN6ZdLXtOjIm66k0vsHhu2nM9q/VFKTh7Y/1D8b+gYmC6ah/PJ5x6c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=DGB8d3AQ; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6e571666804so885287b3a.2 for ; Thu, 29 Feb 2024 10:24:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709231060; x=1709835860; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Pi3TKYGbYkDedreuD0VF7nTXnRCpQ3DLSOdVsFC+ytE=; b=DGB8d3AQl2+iH13eetsKydo3vb3vKmNPvdwsANlX2BfGL1DAG3u6KjA12l5TgeafeN 9ds6vKjxHstX5iBQRgKg5KHOSOF0WV0/Z9kUXF6cBZZJbR924zVB3M9ievzHMEO/hDkx cgpQVyk+n/MzWXXKylu8Cz+BC8oJILk7P8g00= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709231060; x=1709835860; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Pi3TKYGbYkDedreuD0VF7nTXnRCpQ3DLSOdVsFC+ytE=; b=HFkWPdsDn62BLLMowIpU1fLJFlCbd4tOFvRLf/QT/+tAiTOFsvmOXoLGnfqQuKbgBE iM+rCt7MqRLGWrxqYa54GrivaA5PLUM5eVMTvo+BhL0brLPFfFnbitlqGIzYXEOVsqSz 4/V71ISUXTrlZqNiqv/17wYdZC1vHbxPkA9yJxtEiHtwfjSIfXT6i4BWBurZFusqty/+ sToIZuycogziHrKqQ52I3cPhUs8oQq7EaQUuWJXfiTUqlL6mDQ4FBIi8FMURWT5ixbb/ OZuPbXgwO+sYhSMwucuka4ms8FCsucOAfPwT778CnMbXJd7J+rVsKtRxP/IYC0BGFuXY /afA== X-Forwarded-Encrypted: i=1; AJvYcCXRer+VuZGUu/t3LlqypuTS/Usf8+49ck5hh8e0SwhU5OtZGWYN8+9HDov4FOIN51CZzEZmn+PwCl6K4XJW71DoWpnrW2Dlfg9DtGlL X-Gm-Message-State: AOJu0YyXnnR9C88fb4Z9Z9NMfWU8+81SFqSEBIVjufapfRjkH7ukY0e+ BIc0wtsrQLDdyG7b2UybR5ZrA5c6egS2QnVYB9+QeNezHC1Yq2/CIzAQH1CKxA== X-Received: by 2002:a17:902:da85:b0:1dc:a60f:1b6a with SMTP id j5-20020a170902da8500b001dca60f1b6amr3395287plx.13.1709231060211; Thu, 29 Feb 2024 10:24:20 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id u11-20020a170903124b00b001db2b8b2da7sm1793216plh.122.2024.02.29.10.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:24:19 -0800 (PST) Date: Thu, 29 Feb 2024 10:24:19 -0800 From: Kees Cook To: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= 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 5/8] kunit: Handle test faults Message-ID: <202402291023.071AA58E3@keescook> References: <20240229170409.365386-1-mic@digikod.net> <20240229170409.365386-6-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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240229170409.365386-6-mic@digikod.net> On Thu, Feb 29, 2024 at 06:04:06PM +0100, Micka?l Sala?n wrote: > Previously, when a kernel test thread crashed (e.g. NULL pointer > dereference, general protection fault), the KUnit test hanged for 30 > seconds and exited with a timeout error. > > Fix this issue by waiting on task_struct->vfork_done instead of the > custom kunit_try_catch.try_completion, and track the execution state by > initially setting try_result with -EFAULT and only setting it to 0 if > the test passed. > > Fix kunit_generic_run_threadfn_adapter() signature by returning 0 > instead of calling kthread_complete_and_exit(). Because thread's exit > code is never checked, always set it to 0 to make it clear. > > Fix the -EINTR error message, which couldn't be reached until now. > > This is tested with a following patch. > > Cc: Brendan Higgins > Cc: David Gow > Cc: Rae Moar > Cc: Shuah Khan > Signed-off-by: Micka?l Sala?n I assume we can start checking for "intentional" faults now? Reviewed-by: Kees Cook -- Kees Cook