Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp607090pxa; Tue, 4 Aug 2020 13:19:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsHfj4/opCzwTcOKgGTWCGucaqJnak3MJXAJP29TghDskPIVgPDFdQSwTJtNYi0WUApCyL X-Received: by 2002:a17:907:42a0:: with SMTP id ny24mr23668618ejb.328.1596572394655; Tue, 04 Aug 2020 13:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596572394; cv=none; d=google.com; s=arc-20160816; b=BK4oMKbkLIkXgRpdwoHSh3tYSI2yPRLCq20XAOKiJb7xJyAL7s3ukFhP9MQCu4HtDq UE/IbX6rzTlc50HnekuXL9Y8OCxoNB3vJMLNk4XLs778LKzhNks0qu2Hg4e23uToRL/n n8hnk4cJ1+O2rGTy4V6HB/Yw/qic97RKHygJGiqxFNwWGRXEN2H2J3ndew1At2lN48sE RagznuZOlSOpjEuND1Iqes+PJrjZznuy7oYoClcO8Yy/oATVfkHQjk/nPQOTlSuGw7S7 dirWbghKroktv5DbPBE4mT3/aVh4DbHFHfcfRckaX4f9OKUq5Z4n4Gn/plc53gL+4bT0 7A3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hzRXIsj1+SAs1tNlnSNXJanvh8FrwUG7dToFo76pgso=; b=XC0jknuW/nJjsVYdTSjlyxGcNWe7hU0DKpT2iQiFA0sSkRAkh7ykaNj8PrT/guzS1k HokfgaVRmaC/Dt/+PYN+8bcc8qUUX8sT8EvzOcbexy8msmSO19Owxw5S4GSwXITmWdsx RHGEKMA2QjAu+McWYGOntpUj2g22bmo1fNiqheC+/eZNROSwqXRnHqRM8LcKQHLFiTvh 69VIWEcqv9vPxEGphq0nUSWqR1wm3iWLsjjUaQ3ICpfwdeTRLzAqqQRdakqgYtP9KsdE jn05IP5Vun4ysz4HhvEX1+zOYnQqA9hFfEzu6XVm5bZHT1TM0HGx09m2QlV2dhrJSkTH kbIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Yeb/dQlV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l17si12190056eja.654.2020.08.04.13.19.31; Tue, 04 Aug 2020 13:19:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Yeb/dQlV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727042AbgHDUSd (ORCPT + 99 others); Tue, 4 Aug 2020 16:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbgHDUSb (ORCPT ); Tue, 4 Aug 2020 16:18:31 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1294C06174A for ; Tue, 4 Aug 2020 13:18:30 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id ha11so2992452pjb.1 for ; Tue, 04 Aug 2020 13:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hzRXIsj1+SAs1tNlnSNXJanvh8FrwUG7dToFo76pgso=; b=Yeb/dQlVJPeL8Vx7ag5c0XCGsmI6B14mO/wfB4je5mHzE84Aurte2l0bCK6rN6ftOQ qiWBFA1NwEV85DMi2taxsi8Cf2xBN87c6islpm8jofcLJzirOXvI2tQaJAy8cqUpO/1g Qulj+Oto1t5n+WRVK4IQZIbwf6L1HIEdEsZv6SlQrBJvxGoc0biA8tqDCu43SCCpAlud qsYcX4lJa/218bfLRWcJcBpvRmp2yd0tFlo6LZH4rCQ1cM06SsI5jnnPyirAd8egQ1R+ eVAd5M85sPA6sg0qtIuxiZcwx5qeeL9EdvdCbkdoA8bbdA8NbxhKZUPy20BrdS+dSyx9 rzVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hzRXIsj1+SAs1tNlnSNXJanvh8FrwUG7dToFo76pgso=; b=F1IgzPQThQmwvgVF/sP4uP1BgJAQ51HJTp12tcWAlBmz499A3JLzezHdL6TcHMdjGl jeSF7eZo+Xal0VFKB4VO1BrJO04TMX3nAEQxn056WWa1tAib12xh9EGqlgveqF7Hp3cX Wlgv5uikqVvJJ7ZHRsmiRkNQj1MZLa2oCD/b9qxg0V2n2tciEDnFNiyGawqwwDIND53P rIEsr0q2EdpHKEOW4Q/E2J0RtY/pGW0YUr6RQEXR6xwulrDDG3TgZBG8J7a6vK3F/Ar2 JzGG/fqQLAQRUpwZblEpwkA45U2f7qDrNllRofx1sFvLWQmQLKOZikCjBp6YYN39msUr S8CA== X-Gm-Message-State: AOAM530y94PW4St3eJYZyfM9TkZC+7H4NYYkcoBeQvIZ//xJzBP9WCcr P8gOlmrUj2+/0ywfDlVfmPqjVs/uJYYb19X/gMs+AA== X-Received: by 2002:a17:902:161:: with SMTP id 88mr21097385plb.325.1596572306459; Tue, 04 Aug 2020 13:18:26 -0700 (PDT) MIME-Version: 1.0 References: <20200626210917.358969-1-brendanhiggins@google.com> <20200626210917.358969-11-brendanhiggins@google.com> <202006261436.DEF4906A5@keescook> In-Reply-To: <202006261436.DEF4906A5@keescook> From: Brendan Higgins Date: Tue, 4 Aug 2020 13:18:15 -0700 Message-ID: Subject: Re: [PATCH v5 10/12] kunit: Add 'kunit_shutdown' option To: Kees Cook Cc: Jeff Dike , Richard Weinberger , Anton Ivanov , Arnd Bergmann , Shuah Khan , Alan Maguire , Iurii Zaikin , David Gow , Andrew Morton , rppt@linux.ibm.com, Frank Rowand , catalin.marinas@arm.com, will@kernel.org, Michal Simek , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Chris Zankel , jcmvbkbc@gmail.com, Greg KH , Stephen Boyd , Logan Gunthorpe , Luis Chamberlain , linux-um , linux-arch@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development , Linux Kernel Mailing List , "open list:DOCUMENTATION" , Linux ARM , linuxppc-dev@lists.ozlabs.org, linux-xtensa@linux-xtensa.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 2:40 PM Kees Cook wrote: > > On Fri, Jun 26, 2020 at 02:09:15PM -0700, Brendan Higgins wrote: > > From: David Gow > > > > Add a new kernel command-line option, 'kunit_shutdown', which allows the > > user to specify that the kernel poweroff, halt, or reboot after > > completing all KUnit tests; this is very handy for running KUnit tests > > on UML or a VM so that the UML/VM process exits cleanly immediately > > after running all tests without needing a special initramfs. > > > > Signed-off-by: David Gow > > Signed-off-by: Brendan Higgins > > Reviewed-by: Stephen Boyd > > --- > > lib/kunit/executor.c | 20 ++++++++++++++++++++ > > tools/testing/kunit/kunit_kernel.py | 2 +- > > tools/testing/kunit/kunit_parser.py | 2 +- > > 3 files changed, 22 insertions(+), 2 deletions(-) > > > > diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c > > index a95742a4ece73..38061d456afb2 100644 > > --- a/lib/kunit/executor.c > > +++ b/lib/kunit/executor.c > > @@ -1,5 +1,6 @@ > > // SPDX-License-Identifier: GPL-2.0 > > > > +#include > > #include > > > > /* > > @@ -11,6 +12,23 @@ extern struct kunit_suite * const * const __kunit_suites_end[]; > > > > #if IS_BUILTIN(CONFIG_KUNIT) > > > > +static char *kunit_shutdown; > > +core_param(kunit_shutdown, kunit_shutdown, charp, 0644); > > + > > +static void kunit_handle_shutdown(void) > > +{ > > + if (!kunit_shutdown) > > + return; > > + > > + if (!strcmp(kunit_shutdown, "poweroff")) > > + kernel_power_off(); > > + else if (!strcmp(kunit_shutdown, "halt")) > > + kernel_halt(); > > + else if (!strcmp(kunit_shutdown, "reboot")) > > + kernel_restart(NULL); > > + > > +} > > If you have patches that do something just before the initrd, and then > you add more patches to shut down immediately after an initrd, people > may ask you to just use an initrd instead of filling the kernel with > these changes... > > I mean, I get it, but it's not hard to make an initrd that poke a sysctl > to start the tests... > > In fact, you don't even need a initrd to poke sysctls these days. True, but it is nice to not have to maintain an initramfs for each architecture that you want to test. Still, I see your point. If we can find a convenient way to distribute the needed dependencies for running KUnit on each non-UML architecture then I think I can abandon this change. So how about this: I will drop this patch from this patchset and move it up to the follow up patchset that adds multiarchitecture support to kunit_tool. There we can address the problem of how to best track the necessary dependencies including possibly intitramfss.