Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1676701iob; Thu, 5 May 2022 06:19:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTvKmavnLg6UcT/YDA9j59V7IYUjy/VZlx+FU17YunNM/XkTO+DI4yghSl3fQqxWc9KVyJ X-Received: by 2002:a6b:490f:0:b0:657:5e68:66b8 with SMTP id u15-20020a6b490f000000b006575e6866b8mr10424021iob.102.1651756782298; Thu, 05 May 2022 06:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651756782; cv=none; d=google.com; s=arc-20160816; b=ZLvdOlNSljFv80DPlCfLB0DIm6iZHwRFUVaytX/eBLAjbi0619nlGgG9F/CjF/nlav kjBJtyk3PfeNI6zXm0h+4rHUlFrpIrrEApG5s05OzrEHWGJAdN+4lIfFxl9UKYGrvSe4 RN3iInR2mrC8wI3Po5CcsP5Huy1lMr5w1mVvKVQBDNTslomo9JzN6+UujhnN3rZp2dTo rRnckjAJYQRBl+80QdZ7ZLhJ4XHpbUxhStKP25UKF94qOcioJJwUVGCuwc0HD0X+z4ZV 0LRMGOJKx9P/8O5ny2rvozS2cb+UC6ZkeEhO7RisYqS36/2HvNZSYKcUic6QJtTzm1AF B+yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=S2gb7XqGVCua1J4ObYPWqu6oqDz0D+gONZmwmSAT5u0=; b=Dap3lNfmwoFW8JybkbLPZjx3IcL3JgyEJCKBXK6X99MC1MPChdhtElUBJ/r29i10hO MhxQ2MtlmAKbOwuJpDk0A8i8mugu/sxKU+AEx2YH7t73xTEg3NMVpkBY+6xl2GbMku+A Qv4p1SeaJY5vZJf+8pVj7Lz8T3yoOEnfQzADFaDfMqJoBNfrILzPLEnva5W3wtSlY+NO 8dw64kqE28cSZX/eIBDczpKxG8K5OJzgbzrrU92Y1HniRoMgh9XUpr5ww6839wJDX+M5 Fi4M/mmmENepnHLIVvJ1KvbZEeesTrGr6lc4SCSsnuPpntWae+1D0cNp/9KGoY+iW7X5 i91g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=yohmkVdc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q26-20020a02cf1a000000b0032b7037ae3fsi967630jar.24.2022.05.05.06.19.27; Thu, 05 May 2022 06:19:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=yohmkVdc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351669AbiEDOy6 (ORCPT + 99 others); Wed, 4 May 2022 10:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351497AbiEDOyz (ORCPT ); Wed, 4 May 2022 10:54:55 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87F0A2250C; Wed, 4 May 2022 07:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=S2gb7XqGVCua1J4ObYPWqu6oqDz0D+gONZmwmSAT5u0=; b=yohmkVdc1HEiFErskoUX3A88MC imI16VZWdSN1NTiGoZm/E0P67fi6koEUXubQBJY5SMenScgAKEU8IhyJ1qXu7PHbs5zZtofExsIYV wsfQQ38SL//vc+P8mculJsju6c6L2nxtUL8VD+B51YnznAu5BuIDA82AfmAqHmmAb7nqMvC4YwCZv 6yGeRvKMURbJ8Sjyr5jiMwPrRxX60f7OUv9gxVdXzm5N6Ee4z6Ip5EhD3bjGdqxz/gujGyNF2cOx+ 07kbDv6ERZSybEInGCSvByWav8AC60xD5LHHHUrDhVcyTIrGpTJuRu7PISjPO5k5yUvd8gMOyobAw NZKz4eOw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmGLM-00BIQY-Kf; Wed, 04 May 2022 14:51:08 +0000 Date: Wed, 4 May 2022 07:51:08 -0700 From: Luis Chamberlain To: David Gow , Shuah Khan Cc: Lucas De Marchi , Aaron Tomlin , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, Brendan Higgins , Andy Shevchenko , Jonathan Corbet , Andrew Morton , Kees Cook , Greg KH , "Guilherme G . Piccoli" , Sebastian Reichel , John Ogness , Joe Fradley , Daniel Latypov , kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Jani Nikula Subject: Re: [PATCH v2] kunit: Taint kernel if any tests run Message-ID: References: <20220429043913.626647-1-davidgow@google.com> <20220430030019.803481-1-davidgow@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 03, 2022 at 02:49:58PM +0800, David Gow wrote: > On Mon, May 2, 2022 at 2:24 AM Luis Chamberlain wrote: > > > > On Sun, May 01, 2022 at 11:22:38AM -0700, Luis Chamberlain wrote: > > > On Sat, Apr 30, 2022 at 11:00:19AM +0800, David Gow wrote: > > > > KUnit tests are not supposed to run on production systems: they may do > > > > deliberately illegal things to trigger errors, and have security > > > > implications (assertions will often deliberately leak kernel addresses). > > > > > > > > Add a new taint type, TAINT_KUNIT to signal that a KUnit test has been > > > > run. This will be printed as 'N' (for kuNit, as K, U and T were already > > > > taken). > > > > > > > > This should discourage people from running KUnit tests on production > > > > systems, and to make it easier to tell if tests have been run > > > > accidentally (by loading the wrong configuration, etc.) > > > > > > > > Signed-off-by: David Gow > > > > > > There is no reason to distinguish kunit from selftests if the result is > > > the same: really make the kernel try really insane stupid things which > > > may crash it or put it into a bad state. > > > > My initial thought is that KUnit is explicitly in-kernel testing, > whereas kselftest is (at least somewhat) user-space based. selftests has modules, although I am not sure if there are selftests which do not load modules. Shuah? > My personal > feeling is that "doing weird stuff from userspace" is fundamentally > different from "doing weird stuff in the kernel". True. > That being said, in > practice many kselftest tests load modules which do strange things, > and those could be in scope for something like that. I'd still err on > the side of only having those tests (or specifically those modules) > add the taint, rather than all selftests, but could be conveniced. Yeah I think now that this can easily be added by having a special new module info, MODULE_TAINTS(taint_flag). Then in check_modinfo() you'd get_modinfo(info, "taints") to then add_taint_module() if set. We can ignore the userspace thing I mentioned earlier as I thought at first we could not add the taint to selftest modules easily but we can. Luis