From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6FC0C433DF for ; Fri, 26 Jun 2020 21:42:10 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 753582088E for ; Fri, 26 Jun 2020 21:42:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="m0OpqPIH"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="bX8dVRpG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 753582088E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mzHhjAxof+1SZW0YR6H64rdzIvbqpDSe6rnGiUOyKZw=; b=m0OpqPIHwOrq3EIFbx9rOHR1F ofD96vanabOcTv8OgiafZ+XVaKtUFh90QT/IrFsh8eFLsBZuC/cZ3uT6bFjDO/8NMc2/Dxrbwyrvb IZZlXOKy/VjUxMo87jQI26kLHSsNTBVWEw4Sl81RnsUhkKWlru2XmBxUIGDxphoVXl7EcYSyZSZHi f+3fwmGVogNOIWRnJRGYi3Ui+iH+diRkLlzd8wlROZWga21ogPPhuA6VPtmfM1IaMjyLmjTgTPGJY GbgVfdC+iJM12ZVJ54uZqrw1JAyrazxkpaXI7gO7/Yhlo/mn9kcg9Iv0mrgJgfpDFW/G7BSxtsnsA Bri418LuQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jow5O-00056l-OY; Fri, 26 Jun 2020 21:40:38 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jow5M-00055z-7x for linux-arm-kernel@lists.infradead.org; Fri, 26 Jun 2020 21:40:37 +0000 Received: by mail-pg1-x542.google.com with SMTP id w2so4694682pgg.10 for ; Fri, 26 Jun 2020 14:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DBFCiCNbMQQSLufDN5X7qKcgik0Nhri90g4nsd8aM2E=; b=bX8dVRpG37euUl3qpbP17LA9iIFyjt3MI488CsWBsbJPJshDtVyG6lLlTanKQREUSr clyKuc8OuVr3VkT+sNlOIgeqSE/iU/y7pAbYvCm4QiVcDKwZoj5s3xOt6RZRLX5sK+bF 3nuMQ6NX+qGwzqG6bzmX4AH222xRUaj1pgKf4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DBFCiCNbMQQSLufDN5X7qKcgik0Nhri90g4nsd8aM2E=; b=uCaUGfz/h/4CZfUkP8N1Nsu/K2FpYt574CmZxXlVT/GBkBxAugM2skieFKfPvHTTN8 ehu+Wdo2SSweHSe0GuONhZGl3ZV6cKnNG/Jv525cleQ2rEWOj7iui0BR5IgoMlIBHM/W PF2835AGL1JBwsy4l/gUHq7zEXDfdfSRlOnrGR7JZqTfP8a/k6TQ3Nh2rXnq01/XYLSu SVTniKKLR+lsqMZ8WJCYEVDDUONRAC15O28AE4kONed9UPDIc4Ig9hgUHdiXpAfudH1w 5t//rKO9lHTdNS5a0fZgRCPCSUC9hu5pl6/Rw4QpNg6Yp/kgzSIz0Arcx+by9edxjV3x 8FBw== X-Gm-Message-State: AOAM531CznzLg5XjgW8Oy22SzolTBEJelOQ5yHCIrYlBPnH40rj3KqH+ Ww7hW9pv7ZFHbh3ki32/LcxQmA== X-Google-Smtp-Source: ABdhPJwsdIbHCnkHW98F5dFAh0C5o3xzHXeXSXzfKXDvmHf7nYqFOW0Q7J//8p36fZg/xNJuCfrMWw== X-Received: by 2002:a62:a20e:: with SMTP id m14mr4374407pff.249.1593207634245; Fri, 26 Jun 2020 14:40:34 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id m16sm8751736pfd.101.2020.06.26.14.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 14:40:33 -0700 (PDT) Date: Fri, 26 Jun 2020 14:40:32 -0700 From: Kees Cook To: Brendan Higgins Subject: Re: [PATCH v5 10/12] kunit: Add 'kunit_shutdown' option Message-ID: <202006261436.DEF4906A5@keescook> References: <20200626210917.358969-1-brendanhiggins@google.com> <20200626210917.358969-11-brendanhiggins@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200626210917.358969-11-brendanhiggins@google.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, catalin.marinas@arm.com, jcmvbkbc@gmail.com, will@kernel.org, paulus@samba.org, linux-kselftest@vger.kernel.org, frowand.list@gmail.com, anton.ivanov@cambridgegreys.com, linux-arch@vger.kernel.org, richard@nod.at, rppt@linux.ibm.com, benh@kernel.crashing.org, yzaikin@google.com, linux-xtensa@linux-xtensa.org, arnd@arndb.de, jdike@addtoit.com, linux-um@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, davidgow@google.com, skhan@linuxfoundation.org, linux-arm-kernel@lists.infradead.org, kunit-dev@googlegroups.com, chris@zankel.net, monstr@monstr.eu, sboyd@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, mcgrof@kernel.org, alan.maguire@oracle.com, mpe@ellerman.id.au, akpm@linux-foundation.org, logang@deltatee.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel