Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp61954rdb; Wed, 17 Jan 2024 17:27:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhEseVXUzcb3c1GUFVBm6+izZeCA6uCC5toHd0+P7BItOUMA4HmlVWohwe2yLMDIwlb2+5 X-Received: by 2002:a17:906:1ec8:b0:a2d:90e7:14cc with SMTP id m8-20020a1709061ec800b00a2d90e714ccmr18183ejj.265.1705541246113; Wed, 17 Jan 2024 17:27:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705541246; cv=pass; d=google.com; s=arc-20160816; b=uu4bWSu4Igb2QJPEIToqCO/p6Y7TBHiICUpw7urg1CgWg3wKDN4l8IcnvTFt6NAtcZ vuZlLxQ49gY0iEAN5wKWRd7xnmiapLsxduz5drm6ZWj1Pc1W5lscW9Bg8TnztOn9j3yG GmTACMOfoI8gB28X+7W14rR2AjBn6S+iw7hxsP7KwWoPc7EJvnaB6l7My57uMR48QKN7 5/pMJKn5t363gfbIDJK3dGJ8RC9y2M3wTof7+tHixjwEjbN4n6wkaZaSWxkBkqZIEG/G rC8wt/ucjqEKEKK4Ga5MU6RkQSFUp0T+jki3bXYeN5njpb2nhJphIwJtchzIa/6y/Zi+ ZmxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=yEnwVFcfzT60qBpFgceeYxwIxXH4fpMMHpmr8kB6sWU=; fh=Il87s+85y4XuvmqlRpHCHfTw3G1vBMV7+RaBQng+X9k=; b=pH4316SbUW9b0iPt29IHWeKHuyKd5KEE2LhD/N6w9ic8pEGAgnxYmfUQZUUvYOxJfe H40e+nCSYsBHAF8591ivcouHh9R7bx0cFz2Z1zKVJBNH/HqjGoJqVAuGDfIdducIQgcQ y4WmMOgWHmcEZ3pecnTrh4Mi3vr4MkI/fXTTeu1pgwJuNYk3y0MAyhSew11PYfq0+vc2 EGmh+edvCc9kiUYVsVLQxy+MOPsjuj/Nx1XgkP3CTrFIBkfhhHLJdswgbCAy+Iysj4Z2 ECL4t33pM1a4rBt3sJ0XDjben8VrsueZ+rkASQYCSWgJTw9lhzDhfmIbfUsk/C8g2M2j OpvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FEzu3x+2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-29620-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29620-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d4-20020a170906344400b00a2a4a9e8b92si6102059ejb.940.2024.01.17.17.27.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 17:27:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29620-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FEzu3x+2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-29620-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29620-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DA0C51F22EA7 for ; Thu, 18 Jan 2024 01:27:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AA3420FB; Thu, 18 Jan 2024 01:27:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FEzu3x+2" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EEAB1844; Thu, 18 Jan 2024 01:27:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705541235; cv=none; b=aqSDTZ16qo0fbYxMf1uDQoT+Yx9E585FpOWRa414dKgO0xZrT3KAcJg4LbyB4pLM+H8+hg/ytjsRPFb+rBXlpdgJok0eh36BDyflIp/64ECnnFKQKWiyBRrkhfwX29uRiqLMy6Adub4i7uBr3AAqyQiKVfW7I2IVEDIdwWtjczE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705541235; c=relaxed/simple; bh=Hk1KDxh3cvSmHJU8ScEGpXDI1peSvh9pQwnB28vVWbw=; h=Received:DKIM-Signature:Received:X-Gm-Message-State: X-Google-Smtp-Source:X-Received:MIME-Version:References: In-Reply-To:From:Date:X-Gmail-Original-Message-ID:Message-ID: Subject:To:Cc:Content-Type:Content-Transfer-Encoding; b=KGdEkl0dg+wZxSdS1WlfJp9gQnZfBNZMvwjdwurBti/bOICcSDc6RvQ3Isz9hWEQ2aKT3WOOqLJCikbR7PW98xzRddyyb2g3fJ3p76SsW5YZ4AfTLSZqHDh5e80uOS9NzzrB5lpi/Fym/lTjuznaAH2F32628ngu0tcaG17kd3g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FEzu3x+2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDAA2C43394; Thu, 18 Jan 2024 01:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705541234; bh=Hk1KDxh3cvSmHJU8ScEGpXDI1peSvh9pQwnB28vVWbw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FEzu3x+2nEU5ma4yXLtNM6XnDcc5TAn4z80twzMg3qo5b1OoKyPk6o6v5F15GhsHU ZCpZkSR4XUDYenUgHdlmN6PsYR9gZugAl6A0m8lDUozOFD2r+hRQhpymStLjktJXG7 ltmGkkPaxIx6QZZxE2NEt2umT8QO1tbd3e6H0dCsS84YBhgBlU882YzluyNmsRd6df YyKYPr6R0YC5hqza+0qIsBpQcSpHjamR439o4vdfKlm6dmFfPbmVuxjOk99clBSJ29 2EwNsl01/90m2nSqcs4ONtrQbydO8o56/aGhnxRVsrPDuw2DBD4AXb2dhRZk0kAMVQ Bz3Sk1kfDWR5A== Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-50e7e55c0f6so14222176e87.0; Wed, 17 Jan 2024 17:27:14 -0800 (PST) X-Gm-Message-State: AOJu0YzC4xmS+8ZcIMjx25x6Ukj6bKU9SuyJWp3DQsrC7i+BawZKCYB+ oUmg1wISVl4rpVDRz5o8JuwEUXQ4TpSlz7K+SJZTYIHvigVVoAfRS+Xm2tQ21kX/P1iC+NC3oAE IScuVyiTo+PPHHQS6A9SaTFJCn9I= X-Received: by 2002:a05:6512:3d04:b0:50e:76b8:e754 with SMTP id d4-20020a0565123d0400b0050e76b8e754mr23197lfv.141.1705541233006; Wed, 17 Jan 2024 17:27:13 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240117111000.12763-1-yangtiezhu@loongson.cn> <20240117111000.12763-4-yangtiezhu@loongson.cn> <342f1c7f-a8d3-dbba-a45f-66fc672883be@huaweicloud.com> In-Reply-To: <342f1c7f-a8d3-dbba-a45f-66fc672883be@huaweicloud.com> From: Song Liu Date: Wed, 17 Jan 2024 17:27:01 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v5 3/3] selftests/bpf: Skip callback tests if jit is disabled in test_verifier To: Hou Tao Cc: Tiezhu Yang , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , John Fastabend , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Wed, Jan 17, 2024 at 5:11=E2=80=AFPM Hou Tao wr= ote: > > Hi Song, > > On 1/18/2024 1:20 AM, Song Liu wrote: > > On Wed, Jan 17, 2024 at 3:10=E2=80=AFAM Tiezhu Yang wrote: > > [...] > >> @@ -1622,6 +1624,16 @@ static void do_test_single(struct bpf_test *tes= t, bool unpriv, > >> alignment_prevented_execution =3D 0; > >> > >> if (expected_ret =3D=3D ACCEPT || expected_ret =3D=3D VERBOSE_= ACCEPT) { > >> + if (fd_prog < 0 && saved_errno =3D=3D EINVAL && jit_di= sabled) { > >> + for (i =3D 0; i < prog_len; i++, prog++) { > >> + if (!insn_is_pseudo_func(prog)) > >> + continue; > >> + printf("SKIP (callbacks are not allowe= d in non-JITed programs)\n"); > >> + skips++; > >> + goto close_fds; > >> + } > >> + } > >> + > > I would put this chunk above "alignment_prevented_execution =3D 0;". > > > > @@ -1619,6 +1621,16 @@ static void do_test_single(struct bpf_test > > *test, bool unpriv, > > goto close_fds; > > } > > > > + if (fd_prog < 0 && saved_errno =3D=3D EINVAL && jit_disabled) { > > + for (i =3D 0; i < prog_len; i++, prog++) { > > + if (!insn_is_pseudo_func(prog)) > > + continue; > > + printf("SKIP (callbacks are not allowed in > > non-JITed programs)\n"); > > + skips++; > > + goto close_fds; > > + } > > + } > > + > > alignment_prevented_execution =3D 0; > > > > if (expected_ret =3D=3D ACCEPT || expected_ret =3D=3D VERBOSE_A= CCEPT) { > > > > Other than this, > > The check was placed before the checking of expected_ret in v3. However > I suggested Tiezhu to move it after the checking of expected_ret due to I missed this part while reading the history of the set. > the following two reasons: > 1) when the expected result is REJECT, the return value in about one > third of these test cases is -EINVAL. And I think we should not waste > the cpu to check the pseudo func and exit prematurely, instead we should > let test_verifier check expected_err. I was thinking jit_disabled is not a common use case so that it is OK for this path to be a little expensive. > 2) As for now all expected_ret of these failed cases are ACCEPT when jit > is disabled, so I think it will be enough for current situation and we > can revise it later if the checking of pseudo func is too later. That said, I won't object if we ship this version as-is. Thanks, Song