Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp870135ybt; Wed, 24 Jun 2020 13:22:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3qFGLXYE5n7rlyKkn2xfydCoaLws0v4yqDT2J3rqgPNa6AVzrsz1Rd21hpmrhysBY05sD X-Received: by 2002:aa7:cf02:: with SMTP id a2mr18504277edy.263.1593030123043; Wed, 24 Jun 2020 13:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593030123; cv=none; d=google.com; s=arc-20160816; b=SeRIqGRwpsy8PFLzUlHAcI1m3IJab7HeI3hW7U7Y9Po+44XS7+ICMzwHK+slyrUiEB KhdCt3Yh4qVPEFt47qy/dZwBdNKudL9hHnNzloCiltDMeYUlBEqd6mUiMGBG+bRd0rLH WU8pbbKERqLpl9j9Ucdd3O+07FOR0TAGpX79bbKl4zbuZG/fXO7j/wXty5wNhyH8ubf5 mMx5+c1MkTkOp8HD8SX3CoEnldUMAYEgQsIukJYXTuCaFLr8NWgr0cQPNPtZ0FxQAeDZ Be6Gj/9NXgWCuxQqrg8v7v6pSLuZcCybg3kgCsnEecB+ucZQh1aXZ7KTsAnLu//xI+Zs znrQ== 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=6VX8l56o/9phg5oRAnfBhOhnSRSgx40667vVlnrgP1c=; b=RSYFN2Daivwgdj4eqqJgr0et/Win5hiPXbYSTZBhMp/XQFsfv51YBC1weVHeybzoM6 W1KtSYCekTJFjzX3uQ5ULf7fDfQs4v1aM/LoiNKBJWHgYHhKrbEbqQt1hpW5pd9IyfRR YC7cecM2WJAinpT76l3Pqw+suOTsKkD679EEisbTAQoVbdit4+YyoOeiKnVvMmnQ+ico pjTBcs+14Y28FIFmm/mOHLVA0VIN59l6X/exrFLSEWV82dGnIYO4um0CAmixfSMffRoQ pIxDdUENBCw+ESGcGnCZnJX/IiBvYw46+ZNbN9ffYipL5/57ze+RWVJTWeiQfA9aR/ug Oaag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Sts5HjeX; 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 pj20si13085828ejb.158.2020.06.24.13.21.39; Wed, 24 Jun 2020 13:22:03 -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=Sts5HjeX; 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 S2391405AbgFXUUs (ORCPT + 99 others); Wed, 24 Jun 2020 16:20:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391054AbgFXUUr (ORCPT ); Wed, 24 Jun 2020 16:20:47 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C21CC061573 for ; Wed, 24 Jun 2020 13:20:47 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id z63so1733367pfb.1 for ; Wed, 24 Jun 2020 13:20:47 -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=6VX8l56o/9phg5oRAnfBhOhnSRSgx40667vVlnrgP1c=; b=Sts5HjeXaRIsjaUUSOulF2b0QJW/rtbjE50f2+QWQIT17OrFkVY+Z2bpYbafSTBuhE jxvDPfNLBtSH2Ou4l6yD3zA3bSURrtxiM0TzakQ0Cyg+LVoz4iXNXXrN/3Pk6/icJOul Z16sTB6L0/w6Dq6u/vlp+QWuyJg235QG/tvM1E3K4IedKvz3c0z9c6NfrN/bbHZ5G8fY wgIDX2Wo3ZlTsNzOZMWvutvhS1YdbOeKKZVcOA3R3ompjsm/GmA4l7JPIX1erW80E4Xe f7WqejKmK1rE7yp57rosd315QgC4GDBxxpJty94hEmaRpg571BdsL0lc7su+QmaUVxdz A0Aw== 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=6VX8l56o/9phg5oRAnfBhOhnSRSgx40667vVlnrgP1c=; b=CaadN9Z2I8tSeiMMWjdI/y+kQjuCNUcfvCCB4ogQZhxz6OePt5Dr0VqBmcNcuDyQT3 t5vbMnpUtKEZov9UTljVBzqbskjun+TEC1tudczy3Vppp6XrX+o2MFyfxE/16ixS32a1 uvy/AmWKnWlD3E0LzWvd5wXua8rpjFSqO6Y6LAsAbqsjWd0bTleRhyBoCcNBX/MRU5H3 9Etpg79jkfkw1gvw8jjwHLAeDu6iyf645Ml3jW6RPOHJDjbkzbiqrU52Yx6wkxBNaScl Ggc3nqpfCuYY9e/mcs1K1xDjHnoi6PYCq7vbdkgtsG7ssmUECjfsZicGXt1XZazbm748 dnfw== X-Gm-Message-State: AOAM531n6LY2i6cfy9o5nkJP3O7EYJWzYa/SsmImGWWXECrkhMbAQugI CQLsn/2XBvqFLbZG1D0pl7WxLMhktwxWaIevdS1Qsg== X-Received: by 2002:aa7:979b:: with SMTP id o27mr29432985pfp.284.1593030046391; Wed, 24 Jun 2020 13:20:46 -0700 (PDT) MIME-Version: 1.0 References: <20200228012036.15682-5-brendanhiggins@google.com> <202003021439.A6B6FD8@keescook> In-Reply-To: <202003021439.A6B6FD8@keescook> From: Brendan Higgins Date: Wed, 24 Jun 2020 13:20:35 -0700 Message-ID: Subject: Re: [PATCH v3 4/7] init: main: add KUnit to kernel init To: Kees Cook Cc: Frank Rowand , Jeff Dike , Richard Weinberger , Anton Ivanov , Arnd Bergmann , Shuah Khan , Alan Maguire , Iurii Zaikin , David Gow , Andrew Morton , rppt@linux.ibm.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" 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 Mon, Mar 2, 2020 at 2:45 PM Kees Cook wrote: Sorry it took so long to respond. I am reviving this patchset now, about to send out a new revision and I just saw this comment. > On 2/27/20 7:20 PM, Brendan Higgins wrote: > > Remove KUnit from init calls entirely, instead call directly from > > kernel_init(). > > > > Co-developed-by: Alan Maguire > > Signed-off-by: Alan Maguire > > Signed-off-by: Brendan Higgins > > Reviewed-by: Stephen Boyd > > [...] > > diff --git a/init/main.c b/init/main.c > > index ee4947af823f3..7875a5c486dc4 100644 > > --- a/init/main.c > > +++ b/init/main.c > > @@ -104,6 +104,8 @@ > > #define CREATE_TRACE_POINTS > > #include > > > > +#include > > + > > static int kernel_init(void *); > > > > extern void init_IRQ(void); > > @@ -1444,6 +1446,8 @@ static noinline void __init kernel_init_freeable(void) > > > > do_basic_setup(); > > > > + kunit_run_all_tests(); > > + > > console_on_rootfs(); > > > > /* > > I'm nervous about this happening before two key pieces of the kernel > setup, which might lead to weird timing-sensitive bugs or false > positives: > async_synchronize_full() > mark_readonly() > > Now, I realize kunit tests _should_ be self-contained, but this seems > like a possible robustness problem. Is there any reason this can't be > moved after rcu_end_inkernel_boot() in kernel_init() instead? I tried that, but it doesn't work without an initramfs. We could add an initramfs for KUnit at some point if highly desired, but I think that is outside the scope of this patchset. Additionally, this patch actually moves running tests to later in the init process, which is still an improvement over the way KUnit works today. There are some other reasons I wouldn't want to make that change right now, which will become apparent in a patch that I will send out in short order. Cheers