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 6B01AC4829B for ; Mon, 12 Feb 2024 08:33:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7B706B0071; Mon, 12 Feb 2024 03:33:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C2B006B0074; Mon, 12 Feb 2024 03:33:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B19586B0075; Mon, 12 Feb 2024 03:33:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A2E3C6B0071 for ; Mon, 12 Feb 2024 03:33:04 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3F9C81C0B72 for ; Mon, 12 Feb 2024 08:33:04 +0000 (UTC) X-FDA: 81782486688.22.20FCBEF Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id 16B6C80013 for ; Mon, 12 Feb 2024 08:33:01 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707726782; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i7D4RZfETGE1F8jiaGkcQmn0csWhRT06d3NAOKKK+ic=; b=Ij74OOkW3WhaN5o9q6r3TJZzsIxzoOkEHdQYVxWtE8Wy9Np+fDZmkBGwxi24rxog77gPRz AIMHyuWWj1YxLiEH5QfCsRWjVgMV9FfPtAV4ay8XeY+485JRqM4bL9A08BYzW0pEhegewJ uXl6whSATSp2Edz6OHr7X1uZyDy7pdw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707726782; a=rsa-sha256; cv=none; b=dSZflw+PESDe93AE5ddwC0CHvF2+Vll81IxBM83U7SOH0fviE7Ag/tJDTtUZdapz9kGVZd pt7/peBV20Q9rvW6TIIxEIqGk7LtYZsnun8qbQGDO2f51BbEt9ZbsjW1keTRzbLFrGvoPv //zDmHC/JEstcJzijJhtVyE3PHh54uQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7FC3EDA7; Mon, 12 Feb 2024 00:33:42 -0800 (PST) Received: from [10.57.78.115] (unknown [10.57.78.115]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 19CCD3F762; Mon, 12 Feb 2024 00:32:59 -0800 (PST) Message-ID: <9ff817f4-e999-4a95-b00d-6984a7ea6181@arm.com> Date: Mon, 12 Feb 2024 08:32:58 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] selftests/mm: Don't needlessly use sudo to obtain root in run_vmtests.sh To: Mark Brown Cc: Andrew Morton , Shuah Khan , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240209-kselftest-mm-check-deps-v1-1-19b09b151522@kernel.org> <17c0b7a1-6ec2-4504-8287-f0fa111b9748@arm.com> Content-Language: en-GB From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: 5qb51oqey8thzhcwuqp9m7izq85m78si X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 16B6C80013 X-Rspam-User: X-HE-Tag: 1707726781-573706 X-HE-Meta: U2FsdGVkX1+8YCOizfpDsRkzt2WyXU+jDGRR89azHwkYrGR5CPw2+1kqjH+zgYuIqW0v6h3HNaucHDW0K/OO7WEr2cdbEHka1LE09oQUvaMs5mr2DdsdHOnvTxEyHJXLLXUBm4yT14qlZ7P4vY6baslfoLAJIYMiGrxtO7vYC51PW83Dye2d/ViTP4dZQUkA1Q0Imc372SHdSQCz3JSgPj6GTt5XPRAGQzv5qRovkomWH0YRs+Qm+1A3nWsOQXhT/l+pA3oGDPshCRj9UrUUFj5npbxaX/sJF1YXXTxTrIk5BKTI++VzQxgxfrv8TtNmaIadQJC4aAN5mBnhQQfSKtk+DzDMJeekQT8a/KGI6jubwR5c1sNqDBDaLagtbY6zirchSnbWcdVoq+P4aBc812sHnoUY4bT0gPg+YxpkIa3ea3SXDZ0bkFNLFJ3TiYaNdnbl86EKuf+vgjCdyd/WVY5SVaG10mPkdSrTSz/fmpD5SanO7tnMwCkP4ew60Yz1IbeWi8Zw4h6ve+e1yQ5ZYipEICAFlqkX/rQ73Bq4oCtbddtGqvoB8a6n1Uy/o8G+ke12gPpacA6hWWNvOUSx2Jjqnr2ILJOpH5W1WUacf/AX7ZPvukj8BLxKVcQtQs2CTuYbaB3M6xiyyG2KHYsNwDqkD9y0lSb7oHtVNULtggsUcwC79SN0plEE34m/hurETU8N+qLMEH0i7tXJOH8I11g15hfW/KfEje5L7ZVRWg8LMRiUpFL49S30+yvXzFkpZ4VXhXXuxMEBI1REUU5HLcVKVgJfltWPMA/btACmZgFJhlSv9lSp3hLYsMFbuPYpmjsXOmQdWviWKfAFQu3RKDdgn0rz8ppGdFNNxIooLRrmhemBV6hhpDswylGXcQ8p1W11BoA/hP2p8Xer6PKHGYywqIPJ0RkU7QF3kN0O+CErkbJF5rBaUx3nCbKYy/b3Nr2TI5u8HLl+sLS+Hqd H1plPF1L zaHk6mWPpsMWGTw3ydKOFF2k4MnA8W2jFNUiqKexbzbf10b08555TgP96h4LCNXn+xY+AMNRPxt3txbn5vx3LoHMVzt8B4aItFVHCEgBOhrCkFMUxfdNRKMmkam/dPWAKjU3CSjNPFIpUhucZzWalm1dOllTKqrjSE5lLKRgTg8re9c9DCcybDKuA3t77MSIXM8UC 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: List-Subscribe: List-Unsubscribe: On 10/02/2024 12:35, Mark Brown wrote: > On Sat, Feb 10, 2024 at 07:40:16AM +0000, Ryan Roberts wrote: >> On 09/02/2024 20:21, Mark Brown wrote: > >>> When opening yama/ptrace_scope we unconditionally use sudo to ensure we >>> are running as root, resulting in failures if running in a minimal root >>> filesystem where sudo is not installed. Since automated test systems will >>> typically just run all of kselftest as root (and many kselftests rely on >>> this for full functionality) add a check to see if we're already root and >>> only invoke sudo if not. > >> I don't really see the point of this. run_vmtests.sh needs to be run as root; >> there are lots of operations that depend on it and most tests will fail if not >> root. So I think it would be much cleaner just to remove this instance sudo. > > Ah, I was assuming that some of the suite ran usefully as non-root given > that the only point of that sudo was to acquire root. If the whole > thing needs to be root then we should instead have a check for root at > the top of run_vmtests.sh and just skip the whole thing if we aren't > root, but then I'm unclear why it's invoking sudo in the first place. I can't speak for how others use the suite, but there are a bunch of setup operations in the script itself that require root (e.g. reserving huge pages). Some of the tests will work without root, I'm sure, but I'm not sure its hugely valuable. Personally, I'd vote for just doing a test for root at the top, as you suggest. > >> The problem that I was referring to yesterday, about needing sudo was for this case: > >> CATEGORY="mlock" run_test sudo -u nobody ./on-fault-limit > >> Here, we are using sudo to deprivilege ourselves from root and run >> on-fault-limit as nobody. This is required because the test is checking an >> rlimit that is only enforced for normal users. > >> Somebody on list was talking about skipping this test if sudo wasn't present a >> couple of weeks back. Not sure if that happened. > > Yes, there's a check: > > if command -v sudo &> /dev/null; > then > CATEGORY="mlock" run_test sudo -u nobody ./on-fault-limit > else > echo "# SKIP ./on-fault-limit" > fi Ahh that's obviously been added in the last week. The version of mm-unstable I'm looking at doesn't have that. Although the skip message could do with being TAP-compliant.