Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2916387imw; Wed, 6 Jul 2022 14:03:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sifhWtC9J3hFKeaopEI6ZNKptYFfsKPib/XUaHryNl1WJcRI+9JdtWBU4lxTqM0ebcNq63 X-Received: by 2002:a17:902:7604:b0:16a:f36d:73f3 with SMTP id k4-20020a170902760400b0016af36d73f3mr49532932pll.170.1657141380118; Wed, 06 Jul 2022 14:03:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657141380; cv=none; d=google.com; s=arc-20160816; b=IrIbH/+Mb0e9P1wfb/3OBQmTjRrFU6izzXv/lRFgHByRyIw6GaPP7qCjkueuwknbBi 70sTuXidLkd55jOTjKyDWldLBlNXFiLa6gzfl4ldqZ49hDQzzt3Qzz0WqID/P7NFfTmS N1hixLkYA088DdiwkSoNnlw28nhJAlN7cEjZaH/PT9rL7OE69dk99KqOqWsycShpEZdh XIIMRQidYXDSpXeRWMrUqN9ifvwQ8BUB/U7oV29W/07q0mPTXojm7gkNZzbhuXoWtGWN es7mPdcOg2zZDDd9IWSUTInkUU8XoZwGczYuT7O3orIipZHEaFar2uvgDOV1Ces8bxAn RFUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VmZUiPaBEY+cXoKQEoYr43kUreC3uQvFIkJqH2JKuKw=; b=Oogj/5VD90eO8ktndFj7ourmYJ8k0tSI2ZVTFeODjzCGsVPd7YkPxMR//UlYh/ctZu ZQEvnxJP51IEOHO2ifhkijcki/WhCFv8NPzu88cpgkVxlbTpMEXMbtCk3Uy8uOPtCbwo OLMzsrpoPXViTnxcW30bLcNuwcBlfFS/jM85eDQRTXdke5DV1utVUmU1MZeEpRd6QeQQ FmuKNJHIr5ZTYLEZhsrMo4glfAwOZBdg4CVJpJK0J4RwEpAS8WSWsyXR/vUainr7ygg0 eAn/SWJ8Jw7Volm2rvPzU/Z89xVq1ZzgDiquIPWonLtXTkBVu20GXcGkOpORF5Lx+ZT1 RH/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="QD1S/pEl"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 79-20020a630452000000b00412ac5a4831si2192770pge.144.2022.07.06.14.02.45; Wed, 06 Jul 2022 14:03:00 -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=@google.com header.s=20210112 header.b="QD1S/pEl"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233304AbiGFUwA (ORCPT + 99 others); Wed, 6 Jul 2022 16:52:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233108AbiGFUv5 (ORCPT ); Wed, 6 Jul 2022 16:51:57 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B0671C11A for ; Wed, 6 Jul 2022 13:51:55 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id y8so14994912eda.3 for ; Wed, 06 Jul 2022 13:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VmZUiPaBEY+cXoKQEoYr43kUreC3uQvFIkJqH2JKuKw=; b=QD1S/pElGHXVUsbOmqKCJB4tIT2LfKNYBwHeoK3ZI0DUMJILHVe6a82Q51su0piYKu wuNjrhR6iGEs41/j83fS0VOXdLGDC6asG7vO4XB5AOJHml40d/7E81YUshGRRsZLp7yK YgqESFS3mE58ornuH7MKbtS1MNrDqi8gLHYc0cJ10T1Vjl8lFv/u/9nVoNAzXNq2yu5d KKY+GZniHeVduR4B1nopMwBhJcXsqDnVKsx/9Nkcv1kOzPPl0sgrgRyDMbTdTHSRX5nL ZDmD6e+7ToOKGWtMTrJ9o4Zr6WB6gnClrjpkjlWmxx2lI5hXctf5yaGv4ROswY0vcywN Jgbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VmZUiPaBEY+cXoKQEoYr43kUreC3uQvFIkJqH2JKuKw=; b=aYqaLS0lzqs3JUqxxkiVMha1i5LEuamFpz4SDuxISCJhqUVtJ1T62wn7v+zJNyhhZ1 pzFKjzmTYiBZvcpo2wEMuQXClPCVNqhlEOZAzbpt0b5zvpz2g4Zm2cFCB+1xmrotJPzl aTRCI6amox27lK4xn+n/Mzz4ckG694pS1vg8VRkUIhUk/Wlf43OzVbGIpdoDYg+FtSfW Ny+TKtkk81YedFGO3gbpdTRV1DaYZaMI/zYR8YYBgo4A2hO3/RDrwEr02bUzZhwUD+d/ 5PH29L8WT6P0T1dComE9yKkgv8jthve/bonEaQCoMn3bhCGYhSNyfibsvb3LNd3+Pigc ni2A== X-Gm-Message-State: AJIora/67+/qw9wM4ZCjQ+E+v+zw6zh3VBnEOmpCYOh1QD3RMcT/3NdN x7g8+Zc/5o8bs99lbcNFZa2EeTMCAUP4q2cgbPRAww== X-Received: by 2002:a05:6402:43c4:b0:43a:6309:6c9b with SMTP id p4-20020a05640243c400b0043a63096c9bmr23105912edc.91.1657140713645; Wed, 06 Jul 2022 13:51:53 -0700 (PDT) MIME-Version: 1.0 References: <20220702040959.3232874-1-davidgow@google.com> <20220702040959.3232874-4-davidgow@google.com> In-Reply-To: <20220702040959.3232874-4-davidgow@google.com> From: Brendan Higgins Date: Wed, 6 Jul 2022 16:51:42 -0400 Message-ID: Subject: Re: [PATCH v5 4/4] selftest: Taint kernel when test module loaded To: David Gow Cc: 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 , Aaron Tomlin , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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, Jul 2, 2022 at 12:10 AM David Gow wrote: > > Make any kselftest test module (using the kselftest_module framework) > taint the kernel with TAINT_TEST on module load. > > Also mark the module as a test module using MODULE_INFO(test, "Y") so > that other tools can tell this is a test module. We can't rely solely > on this, though, as these test modules are also often built-in. > > Finally, update the kselftest documentation to mention that the kernel > should be tainted, and how to do so manually (as below). > > Note that several selftests use kernel modules which are not based on > the kselftest_module framework, and so will not automatically taint the > kernel. > > This can be done in two ways: > - Moving the module to the tools/testing directory. All modules under > this directory will taint the kernel. > - Adding the 'test' module property with: > MODULE_INFO(test, "Y") > > Similarly, selftests which do not load modules into the kernel generally > should not taint the kernel (or possibly should only do so on failure), > as it's assumed that testing from user-space should be safe. Regardless, > they can write to /proc/sys/kernel/tainted if required. > > Reviewed-by: Luis Chamberlain > Signed-off-by: David Gow Acked-by: Brendan Higgins