Message ID | 20231212131031.3088661-3-menglong8.dong@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7713903vqy; Tue, 12 Dec 2023 05:16:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IELrMUGAJmSiy5XarECgBCtKpZXKDlub2GQsaFbAEmHwiqZtQSVLh2KgvWuyPzmRYojLwu4 X-Received: by 2002:a05:6a20:914b:b0:190:228e:4c11 with SMTP id x11-20020a056a20914b00b00190228e4c11mr3398002pzc.90.1702386967746; Tue, 12 Dec 2023 05:16:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702386967; cv=none; d=google.com; s=arc-20160816; b=RVawWoy3IQoS7zNVvncUrVUmm0RmALxISJxyLKaqNgthgOdZu9wHrn64x3tUdE6oE/ W4tT/yUxzOymGbwCmsrzCvQ4C+NZAG1TSoawWAho2kWGWuLsDPbH8Znfbjt8Au0POa4d i74ynYA3CxpCPSo7skpfhZSinwdUYY9xY/z0mOcKzGroE020hLcErLlPsWxrBl40OnM/ wy4dEeB8jR5CUCoZbV80aA29DVPUGm1Ls2XtaMAw9NHTGzTP0yKXQoUsu5NrZe9KBRAu qOIo0E0C3XseyA06g3UPumH02IvdCKVoX9Ili9ft0w4lt7cGHKAJrAvH9vOhoDJp5yf0 kGyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0QcCXCm4DPHUOC/Ldcn3syRLAjzqmkGV7uvetVmifyw=; fh=SGifBTVjLZ95Bpo5OYjxcS+0FNZ4Hm4Cdfz1m3M7p+s=; b=C9ULSJrjt8GGUmigCOHSTO15KD3Yt3m8OiDcN0rGHTfyMzhM/w0LP5A1T2NV2Q0DnS +Dx7EhHhMsGPQvtEnlN7AaUw8xVV90hCotbsKA1O3BD09OoCgTVZGIGuglh2w9U01yxo grfIM0N/24ftQn8aLC0GJjtrk4BBg2jfKUBY5xV3pOuRRWAtDyMJpoUTkOWnBItDHBKX 5q+AuOH88mQiDSFHXzi2vCTp0cdKHMvB+NsPLhYc6jP7bFBfGbfhSTy5Kn/XQCaj88MY xH68L5wr03Pid1enmB8Ad+AaHfJclRxqFNl0XhG09DkZqpz45agBYlEm/GqIQouYQ9Oh ZCxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="H6/RmvsC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id w63-20020a638242000000b005c200c132ddsi7176055pgd.601.2023.12.12.05.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 05:16:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="H6/RmvsC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id E54F580A0E2D; Tue, 12 Dec 2023 05:16:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376582AbjLLNPh (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 12 Dec 2023 08:15:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376583AbjLLNPd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Dec 2023 08:15:33 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2E97107; Tue, 12 Dec 2023 05:15:38 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id d2e1a72fcca58-6cea0fd9b53so3359457b3a.1; Tue, 12 Dec 2023 05:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702386938; x=1702991738; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0QcCXCm4DPHUOC/Ldcn3syRLAjzqmkGV7uvetVmifyw=; b=H6/RmvsCHZVQeCoEnugvkOoaz2lU65BOr88iitTj6qAasc+1CN0cBXYH9Qi+ktYqxU JVJ0nDtCaiarBEFgZrCQiGcJiJkNON7NhPcIBeZ2pa1H0LCy/eFj6JErjR79cbLrdE4Z UlsuCcbiVgpKFM430uUL+Gx1faJg1DMhFxTyoTVFbsYLiqRDruXR7+LchMl8naBZGCwt y3rEWvu567omz817ZC63YPGkAkeeyIkwvMgW5DqMv9Sp9jw9rPp9thdiL6z9Rf7luYSK zUiEdUzmbljQMclLrrOOTHUxmnVOU8Pz7mauBMygTMRSvaPMFiCuXch0qiL1zRVfqNh+ Bkfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702386938; x=1702991738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0QcCXCm4DPHUOC/Ldcn3syRLAjzqmkGV7uvetVmifyw=; b=JoCWRy0wVDnTW1NHNxbAjaWiEMvBTsXeh9VOXVwUWomWAVnZIClQ6JNeBub8egjJLO ort42PwDYW2QJL3+8MXpf9zTn010GwFrAAfl6Dar3+v75me8leHeFdaTdMy/C/Sy9y+x Y6rWijYUyMVoEABfZ4Ey9Gh4WLM5hYVLaTsq805RqOZCbh95JsQ4FClHyRjT2lFVZxAE qhrrVAiuQQmvDsM+vGWLCktNBagTeLFqD3hUzR0TpA/HyshP248c5tkysU6ooAgL4v99 VQMmVfRVhm6hMHXYR0ZGg3DzaxUwvDE40LeAIqYYehg7FU4rWnyfw9bD0gYggOp5t/XW CcfQ== X-Gm-Message-State: AOJu0Yy0jGtGaIzZldkwt83rC7wZf4OQJBtcnD8JnXDT+WxjRrOVKVEq 0VYASB05Z4S4zcZkaQzaOwU= X-Received: by 2002:a62:be11:0:b0:6ce:6407:2264 with SMTP id l17-20020a62be11000000b006ce64072264mr2500987pff.56.1702386938219; Tue, 12 Dec 2023 05:15:38 -0800 (PST) Received: from localhost.localdomain ([43.129.244.20]) by smtp.gmail.com with ESMTPSA id x20-20020aa793b4000000b006c4d2479bf8sm8095026pff.51.2023.12.12.05.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 05:15:37 -0800 (PST) From: Menglong Dong <menglong8.dong@gmail.com> To: andrii@kernel.org, yonghong.song@linux.dev Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, martin.lau@linux.dev, song@kernel.org, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Menglong Dong <menglong8.dong@gmail.com> Subject: [PATCH net-next v2 2/2] selftests/bpf: activate the OP_NE login in range_cond() Date: Tue, 12 Dec 2023 21:10:31 +0800 Message-Id: <20231212131031.3088661-3-menglong8.dong@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231212131031.3088661-1-menglong8.dong@gmail.com> References: <20231212131031.3088661-1-menglong8.dong@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Dec 2023 05:16:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785082117122844720 X-GMAIL-MSGID: 1785082117122844720 |
Series |
bpf: support to trace BPF_JNE
|
|
Commit Message
Menglong Dong
Dec. 12, 2023, 1:10 p.m. UTC
The edge range checking for the registers is supported by the verifier
now, so we can activate the extended login in
tools/testing/selftests/bpf/prog_tests/reg_bounds.c/range_cond() to test
such logic.
Signed-off-by: Menglong Dong <menglong8.dong@gmail.com>
---
tools/testing/selftests/bpf/prog_tests/reg_bounds.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
Comments
On Tue, 2023-12-12 at 21:10 +0800, Menglong Dong wrote: > The edge range checking for the registers is supported by the verifier > now, so we can activate the extended login in > tools/testing/selftests/bpf/prog_tests/reg_bounds.c/range_cond() to test > such logic. > > Signed-off-by: Menglong Dong <menglong8.dong@gmail.com> > --- > tools/testing/selftests/bpf/prog_tests/reg_bounds.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > index 0c9abd279e18..49d8d4bafe99 100644 > --- a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > +++ b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > @@ -590,12 +590,7 @@ static void range_cond(enum num_t t, struct range x, struct range y, > *newy = range(t, max_t(t, x.a, y.a), min_t(t, x.b, y.b)); > break; > case OP_NE: > - /* generic case, can't derive more information */ > - *newx = range(t, x.a, x.b); > - *newy = range(t, y.a, y.b); > - break; > - > - /* below extended logic is not supported by verifier just yet */ > + /* below logic is supported by the verifier now */ > if (x.a == x.b && x.a == y.a) { > /* X is a constant matching left side of Y */ > *newx = range(t, x.a, x.b); I think that some crafted tests have to be added. Note that reg_bounds only runs a subset of tests during CI (controlled by variable SLOW_TESTS). By default only randomized and crafted tests are run. It appears to me that probability of randomly generating specific ranges explored by this series is quite low.
Hello, On Wed, Dec 13, 2023 at 7:37 AM Eduard Zingerman <eddyz87@gmail.com> wrote: > > On Tue, 2023-12-12 at 21:10 +0800, Menglong Dong wrote: > > The edge range checking for the registers is supported by the verifier > > now, so we can activate the extended login in > > tools/testing/selftests/bpf/prog_tests/reg_bounds.c/range_cond() to test > > such logic. > > > > Signed-off-by: Menglong Dong <menglong8.dong@gmail.com> > > --- > > tools/testing/selftests/bpf/prog_tests/reg_bounds.c | 7 +------ > > 1 file changed, 1 insertion(+), 6 deletions(-) > > > > diff --git a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > > index 0c9abd279e18..49d8d4bafe99 100644 > > --- a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > > +++ b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > > @@ -590,12 +590,7 @@ static void range_cond(enum num_t t, struct range x, struct range y, > > *newy = range(t, max_t(t, x.a, y.a), min_t(t, x.b, y.b)); > > break; > > case OP_NE: > > - /* generic case, can't derive more information */ > > - *newx = range(t, x.a, x.b); > > - *newy = range(t, y.a, y.b); > > - break; > > - > > - /* below extended logic is not supported by verifier just yet */ > > + /* below logic is supported by the verifier now */ > > if (x.a == x.b && x.a == y.a) { > > /* X is a constant matching left side of Y */ > > *newx = range(t, x.a, x.b); > > I think that some crafted tests have to be added. > Note that reg_bounds only runs a subset of tests during CI > (controlled by variable SLOW_TESTS). > By default only randomized and crafted tests are run. > It appears to me that probability of randomly generating specific > ranges explored by this series is quite low. You are right, I'll add some cases to the "crafted_cases" for this logic. Thanks! Menglong Dong
diff --git a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c index 0c9abd279e18..49d8d4bafe99 100644 --- a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c +++ b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c @@ -590,12 +590,7 @@ static void range_cond(enum num_t t, struct range x, struct range y, *newy = range(t, max_t(t, x.a, y.a), min_t(t, x.b, y.b)); break; case OP_NE: - /* generic case, can't derive more information */ - *newx = range(t, x.a, x.b); - *newy = range(t, y.a, y.b); - break; - - /* below extended logic is not supported by verifier just yet */ + /* below logic is supported by the verifier now */ if (x.a == x.b && x.a == y.a) { /* X is a constant matching left side of Y */ *newx = range(t, x.a, x.b);