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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B6CDC433EF for ; Tue, 28 Jun 2022 03:37:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D2A28E0002; Mon, 27 Jun 2022 23:37:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 982988E0001; Mon, 27 Jun 2022 23:37:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 823088E0002; Mon, 27 Jun 2022 23:37:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 71D9F8E0001 for ; Mon, 27 Jun 2022 23:37:21 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5169235145 for ; Tue, 28 Jun 2022 03:37:21 +0000 (UTC) X-FDA: 79626234282.20.39D95E0 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf16.hostedemail.com (Postfix) with ESMTP id ECF5618003C for ; Tue, 28 Jun 2022 03:37:18 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id 73-20020a17090a0fcf00b001eaee69f600so11352874pjz.1 for ; 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=xrNJjerps7adk41MuGEyNQlq1RzqBDXBdgEPogncWvB6FkOdeMObLMQn/X2Bj107sC NtEMSmCS0ZhuitS4+SF3B9XbcFxPnpNKYwqLSbZnECDbz07plDR9DuX8wHFU2SWL0T5k 8yK4VGBGOyzobeqyNi3mNgOO/tWNRiuyCWa9xPF4IPCgt8nlxf5fKafwr6aH7li9UM7w kx9vKu80xncSmmNcD74Bl/WLXRIGLgOYZAncf3eHt6/+oVrXOSDdJayCJxTnOHJxRxG9 B1fQ8FHu2RCmDLeqRDTTmrw/Y367y1akHwacJUdxX5imOxXC5Ln2qpnZ39Rb/VRCTQmp iLPg== X-Gm-Message-State: AJIora83VRsfqYdkCQZH3Wzk1WaI7xEuFYmR4B+Gkw/SzfG5qyl4Ua/U D/JQCFUVJVblH/2SzDbAn8CYj5sYmwT0xQor X-Google-Smtp-Source: AGRyM1v/JF9sZ/ij650I5WlKuyttuPJ8uAaz2+f1pjdmNhjhPRS105MXj2fjZLNNlVjiJJn/+TK2KA== 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: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656387439; a=rsa-sha256; cv=none; b=KXOGgqt9ZepDSpnUcmlN5L1jkfEhZbxcLh6boukv+kO7tkCzv620Msec5XGi6o8HO9iPNk g4iYaq7L4aPVD5JeqoOo80/IWAovFTKNp1tedNrIaz3/Va/uYe2g7Vecqh/BgBidKzem+p t3vAwFWJXxsqNesu1xV6omXpWN62Zwo= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qWSblFa8; spf=pass (imf16.hostedemail.com: domain of gautammenghani201@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=gautammenghani201@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656387439; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=G2ZI6aMz7mjHuacv2TpkSw0NDmBUe+64bYW0SIydJ1c=; b=rfXKM+6od8tKgACPmneFm16fYnZr/MhAxY+HwHuOveGr/t6HDoK09sjYHwkC//S0wsOrFA 3zOjYEjuweCz8wSLHiKu9c67PV6cR73+h8MvwhydB3kMmelZnehSTB8Q/TxXtX7Rj4NEPq kx1xM+i5fR89XvLSsAzaFEvzOgFurjY= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: ECF5618003C Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qWSblFa8; spf=pass (imf16.hostedemail.com: domain of gautammenghani201@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=gautammenghani201@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Stat-Signature: cnhkryf8a88pzn3mwxhn9pf36ghzcqok X-HE-Tag: 1656387438-626861 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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