Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2780713rdb; Tue, 12 Sep 2023 11:51:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGa90uHSSSIEGIRvy5jAKpXLQMcf3IJlb73Wbl6fabXESbDKR/xvB47uPJClLYjbk2emylw X-Received: by 2002:a17:90a:8b89:b0:273:7bf5:b1bf with SMTP id z9-20020a17090a8b8900b002737bf5b1bfmr4589159pjn.9.1694544663489; Tue, 12 Sep 2023 11:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694544663; cv=none; d=google.com; s=arc-20160816; b=bX1H3F98Y3p18o4+slTta/F0U9sdWxYZXoUOihZMVE60IDHsfIC5g0i5oKLSDKju9I 60rtVuJcEdCCNN4AVZ+Yc05wSWv1MUICDkWYdEQbvBKxAN/GOQpdS++aXBIi2pJnhASS dMUntmjRjMAZ0g8Nl2eYPV0bBJ4OyBw+MyzBSjCD+Ok1K7Vllzo0Wg88l1p2BUCde6ek ojDwWDsr2DsrgQLYt3Iecm0QhbHB/OWTkCQyRZQyjl+g8/CkCM4ht61Azhk40rzTOuWz REKHa1sRgsQmTobRk0I2/NfLpO2trT520k/zukzkWhJGHhRlxM8gs4Cn9Gd41nkCUbB8 nYkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=8ERi9ZEqlVNb76qS6B065bS/ZA5gp+8icppp5yNtWP4=; fh=EZQ1rrtsV4oiulmC1yFBtVgylMH5AmqYG5auXU4kkQ4=; b=hCh+yYwO6Dwpecyw+PkKvuSQocaIJnxI2pSO3G9L/V5mQqUMEfPuMugjnAqQlsJz3n 5AD4oY5OCuNO5w4evENLFFy5+MIWjj5mAUoh7lAfcwbS4yTD1IAj8U197ZgytzJiIFhz PtJwkxyM5Qj/V4MP6YGS6H0Qti8MJnqR/r+Vt7C3eP0c/A2qinqJyfjYN04CA83Tzfdt wqqltsEY61V3kTERe/FkR9EHrM5aXlNMZeSbxZAJ0hpQJ+EVBikCx152N1o5HRQYSd/k ZC71hzDNl4Tq3H/noECymZWbAGzGfRAhoWNFtMKidbz9yZUZPYsSZHvO93i2txg4VC+C bVwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=raIrzv34; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id i76-20020a636d4f000000b0057762236e02si4400035pgc.149.2023.09.12.11.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 11:51:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=raIrzv34; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 7086F8029647; Tue, 12 Sep 2023 05:32:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235130AbjILMcH (ORCPT + 99 others); Tue, 12 Sep 2023 08:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233477AbjILMcG (ORCPT ); Tue, 12 Sep 2023 08:32:06 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70B049F; Tue, 12 Sep 2023 05:32:02 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-99bcc0adab4so705067366b.2; Tue, 12 Sep 2023 05:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694521921; x=1695126721; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=8ERi9ZEqlVNb76qS6B065bS/ZA5gp+8icppp5yNtWP4=; b=raIrzv34SyoIr/LyC+6YsNgqekIaNwgkTAjLoUmX1HAVmQtCYrAILxreebFL6Zjbqv ijFgMxPtkyhr0xn/9e7jvLT7P/o9ME6iWQbjsXsgqHYUr2X7UsMF/oKUeB97f2D/ty99 ntttGu+oEQjI/GipBAWwbaUlgpwEBZMqO73JWb+TPFAEnO+1LM1kK9ENfUN+r5UECumo JYdL4jwEIqw9LfCPZgXPkOzMZnWX5CyQthilA3KRtxDi+5XgFf9ERdvXEkyGY1srbJQH pecPxCTtDrzPwZsYuY5Vxy0gp6KRMeKj08kU/eiToB9tS/Q0/cTA7kIV1QVQaI1Oa7Kb AwZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694521921; x=1695126721; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8ERi9ZEqlVNb76qS6B065bS/ZA5gp+8icppp5yNtWP4=; b=a6vlQU9lNbEyMwOR8baGmciPM19ibPVG9zc1DinwCmu4E5BWVXVZ9vAg9SVl/IiykX kEIlFGFbwwoheyjCoABID+1YgmZEV5UwOr5NP5iARIIg9hTJLo4y0D4qee/5HgW/CXwe oNWPk1Hgur5czy+ikEWkY98ISmRHewG3GVxSaT5ZeLLraGCDC0L/gDcWC1tdrrdHVJxv IOvaCdTO8z4lZquh/T9qZLoMC+oYGRMwG+MOL2LL/paG+NxoQMY6gOJo2T2TbCZ85bec 4kMIl8qTbUHDlzLZrdYX1HKan8gUWQqgw7/GvMNx5EEV7YyYI0sERp73rfBFNAcF5rHK xRug== X-Gm-Message-State: AOJu0YzriyVW6O565Zwjese+iwrbMdBe51FwA0xXmHxxavAIyDf5n56F AODSum3vp7FvU1AJY9juUsc= X-Received: by 2002:a17:906:74db:b0:9a3:b0c9:81fe with SMTP id z27-20020a17090674db00b009a3b0c981femr10767244ejl.57.1694521920609; Tue, 12 Sep 2023 05:32:00 -0700 (PDT) Received: from [192.168.1.95] (host-176-36-0-241.b024.la.net.ua. [176.36.0.241]) by smtp.gmail.com with ESMTPSA id mt28-20020a170907619c00b009ad8acac02asm781970ejc.172.2023.09.12.05.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 05:32:00 -0700 (PDT) Message-ID: <3f91e97d95e2d8cf667071d18b4552fe13fd2b95.camel@gmail.com> Subject: Re: [PATCH bpf] selftests/bpf: fix unpriv_disabled check in test_verifier From: Eduard Zingerman To: Artem Savkov , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf@vger.kernel.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Date: Tue, 12 Sep 2023 15:31:58 +0300 In-Reply-To: <20230912120631.213139-1-asavkov@redhat.com> References: <20230912120631.213139-1-asavkov@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 12 Sep 2023 05:32:09 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email On Tue, 2023-09-12 at 14:06 +0200, Artem Savkov wrote: > Commit 1d56ade032a49 changed the function get_unpriv_disabled() to > return its results as a bool instead of updating a global variable, but > test_verifier was not updated to keep in line with these changes. Thus > unpriv_disabled is always false in test_verifier and unprivileged tests > are not properly skipped on systems with unprivileged bpf disabled. >=20 > Fixes: 1d56ade032a49 ("selftests/bpf: Unprivileged tests for test_loader.= c") > Signed-off-by: Artem Savkov Yep, my bad, without this patch test_verifier fails when /proc/sys/kernel/unprivileged_bpf_disabled is set to 1. Thank you for fixing it. Acked-by: Eduard Zingerman > --- > tools/testing/selftests/bpf/test_verifier.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/= selftests/bpf/test_verifier.c > index 31f1c935cd07d..98107e0452d33 100644 > --- a/tools/testing/selftests/bpf/test_verifier.c > +++ b/tools/testing/selftests/bpf/test_verifier.c > @@ -1880,7 +1880,7 @@ int main(int argc, char **argv) > } > } > =20 > - get_unpriv_disabled(); > + unpriv_disabled =3D get_unpriv_disabled(); > if (unpriv && unpriv_disabled) { > printf("Cannot run as unprivileged user with sysctl %s.\n", > UNPRIV_SYSCTL);