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 5C060C43334 for ; Sun, 10 Jul 2022 07:33:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D16576B0073; Sun, 10 Jul 2022 03:33:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C9F028E0001; Sun, 10 Jul 2022 03:33:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B40556B0075; Sun, 10 Jul 2022 03:33:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9FF756B0073 for ; Sun, 10 Jul 2022 03:33:08 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 74E70605EF for ; Sun, 10 Jul 2022 07:33:08 +0000 (UTC) X-FDA: 79670374056.31.23B20C2 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by imf31.hostedemail.com (Postfix) with ESMTP id 0163320058 for ; Sun, 10 Jul 2022 07:33:07 +0000 (UTC) Received: by mail-wm1-f52.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so1388170wmb.5 for ; Sun, 10 Jul 2022 00:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wowsignal-io.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pJIa/hDCyrfbVGgr7AeEBPl4gBJA42zWXt/96LFSyuA=; b=wICBgfGxeRe8t4xNfqF2VOb+iliw7XU2aXkRTUuxjYK2nOLdSxe7HD/cq2/GlIYFF4 KtqigsKBKrGl/k26X/NL6NZaCA73xTaodee4fudMf/Zx2MBJ9LRVFYuWi11J/gVvMKj5 vf7z60m90UOhoZ+eS+6OULY91oY8oA+VZBMk3f/3x3YmmtZazL4ZIHzGVhvJNBYs/5oo tHaWTVZNxtTb7Ze2EU38F63aDUMcFV4ErPDU+1PG6hSA+yFbzQbViOiKl529xjeTgwn3 QhxisQ96osJXm5DANz+dPDxPrpagUEPf46tQ7AvuPFfljgN1Ycca/oidQNE8pRP4KJ9r JwYg== 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=pJIa/hDCyrfbVGgr7AeEBPl4gBJA42zWXt/96LFSyuA=; b=5pyGl95qyTHissHVBUXTjpJJl6Z2fL8xDFeLufY4LHCiVSqXNznGTUeCY/nXY1/XpI XJzTX3HY25z+Nuidd2JOSi5N1Obs/SBKJagZ22hiqiDTS+nRqhkvYGXBCbbWblwe4ChG z1V4vRuhqaZrJonyvQx5/DLeeSSO9cqavYVW28wgbnIONUZPEZvp6OhelQVD1F42QxPJ rVlK9OEghsxBGNkgqQMTsrC6B6ZaRE+Jx6TNljXSCt4Hg4XEwK5Bd9+rtKoUxBahnrC+ 5jKZJhgLQiuySvxdB31qVK4wkAR04SIVTJP9dj97R8zOgob6ef7Hc3Q9bjWjjp/LPiJf EneQ== X-Gm-Message-State: AJIora9WxfbNdht2qaus12xnhuV91nXD+bMktJwvYgL5VBUTdlEmDovS 6IBpP7oAkfd4+uJ0MQiwwt+Mhw== X-Google-Smtp-Source: AGRyM1sy+ot340ZQ1xhwSBUT2moHY6rRjJ3qGoCLspMVNTCQRTlNl34ZsdGMA2Vyl2mIfEjbEj/Qpg== X-Received: by 2002:a1c:f208:0:b0:3a2:dc06:f3fe with SMTP id s8-20020a1cf208000000b003a2dc06f3femr9107414wmc.119.1657438386394; Sun, 10 Jul 2022 00:33:06 -0700 (PDT) Received: from localhost (212-51-140-210.fiber7.init7.net. [212.51.140.210]) by smtp.gmail.com with ESMTPSA id j16-20020adfff90000000b0021d76a1b0e3sm3072065wrr.6.2022.07.10.00.33.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 00:33:06 -0700 (PDT) Date: Sun, 10 Jul 2022 09:33:04 +0200 From: Adam Sindelar To: Andrew Morton Cc: linux-mm@kvack.org, Adam Sindelar , David Vernet , kernel-team@fb.com, Adam Sindelar Subject: Re: [PATCH] selftests/vm: fix va_128TBswitch.sh permissions Message-ID: References: <20220708090646.34927-1-adam@wowsignal.io> <20220708130801.411ace64e0244a75f483a9f0@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=wowsignal-io.20210112.gappssmtp.com header.s=20210112 header.b=wICBgfGx; dmarc=none; spf=none (imf31.hostedemail.com: domain of adam@wowsignal.io has no SPF policy when checking 209.85.128.52) smtp.mailfrom=adam@wowsignal.io ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657438388; 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=pJIa/hDCyrfbVGgr7AeEBPl4gBJA42zWXt/96LFSyuA=; b=1Jk1tVghLVW60/cAiKYYcIIAn/HfqL4RX5fL84X3aw1sB+40dQnQCY6fd0nScXQH+peG+H Ptw5yaxzZJ/iy2B6ItH0+jZ8Ia7o15TpD3gbz9PK5O8vrjxxLIU2aOs3x64APul5i0rsJd 4LGpxIrEHUWNob+WOd4t6FmyjKzUHOY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657438388; a=rsa-sha256; cv=none; b=eSPNGt3zbyXVly95M4c3k6a4w6mhKIuYpmF6ZHiBg/F3Kt2NFRGSZ6H89E5Jmr2sfvWpjb sf6tlWipgDCKicEC4EGWeYDnhB/cTkrdjyBYREYfLZnH1anCbdrK4or6EWZry5uw9MAA3B XPshOMD8CEcesQhgLd4L/AitxTJcoJA= Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=wowsignal-io.20210112.gappssmtp.com header.s=20210112 header.b=wICBgfGx; dmarc=none; spf=none (imf31.hostedemail.com: domain of adam@wowsignal.io has no SPF policy when checking 209.85.128.52) smtp.mailfrom=adam@wowsignal.io X-Rspam-User: X-Rspamd-Server: rspam08 X-Stat-Signature: t9fh8j5a6s6kixciruknfgywpqjx5ehi X-Rspamd-Queue-Id: 0163320058 X-HE-Tag: 1657438387-424481 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: On Sat, Jul 09, 2022 at 10:14:27AM +0200, Adam Sindelar wrote: > On Fri, Jul 08, 2022 at 01:08:01PM -0700, Andrew Morton wrote: > > On Fri, 8 Jul 2022 11:06:46 +0200 Adam Sindelar wrote: > > > > > Restores the +x bit to va_128TBswitch.sh, which got dropped from the > > > previous patch, somehow. > > > > > > Fixes: 1afd01d43efc3 ("selftests/vm: Only run 128TBswitch with 5-level > > > paging") > > > > > > Signed-off-by: Adam Sindelar > > > --- > > > tools/testing/selftests/vm/va_128TBswitch.sh | 0 > > > 1 file changed, 0 insertions(+), 0 deletions(-) > > > mode change 100644 => 100755 tools/testing/selftests/vm/va_128TBswitch.sh > > > > > > diff --git a/tools/testing/selftests/vm/va_128TBswitch.sh b/tools/testing/selftests/vm/va_128TBswitch.sh > > > old mode 100644 > > > new mode 100755 > > > > Half of tools/testing/selftests/vm/*.sh don't have the x bit set. > > They're invoked via `/bin/sh foo.sh', which is more robust. > > > > Can we hunt down and fix the invoking code? Might be as simple as > > > > --- a/tools/testing/selftests/vm/run_vmtests.sh~a > > +++ a/tools/testing/selftests/vm/run_vmtests.sh > > @@ -144,7 +144,7 @@ run_test() { > > local sep=$(echo -n "$title" | tr "[:graph:][:space:]" -) > > printf "%s\n%s\n%s\n" "$sep" "$title" "$sep" > > > > - "$@" > > + /bin/sh "$@" > > local ret=$? > > if [ $ret -eq 0 ]; then > > echo "[PASS]" > > _ > > > > I think that would impose the choice of shell on the test scripts. About > half of them start with '#!/bin/sh' and the other half with > '#!/bin/bash'. > > Maybe that's something we'd want to do anyway, but it seems like it > could have subtle and unintended side effects if the goal is to fix a > failing test. > > (It would also invoke the ELF binaries through /bin/sh, but that > probably doesn't matter, since sh will I think exec right away.) > Having thought about it: invoking the tests using your draft fails to run the tests that are ELF binaries. `/bin/sh -c "@"` does run everything but doesn't pass arguments properly. (On my system imposing /bin/sh over /bin/bash doesn't matter, but I think it's possible for /bin/sh and whatever shell a script has in its shebang to be incompatible, e.g. with zsh.) This might be my own ignorance, but I don't see an obvious way to make the invoking code correctly handle all tests without branching based on the contents of the file. We could look inside and act on the shebang, but then we're reimplementing execve. To advance a counterargument: as you say, not all *.sh files in tools/testing/selftests/vm are executable, but all test programs (arguments to `run_test`) are executable. Currently the test programs are treated the same whether they're ELF binaries of shell scripts. Having some test programs not be executable would require treating some test programs differently from others for the first time.