Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3597404iog; Mon, 27 Jun 2022 21:16:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vgBc8dIjPAuIOMpQQEbkDZ/PDAZrxnDKPzyDItcU72Ulv62ubTaS3OvE2Qli5Fdk6DxRsc X-Received: by 2002:a17:90b:1bc7:b0:1ee:ffbf:95ad with SMTP id oa7-20020a17090b1bc700b001eeffbf95admr1825147pjb.37.1656389778589; Mon, 27 Jun 2022 21:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656389778; cv=none; d=google.com; s=arc-20160816; b=X8PX67DM3qqAyU35+4Cy1SHe8jqT3/ayjFSsG1SF3V1NnxORGM+Kqam0hNFPmnVeP7 Wx676eshUmg96jv0Tq2W/YPDEAQrpGTLAl8AD/QxmSinr9KOm6gdqQ0xLFtHqcr+IkhO lqMJ6fbO0WIORfJTKYxTIR1OUN6m43fY87FjwckX4dijWBUCJlLOLB0uQa9BDDdcxL86 SdYDgcFYXxQXRMspJjohoaxEfv+nN08wqCa4q9Si5wXvq7Z7xtwGfJCb3/4P9veNKJ7l M5AcojJalebEiKfe9QPp+JAqvZULHA5hFUn3I5YgL4JuZaNdyOb0YuY8U33wyHMgbAjM wSew== 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=G2ZI6aMz7mjHuacv2TpkSw0NDmBUe+64bYW0SIydJ1c=; b=Qeqd2qWNssSrsx7eTovYTchEckGhQ2iLIotBaOmB2gdraEupxrC09F7D7GWNPc98tg WOgU+/n2kP0VwHGRFIIrWm3u1wR4RzGNK4ItLprQIeUGwOjEDGsndKW5KKKgOyyHpoU2 i0npMgtP4zNihmpBe9QiCzf5oqx5Nxz4UijYfMrbQFiZTDnUkIxZa5aeLNlPWYJeA1bu 6r5Uns2R+p1TS8UZoAowyUaZJKJI9WGP+WOzChsQeSZRTOTmHay17w9lh/epEZ7WTomT qIzjrF4dg+Tl/k+6FzW4QmU8aKw/h0MoWziYW78mu5t5kFcTl3E95CNqnZ/ZvIkIsPNH KH6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qWSblFa8; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v190-20020a6389c7000000b004052d634987si17385586pgd.267.2022.06.27.21.16.05; Mon, 27 Jun 2022 21:16:18 -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=@gmail.com header.s=20210112 header.b=qWSblFa8; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243382AbiF1Dh1 (ORCPT + 99 others); Mon, 27 Jun 2022 23:37:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243263AbiF1DhT (ORCPT ); Mon, 27 Jun 2022 23:37:19 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E38824F0B; Mon, 27 Jun 2022 20:37:18 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id x1-20020a17090abc8100b001ec7f8a51f5so14545730pjr.0; Mon, 27 Jun 2022 20:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=G2ZI6aMz7mjHuacv2TpkSw0NDmBUe+64bYW0SIydJ1c=; b=qWSblFa8OsXeRRuOE0A/MhNHBxZKjTtnAjA3B92NuHrFB/xQ73Fq7JAKZUSMerimfT lBSSFX/cc7HP+4o4G7SOWtrqiLpi4rHj+7ziQmJ35u3jjOOm2e9ac+evtsQMtVrwuZ1h a9SX3SXZu+eo1UC2XDtg2s/Pu83GBvFAdf4C/tWCKkcVqS6taZRukb8hRGey3TmfV0HB FcJRkmGlhU9w+CtES91WezFc/koimMNnM+sIWw0Uv8lVDjCBwiKzsnwM45X25OQhTS9/ 2ZwjgfwJMOEVBvLs5Xii9V84Y6XJDH2AP4+l1Va9ssEOCMJ7YbT6u9tnFbHhGz7+/q+a CCyg== 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=G2ZI6aMz7mjHuacv2TpkSw0NDmBUe+64bYW0SIydJ1c=; b=1XfD09bXED5IvhCs0K8qkQNjYUR79k1eMB4BPXi1b0CCI5GTPnw1dEu8qsKqUk4vA+ Nj+215lWmHtkn+ipP5udkK3PW5s1iQl/JOOquaVtKlixfYzR/uR1oT84kdLk7mrALZDO K2cbmGHK9BzTyo8+xGt/XbZABJlN3DsFa8XY/J/rTpp3PvqiZYYIcrQoOofeioLAZhE4 2hHdH3xsgPSVVGNKNPcJvJk+CBcV2IdkjMIs6Kvw14rgGWRMal19EcivyTM8nTzWGvbM R8Imjh53GW/LJsdGDo3Bk6rSsSr/VY8OjtBNYK4ELv2r+B+0qplm11PmU1Y+pjqnVANo mPNQ== X-Gm-Message-State: AJIora+hxluwgSu3RiYe1R3Y8LDuK6xX/ztrYfvsTcVybCS8jln8OuGT twfdlhoiaYymHII3Lp6OMrQ= X-Received: by 2002:a17:90a:aa96:b0:1ea:3780:c3dc with SMTP id l22-20020a17090aaa9600b001ea3780c3dcmr25121973pjq.241.1656387437966; Mon, 27 Jun 2022 20:37:17 -0700 (PDT) Received: from fedora ([103.230.148.187]) by smtp.gmail.com with ESMTPSA id im22-20020a170902bb1600b0016a3f9e528asm2912212plb.57.2022.06.27.20.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 20:37:16 -0700 (PDT) Date: Tue, 28 Jun 2022 09:07:11 +0530 From: Gautam Menghani To: sj@kernel.org Cc: skhan@linuxfoundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] kselftests/damon: add support for cases where debugfs cannot be read Message-ID: References: <20220625200334.83818-1-sj@kernel.org> <7d6b7de6-4609-e6ca-0a88-1f9799c70769@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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 Cc'ing everyone as I forgot to group reply before. Also, I have included the example outputs in this reply. On Tue, Jun 28, 2022 at 12:12:15AM +0530, Gautam Menghani wrote: > On Mon, Jun 27, 2022 at 11:00:18AM -0600, Shuah Khan wrote: > > On 6/25/22 2:03 PM, SeongJae Park wrote: > > > Hi Gautam, > > > > > > On Sun, 26 Jun 2022 01:22:45 +0530 Gautam wrote: > > > > > > > The kernel is in lockdown mode when secureboot is enabled and hence > > > > debugfs cannot be used. Add support for this and other general cases > > > > where debugfs cannot be read and communicate the same to the user before > > > > running tests. > > > > > > > > Signed-off-by: Gautam > > > > > > Reviewed-by: SeongJae Park > > > > > > > > > Thanks, > > > SJ > > > > > > > --- > > > > Changes in v2: > > > > 1. Modify the error message to account for general cases. > > > > 2. Change the return code so that the test is skipped. > > > > > > > > Changes in v3: > > > > 1. Change the name of variable holding the error message. > > > > > > > > Changes in v4: > > > > 1. Correct the mode of the source file. > > > > > > > > tools/testing/selftests/damon/_chk_dependency.sh | 10 ++++++++++ > > > > 1 file changed, 10 insertions(+) > > > > > > > > diff --git a/tools/testing/selftests/damon/_chk_dependency.sh b/tools/testing/selftests/damon/_chk_dependency.sh > > > > index 0189db81550b..0328ac0b5a5e 100644 > > > > --- a/tools/testing/selftests/damon/_chk_dependency.sh > > > > +++ b/tools/testing/selftests/damon/_chk_dependency.sh > > > > @@ -26,3 +26,13 @@ do > > > > exit 1 > > > > fi > > > > done > > > > + > > > > +permission_error="Operation not permitted" > > > > +for f in attrs target_ids monitor_on > > > > +do > > > > + status=$( cat "$DBGFS/$f" 2>&1 ) > > > > + if [ "${status#*$permission_error}" != "$status" ]; then > > > > + echo "Permission for reading $DBGFS/$f denied; maybe secureboot enabled?" > > > > btw - does this run as a regular user or does it need root privilege? > > If so add a test for that and skip with a message. > > Yes this condition is reachable only with root user. If damon tests are run > as regular user, the root check condition already skips the tests. > > Tests output as regular user: > +TAP version 13 > +1..6 > +# selftests: damon: debugfs_attrs.sh > +# Run as root > +ok 1 selftests: damon: debugfs_attrs.sh # SKIP > +# selftests: damon: debugfs_schemes.sh > +# Run as root > > Tests output as root user: > +TAP version 13 > +1..6 > +# selftests: damon: debugfs_attrs.sh > +# Permission for reading /sys/kernel/debug/damon/attrs denied; maybe secureboot enabled? > +ok 1 selftests: damon: debugfs_attrs.sh # SKIP > +# selftests: damon: debugfs_schemes.sh > +# Permission for reading /sys/kernel/debug/damon/attrs denied; maybe secureboot enabled? > > Is any change needed in this patch? > > > > > + exit $ksft_skip > > > > + fi > > > > +done > > > > -- > > > > 2.36.1 > > > > > thanks, > > -- Shuah