Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp784004imk; Sun, 3 Jul 2022 08:47:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vk0uUk8qRrB/bK/v88aNOFwQ4p0bSklkHrAKELAh7tm8IKnxoFAh1Ejd+KDTZ15HBGsliR X-Received: by 2002:a17:90a:8048:b0:1ef:79e7:ecf6 with SMTP id e8-20020a17090a804800b001ef79e7ecf6mr7429400pjw.188.1656863223289; Sun, 03 Jul 2022 08:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656863223; cv=none; d=google.com; s=arc-20160816; b=vXkILGUIdjCKjiqPv3t/yZwWvNkVBmsKczeKC9bPCbS/Ag2RvNKXO5liBqfVMPGmsY 1N9YZzqDnujmTbptboZwmneJ1mTC96XFIuv5Y0bWdAML7yGLwh3xCxUeC3UgJ2op2iBI Wi+x6Fpw4GuXhV+Y3D4gi6kDaT1y+PRchCvNmrOumuESVExZ3sW7W5+djl4DP2/zKcdk MwA7LSpdpcCG7FT2n5vBxQjqLhLWRAAnYbMlDogMOSfWvCu4JYRip6F62aS1qtUJVLSD Wx9+6Nwgr/BwHEOcpNHjRMe6rabjrYhfa/8dKYeiGO6XQ1YdqUFzTwzGJ1mw1e0lLz/y t+dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Iv0+HrMhZum976pjScbf9QADElxFqlE9HsCHP7+aGKM=; b=Ymyrykpt9mlXL2BZejoW5J/93SWT7GMWu1E9TygBVSIlcK1Be8S4JVx2kxmeiOyffD nS4eFBJOOqXfh2b7XkBX/vhi0Ompz9nIqkkuRxz4g8reStfFF4upoM6+kJ/zBqLwj4Z5 8yrm7IYKZBZ9Z/TDdlR2sTQJd1/wtFrqNpH8MryebS3YWT/D8tuTxkv5meelxkJsOxmH Vq/xLRPHPXl98D/0hC8+NsQkGMGLfb5Q0Zu4Wm/qPe8OKbPvbQEe0pd3qV1458ZYcShh Uc8IRJkaPa5l40oX+mY+jbQnVP3geGM9PdO/uK/5KHfwUxrSeJcogkn76Uhaa+K506/K scaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c+w2J75w; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d28-20020a630e1c000000b0040c9c298a34si36805108pgl.534.2022.07.03.08.46.51; Sun, 03 Jul 2022 08:47:03 -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=@redhat.com header.s=mimecast20190719 header.b=c+w2J75w; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232715AbiGCPcr (ORCPT + 99 others); Sun, 3 Jul 2022 11:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230446AbiGCPcq (ORCPT ); Sun, 3 Jul 2022 11:32:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 17F3960E1 for ; Sun, 3 Jul 2022 08:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656862364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Iv0+HrMhZum976pjScbf9QADElxFqlE9HsCHP7+aGKM=; b=c+w2J75wexhgOQj0OWWsP9FCqPl7Af1TAnRscJWK1mKGig1ibuSZluc6s7rMeQVgm7NZXq DJpnHzKB+hFKYEVj1++5DxB6vMPKmnvTmuPpTtDysSmT+XbxzAXRRgbTae6QfyMWj71LxY +5DNfaux7sazjmpjkG6VkZD7m/Ijpb0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-380-sDG3FlPjNTyJYgoJWptZTw-1; Sun, 03 Jul 2022 11:32:43 -0400 X-MC-Unique: sDG3FlPjNTyJYgoJWptZTw-1 Received: by mail-wm1-f69.google.com with SMTP id z11-20020a05600c0a0b00b003a043991610so4133001wmp.8 for ; Sun, 03 Jul 2022 08:32:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Iv0+HrMhZum976pjScbf9QADElxFqlE9HsCHP7+aGKM=; b=x7bLyhAL9CqyPoKN8Xdrw5ngl857zEcmxPQM/h68gXaLeyITKHqZY4SgK71cdDvaHE avi7Ct+0nhwesLShUDyfmMP+t7lcEcTutpnS0brzf15iABLQhne0hyjG4Z117VQzoq43 SsE7a8Rv+7XHiXIoB1rIQlvQQiL2h4w1Dgd9EXxHyWj7Fcl5EYVueGicOX6OOhbnDrz3 /EsTKA2fiYGnsX93vxuObW2l9XAh1NRAuokRxLm1nQzAfVMwtqoSbC0h7XCoBir/x4w6 AlmlFo9il8dAxYBjYIGjqBvsY2vJ/Eq28Xr9FYXjERhUF3qRVIEeJqtfBu6u88XdTgLd wY5Q== X-Gm-Message-State: AJIora8auaMl/TdCLrLifTek3d8UPLF/kcoDuxgUPuzWppRFU9XJNaJy B2sTKf1KX0eITYtenBXiEHwgb+GRIf4Yt3PkP5naTUMBzH7UiVJ6H22SYiUzMCb/hvjO8AebStb 5Ktf7XARLfHB0aFG5OvNkGYE= X-Received: by 2002:a1c:f213:0:b0:39b:ad32:5e51 with SMTP id s19-20020a1cf213000000b0039bad325e51mr26523948wmc.72.1656862360592; Sun, 03 Jul 2022 08:32:40 -0700 (PDT) X-Received: by 2002:a1c:f213:0:b0:39b:ad32:5e51 with SMTP id s19-20020a1cf213000000b0039bad325e51mr26523937wmc.72.1656862360414; Sun, 03 Jul 2022 08:32:40 -0700 (PDT) Received: from localhost (cpc111743-lutn13-2-0-cust979.9-3.cable.virginm.net. [82.17.115.212]) by smtp.gmail.com with ESMTPSA id u1-20020a5d6ac1000000b0021b95bcaf7fsm46020wrw.59.2022.07.03.08.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 08:32:39 -0700 (PDT) Date: Sun, 3 Jul 2022 16:32:38 +0100 From: Aaron Tomlin To: David Gow Cc: Brendan Higgins , Andy Shevchenko , Jonathan Corbet , Andrew Morton , Kees Cook , Shuah Khan , Greg KH , 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 , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org Subject: Re: [PATCH v5 2/4] module: panic: Taint the kernel when selftest modules load Message-ID: <20220703153238.z6b7bw7cydfkeirx@ava.usersys.com> X-PGP-Key: http://pgp.mit.edu/pks/lookup?search=atomlin%40redhat.com X-PGP-Fingerprint: 7906 84EB FA8A 9638 8D1E 6E9B E2DE 9658 19CC 77D6 References: <20220702040959.3232874-1-davidgow@google.com> <20220702040959.3232874-2-davidgow@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220702040959.3232874-2-davidgow@google.com> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Sat 2022-07-02 12:09 +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"); > > Reviewed-by: Luis Chamberlain > Signed-off-by: David Gow > --- > kernel/module/main.c | 7 +++++++ > scripts/mod/modpost.c | 3 +++ > 2 files changed, 10 insertions(+) > > diff --git a/kernel/module/main.c b/kernel/module/main.c > index fed58d30725d..730503561eb0 100644 > --- a/kernel/module/main.c > +++ b/kernel/module/main.c > @@ -1988,6 +1988,13 @@ 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_once("%s: loading test module taints kernel.\n", > + mod->name); > + add_taint_module(mod, TAINT_TEST, LOCKDEP_STILL_OK); > + } > + > return 0; > } > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index 29d5a841e215..5937212b4433 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -2191,6 +2191,9 @@ static void add_header(struct buffer *b, struct module *mod) > > if (strstarts(mod->name, "drivers/staging")) > buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); > + > + if (strstarts(mod->name, "tools/testing")) > + buf_printf(b, "\nMODULE_INFO(test, \"Y\");\n"); > } > > static void add_exported_symbols(struct buffer *buf, struct module *mod) > -- > 2.37.0.rc0.161.g10f37bed90-goog > Hi David, I think this looks good: Reviewed-by: Aaron Tomlin Kind regards, -- Aaron Tomlin