Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5794809rdb; Wed, 13 Dec 2023 22:29:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbn0CKlAw1k2K8bcH1FZYKHEkz4/RjaWhf6zWHLZKZSmVXL04X+aBPnOTvYjCuQUM8Cm+H X-Received: by 2002:a05:6e02:180c:b0:35f:754d:fed0 with SMTP id a12-20020a056e02180c00b0035f754dfed0mr3181699ilv.37.1702535347944; Wed, 13 Dec 2023 22:29:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702535347; cv=none; d=google.com; s=arc-20160816; b=IKjQ/HPxhuX3Ite4JpyCuy8caCiOEuJBLR7btg91GkhnMQVo6TcoLtCTFvyDenk4j/ uX7eAJ0b6hZehN0AYoCAoCZo7IO1rVdof3jnwz+2tmxzsMpyFD8Pe+LOSw1uo0kI28j0 m2pr5t/mcwUbs9STm+i0lCgzoXSC141QFdTDFZR8G4FkQ53LZtk7RoBPCSf8kxlGrokb 9lgCKyQ7n8cYCWDdz7XIBdxdEd4yOsimwYtQ046xfTPME82e+r4dJxNzV5zjzG09/sOk hl1/b6+H+Q2iJwM3LdHj71EXXm2dcDfIFJV4qLu3X0t5+GWWRGxqW6ReH5fOJMmf3203 YnNQ== 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=lsGm+j7nwlGOQcDgyTd4xbThNMw0KWzAWGGOI0U9NQE=; fh=rPJbZScTIF17zj42fTggn0VkysdYB+Rmhzv8OjYTIeQ=; b=0cCa5+O9ZxH01V4hQkeNpvHAEj8FFL8IHAsVWNJDlmQ1YLQsj2Y0j+HrP5moLq3qo+ yCQsqi2uMCPu+rC394Qy8tHYrKKHrxwUqSz/AE1S1taaoOQYlH0Czl+CxZ5ohQFQmPBK wTDEXbeH4x50laJbRcPW4rhht9OOXZkkrqrZ5GnLPaTKttN0V6rvuEoEEP8bRsPFJd38 YBcJP1ROLzJ3FN5UN/7LbUpOh5Y95rcX1KI9lwgFggMCrPFRxpgCgjM9tX8JgdAZ/opH qLiXYeGHr85DBqekHM8HOkBrLQV2E+lzqDHTLf3yKJxVufdcmLO/oM/lYN25IllPlPRu spXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ajXqj6/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id b7-20020a63eb47000000b005c65fcca231si10612223pgk.18.2023.12.13.22.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 22:29:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ajXqj6/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 4FC7382D7565; Wed, 13 Dec 2023 22:29:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234272AbjLNG2l (ORCPT + 99 others); Thu, 14 Dec 2023 01:28:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234298AbjLNG2j (ORCPT ); Thu, 14 Dec 2023 01:28:39 -0500 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F1D4F4; Wed, 13 Dec 2023 22:28:46 -0800 (PST) Received: by mail-io1-xd42.google.com with SMTP id ca18e2360f4ac-7b45ab9e084so325200139f.2; Wed, 13 Dec 2023 22:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702535325; x=1703140125; 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=lsGm+j7nwlGOQcDgyTd4xbThNMw0KWzAWGGOI0U9NQE=; b=ajXqj6/eyuXW9Yvdyq1mzAlxNtyZ+Oq1xYBRrLe5mITwB3lO7mEWxLiaGqNTNyIVj+ T0eng5GwntVkJpNrM5InQMkmKE0SQrL4754u8NLuqIrDNOn+uuGB2KVbZSQqhcn2dkce CJRyRtAxCxxuIrRbbZUWBMdh0mrvdwpSHu5SIFvP/SVOCmz3mTNOna5ufuF3n2kVn+Q0 Lzbm+K/S7ZCdBqgF6apWMt7zC6w462qwBHHP7OW/KmbrSPphQyiIwslZF1OCgI738zxm N6TuvDd4uPNG3c6vmZqHfUKT7GgpiLoson7BVAxcvX/ljjgPHJuLW26cUfatKup3nR0t aukQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702535325; x=1703140125; 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=lsGm+j7nwlGOQcDgyTd4xbThNMw0KWzAWGGOI0U9NQE=; b=o4tMOSK0DVdKkboRAHDODeBiFjcl5o2jYpr8m0WN8gZLOv1TdlYpVF5rsnJy1DHpnJ /wiu69b5oiHW8rQ76fuE0XEqsjv4phmvcRYneQa5wyvb8KdAK08KZZ+UEVw7KbK697Ek WMfObou4Qj18FoyruWTdwz2ApznLythmFnHUSQ+ZyBBwRib2dYkc/H+IsbFZAzFOOEy9 ecE4HZJ6OZ81J+JlBgA9sLnH/+sF0yvrDk2TVSva23xWw8GN9G/BOYCeHj9PoSV22Kp9 IJZ0env/jkujnL/3tBzCLgfslimalVC7nQwYuz0ngTP2uqdgt382xv5h20Dy7+r6n2x/ XSuw== X-Gm-Message-State: AOJu0YyL5HYXcLBRG5ScM2OP/6p6EZDi9sEdXgO8hk8fVxEqJqfiRXhR gx1Qo9y6DXUJBx25zMlEha0= X-Received: by 2002:a05:6e02:1a44:b0:35d:59a2:332b with SMTP id u4-20020a056e021a4400b0035d59a2332bmr13251059ilv.47.1702535325386; Wed, 13 Dec 2023 22:28:45 -0800 (PST) Received: from localhost.localdomain ([43.129.244.20]) by smtp.gmail.com with ESMTPSA id z7-20020a63e107000000b005af08f65227sm10744770pgh.80.2023.12.13.22.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 22:28:45 -0800 (PST) From: Menglong Dong To: andrii@kernel.org, eddyz87@gmail.com, 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 Subject: [PATCH bpf-next v3 2/2] selftests/bpf: activate the OP_NE login in range_cond() Date: Thu, 14 Dec 2023 14:24:34 +0800 Message-Id: <20231214062434.3565630-3-menglong8.dong@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231214062434.3565630-1-menglong8.dong@gmail.com> References: <20231214062434.3565630-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 howler.vger.email 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 (howler.vger.email [0.0.0.0]); Wed, 13 Dec 2023 22:29:05 -0800 (PST) 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. Besides, I added some cases to the "crafted_cases" array for this logic. These cases are mainly used to test the edge of the src reg and dst reg. Signed-off-by: Menglong Dong --- v2: - add some cases to the "crafted_cases" --- .../selftests/bpf/prog_tests/reg_bounds.c | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 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..53b8711cfd2d 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); @@ -2101,6 +2096,24 @@ static struct subtest_case crafted_cases[] = { {S32, S64, {(u32)(s32)S32_MIN, (u32)(s32)-255}, {(u32)(s32)-2, 0}}, {S32, S64, {0, 1}, {(u32)(s32)S32_MIN, (u32)(s32)S32_MIN}}, {S32, U32, {(u32)(s32)S32_MIN, (u32)(s32)S32_MIN}, {(u32)(s32)S32_MIN, (u32)(s32)S32_MIN}}, + + /* edge overlap testings for BPF_NE */ + {U64, U64, {1, 1}, {1, 0x80000000}}, + {U64, S64, {1, 1}, {1, 0x80000000}}, + {U64, U32, {1, 1}, {1, 0x80000000}}, + {U64, S32, {1, 1}, {1, 0x80000000}}, + {U64, U64, {0x80000000, 0x80000000}, {1, 0x80000000}}, + {U64, S64, {0x80000000, 0x80000000}, {1, 0x80000000}}, + {U64, U32, {0x80000000, 0x80000000}, {1, 0x80000000}}, + {U64, S32, {0x80000000, 0x80000000}, {1, 0x80000000}}, + {U64, U64, {1, 0x80000000}, {1, 1}}, + {U64, S64, {1, 0x80000000}, {1, 1}}, + {U64, U32, {1, 0x80000000}, {1, 1}}, + {U64, S32, {1, 0x80000000}, {1, 1}}, + {U64, U64, {1, 0x80000000}, {0x80000000, 0x80000000}}, + {U64, S64, {1, 0x80000000}, {0x80000000, 0x80000000}}, + {U64, U32, {1, 0x80000000}, {0x80000000, 0x80000000}}, + {U64, S32, {1, 0x80000000}, {0x80000000, 0x80000000}}, }; /* Go over crafted hard-coded cases. This is fast, so we do it as part of -- 2.39.2