From nobody Wed Sep 3 01:40:05 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBE77ECAAD5 for ; Fri, 2 Sep 2022 13:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237251AbiIBNfr (ORCPT ); Fri, 2 Sep 2022 09:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237195AbiIBNfF (ORCPT ); Fri, 2 Sep 2022 09:35:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7CC1BEBB; Fri, 2 Sep 2022 06:14:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F17D620F0; Fri, 2 Sep 2022 12:25:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34028C433C1; Fri, 2 Sep 2022 12:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662121536; bh=YEmcEhJq0gC3Xnkobi5cu7by8WhghkDbLfoLK2HmuWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdxkUKCeyugkyHwo7dRMU5VfISuVOCgis+xeFKSVGAKAwIEoLwdEIe8VPM3wu4F7t U1s//CU0GpLaJ9JDYZggqsZarxUf+AtyYTNX6jOFELWMK4tAOntrQ+aQBbNeXKgz5+ pebDxuNpoCrIic7+inJNQi3DnSrApO72M70zm0fA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Stanislav Fomichev , Daniel Borkmann , Ovidiu Panait Subject: [PATCH 4.19 40/56] selftests/bpf: Fix test_align verifier log patterns Date: Fri, 2 Sep 2022 14:19:00 +0200 Message-Id: <20220902121401.731270908@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121400.219861128@linuxfoundation.org> References: <20220902121400.219861128@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stanislav Fomichev commit 5366d2269139ba8eb6a906d73a0819947e3e4e0a upstream. Commit 294f2fc6da27 ("bpf: Verifer, adjust_scalar_min_max_vals to always call update_reg_bounds()") changed the way verifier logs some of its state, adjust the test_align accordingly. Where possible, I tried to not copy-paste the entire log line and resorted to dropping the last closing brace instead. Fixes: 294f2fc6da27 ("bpf: Verifer, adjust_scalar_min_max_vals to always ca= ll update_reg_bounds()") Signed-off-by: Stanislav Fomichev Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20200515194904.229296-1-sdf@google.com [OP: adjust for 4.19 selftests, apply only the relevant diffs] Signed-off-by: Ovidiu Panait Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/bpf/test_align.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) --- a/tools/testing/selftests/bpf/test_align.c +++ b/tools/testing/selftests/bpf/test_align.c @@ -359,15 +359,15 @@ static struct bpf_align_test tests[] =3D { * is still (4n), fixed offset is not changed. * Also, we create a new reg->id. */ - {29, "R5_w=3Dpkt(id=3D4,off=3D18,r=3D0,umax_value=3D2040,var_off=3D(0x0= ; 0x7fc))"}, + {29, "R5_w=3Dpkt(id=3D4,off=3D18,r=3D0,umax_value=3D2040,var_off=3D(0x0= ; 0x7fc)"}, /* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (18) * which is 20. Then the variable offset is (4n), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {33, "R4=3Dpkt(id=3D4,off=3D22,r=3D22,umax_value=3D2040,var_off=3D(0x0;= 0x7fc))"}, - {33, "R5=3Dpkt(id=3D4,off=3D18,r=3D22,umax_value=3D2040,var_off=3D(0x0;= 0x7fc))"}, + {33, "R4=3Dpkt(id=3D4,off=3D22,r=3D22,umax_value=3D2040,var_off=3D(0x0;= 0x7fc)"}, + {33, "R5=3Dpkt(id=3D4,off=3D18,r=3D22,umax_value=3D2040,var_off=3D(0x0;= 0x7fc)"}, }, }, { @@ -410,15 +410,15 @@ static struct bpf_align_test tests[] =3D { /* Adding 14 makes R6 be (4n+2) */ {9, "R6_w=3Dinv(id=3D0,umin_value=3D14,umax_value=3D1034,var_off=3D(0x2= ; 0x7fc))"}, /* Packet pointer has (4n+2) offset */ - {11, "R5_w=3Dpkt(id=3D1,off=3D0,r=3D0,umin_value=3D14,umax_value=3D1034= ,var_off=3D(0x2; 0x7fc))"}, - {13, "R4=3Dpkt(id=3D1,off=3D4,r=3D0,umin_value=3D14,umax_value=3D1034,v= ar_off=3D(0x2; 0x7fc))"}, + {11, "R5_w=3Dpkt(id=3D1,off=3D0,r=3D0,umin_value=3D14,umax_value=3D1034= ,var_off=3D(0x2; 0x7fc)"}, + {13, "R4=3Dpkt(id=3D1,off=3D4,r=3D0,umin_value=3D14,umax_value=3D1034,v= ar_off=3D(0x2; 0x7fc)"}, /* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {15, "R5=3Dpkt(id=3D1,off=3D0,r=3D4,umin_value=3D14,umax_value=3D1034,v= ar_off=3D(0x2; 0x7fc))"}, + {15, "R5=3Dpkt(id=3D1,off=3D0,r=3D4,umin_value=3D14,umax_value=3D1034,v= ar_off=3D(0x2; 0x7fc)"}, /* Newly read value in R6 was shifted left by 2, so has * known alignment of 4. */ @@ -426,15 +426,15 @@ static struct bpf_align_test tests[] =3D { /* Added (4n) to packet pointer's (4n+2) var_off, giving * another (4n+2). */ - {19, "R5_w=3Dpkt(id=3D2,off=3D0,r=3D0,umin_value=3D14,umax_value=3D2054= ,var_off=3D(0x2; 0xffc))"}, - {21, "R4=3Dpkt(id=3D2,off=3D4,r=3D0,umin_value=3D14,umax_value=3D2054,v= ar_off=3D(0x2; 0xffc))"}, + {19, "R5_w=3Dpkt(id=3D2,off=3D0,r=3D0,umin_value=3D14,umax_value=3D2054= ,var_off=3D(0x2; 0xffc)"}, + {21, "R4=3Dpkt(id=3D2,off=3D4,r=3D0,umin_value=3D14,umax_value=3D2054,v= ar_off=3D(0x2; 0xffc)"}, /* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (0) * which is 2. Then the variable offset is (4n+2), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {23, "R5=3Dpkt(id=3D2,off=3D0,r=3D4,umin_value=3D14,umax_value=3D2054,v= ar_off=3D(0x2; 0xffc))"}, + {23, "R5=3Dpkt(id=3D2,off=3D0,r=3D4,umin_value=3D14,umax_value=3D2054,v= ar_off=3D(0x2; 0xffc)"}, }, }, { @@ -469,11 +469,11 @@ static struct bpf_align_test tests[] =3D { .matches =3D { {4, "R5_w=3Dpkt_end(id=3D0,off=3D0,imm=3D0)"}, /* (ptr - ptr) << 2 =3D=3D unknown, (4n) */ - {6, "R5_w=3Dinv(id=3D0,smax_value=3D9223372036854775804,umax_value=3D18= 446744073709551612,var_off=3D(0x0; 0xfffffffffffffffc))"}, + {6, "R5_w=3Dinv(id=3D0,smax_value=3D9223372036854775804,umax_value=3D18= 446744073709551612,var_off=3D(0x0; 0xfffffffffffffffc)"}, /* (4n) + 14 =3D=3D (4n+2). We blow our bounds, because * the add could overflow. */ - {7, "R5=3Dinv(id=3D0,var_off=3D(0x2; 0xfffffffffffffffc))"}, + {7, "R5=3Dinv(id=3D0,smin_value=3D-9223372036854775806,smax_value=3D922= 3372036854775806,umin_value=3D2,umax_value=3D18446744073709551614,var_off= =3D(0x2; 0xfffffffffffffffc)"}, /* Checked s>=3D0 */ {9, "R5=3Dinv(id=3D0,umin_value=3D2,umax_value=3D9223372036854775806,va= r_off=3D(0x2; 0x7ffffffffffffffc))"}, /* packet pointer + nonnegative (4n+2) */ @@ -528,7 +528,7 @@ static struct bpf_align_test tests[] =3D { /* New unknown value in R7 is (4n) */ {11, "R7_w=3Dinv(id=3D0,umax_value=3D1020,var_off=3D(0x0; 0x3fc))"}, /* Subtracting it from R6 blows our unsigned bounds */ - {12, "R6=3Dinv(id=3D0,smin_value=3D-1006,smax_value=3D1034,var_off=3D(0= x2; 0xfffffffffffffffc))"}, + {12, "R6=3Dinv(id=3D0,smin_value=3D-1006,smax_value=3D1034,umin_value= =3D2,umax_value=3D18446744073709551614,var_off=3D(0x2; 0xfffffffffffffffc)"= }, /* Checked s>=3D 0 */ {14, "R6=3Dinv(id=3D0,umin_value=3D2,umax_value=3D1034,var_off=3D(0x2; = 0x7fc))"}, /* At the time the word size load is performed from R5, @@ -537,7 +537,8 @@ static struct bpf_align_test tests[] =3D { * the total offset is 4-byte aligned and meets the * load's requirements. */ - {20, "R5=3Dpkt(id=3D1,off=3D0,r=3D4,umin_value=3D2,umax_value=3D1034,va= r_off=3D(0x2; 0x7fc))"}, + {20, "R5=3Dpkt(id=3D1,off=3D0,r=3D4,umin_value=3D2,umax_value=3D1034,va= r_off=3D(0x2; 0x7fc)"}, + }, }, {