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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CD2DC433EF for ; Fri, 1 Jul 2022 08:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234240AbiGAIzt (ORCPT ); Fri, 1 Jul 2022 04:55:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236533AbiGAIzl (ORCPT ); Fri, 1 Jul 2022 04:55:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8B111D0CE; Fri, 1 Jul 2022 01:55:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C3ACB82EF6; Fri, 1 Jul 2022 08:55:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70648C3411E; Fri, 1 Jul 2022 08:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656665733; bh=yjBhNZrxeyLRbyUd/FhFFxflFi3Gvl3ms34vFj/Xl08=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bSUg75cVKMYeFf+UivniMvky44e9rhNmPUWPH9RXFW+k6ESNL46/yURXjjMoMUQ+d yJTZ72ctNgYIDjiG9ddI0h89NmY2SGUDGNRWf+c5VbvgON7ZiYwNayRrlQOpI5xptW OqbmxgLk0cILQA2zTd+6X0nCBhxLVu5bds9YS0es= Date: Fri, 1 Jul 2022 10:55:30 +0200 From: Greg KH To: David Gow Cc: Brendan Higgins , Andy Shevchenko , Jonathan Corbet , Andrew Morton , Kees Cook , Shuah Khan , Luis Chamberlain , Masahiro Yamada , "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 , Lucas De Marchi , Aaron Tomlin , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org Subject: Re: [PATCH v4 2/4] module: panic: Taint the kernel when selftest modules load Message-ID: References: <20220701084744.3002019-1-davidgow@google.com> <20220701084744.3002019-2-davidgow@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220701084744.3002019-2-davidgow@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Fri, Jul 01, 2022 at 04:47:42PM +0800, David Gow wrote: > Taint the kernel with TAINT_TEST whenever a test module loads, by adding > a new "TEST" module property, and setting it for all modules in the > tools/testing directory. This property can also be set manually, for > tests which live outside the tools/testing directory with: > MODULE_INFO(test, "Y"); > > Signed-off-by: David Gow > --- > > This patch is new in v4 of this series. > > --- > kernel/module/main.c | 8 ++++++++ > scripts/mod/modpost.c | 3 +++ > 2 files changed, 11 insertions(+) > > diff --git a/kernel/module/main.c b/kernel/module/main.c > index fed58d30725d..f2ca0a3ee5e6 100644 > --- a/kernel/module/main.c > +++ b/kernel/module/main.c > @@ -1988,6 +1988,14 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) > /* Set up license info based on the info section */ > set_license(mod, get_modinfo(info, "license")); > > + if (!get_modinfo(info, "test")) { > + if (!test_taint(TAINT_TEST)) > + pr_warn("%s: loading test module taints kernel.\n", > + mod->name); > + add_taint_module(mod, TAINT_TEST, LOCKDEP_STILL_OK); > + } > + > + Why 2 blank lines? thanks, greg k-h