From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6547EA0C45; Thu, 16 Sep 2021 17:24:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E07A54069E; Thu, 16 Sep 2021 17:24:03 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id B9D1C40151 for ; Thu, 16 Sep 2021 17:24:01 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10109"; a="222245512" X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="222245512" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2021 08:24:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="509342133" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga008.fm.intel.com with ESMTP; 16 Sep 2021 08:24:00 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 16 Sep 2021 08:24:00 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 16 Sep 2021 08:23:59 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Thu, 16 Sep 2021 08:23:59 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Thu, 16 Sep 2021 08:23:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HxZilp7bxBCqNcu+cQLKA7UtbEyf2U2hqS16TwmsUXfpAZixzQChb4lpFrWOkbu+vnQt/SNCVnnbkZ7H/FX4hWODMm39SQ8YGsyX3d3Lahab3DGpZvnSdz3AQKy+nHanPbPhCUFLWYrGaC3V931NdC4o37RDqRFPpdPcrQ+SNkG1N9AGzLRju+PfA5S6L1n0du7O2wY5RtXSVvedsPXV1nJmCQc3layBSMn7u74oP7xen1NYk/x6UG2gDN2ObHavdRbF4k3whHIFgA/u4yEUxjqiJuinnehj/0J49Ty8BHGYsLnS9y4HvqYorozKXQ4WB6TUaU1jobjBrw7x9Ha69g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Xec69LmkXdsQcEJ0UcSWU2D2Z1RJy3or/9MqA4//STg=; b=B3umlBPGwXqYPveD2y+pMXJk7zCi/5Y7qPg50QjfJzQob5rvgqXKjddvsLxTTcVQ3wmBGSTwub+7wu5nnOz32vY4teBAdrbYbXqp51eY76wFGUl24aFHLN3EIusZQi9TDlbxaxaR4LljxuwtyqmvQv5j1vyIhUNXJ6LEoMIIXtF4EjjJGBRUlvmGfM7bwFL8ZE0A4T6Mq/xpJ37BDW1pY5IcxnOq4QAG3nfy8GsTfyoBmbz8gDT0OEPbDtFrubj+KwDcN2cu779WXVz2g23iTIuc/2ZM6Z1El6++Nbblxo44tLK3/LGZwQ9WE2zhhNduwmh3mgjNoSE29H+CKKlPfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xec69LmkXdsQcEJ0UcSWU2D2Z1RJy3or/9MqA4//STg=; b=OqFR+XJZddTS1L00kKUdlaACGHhtGW5NSe6Ev8u2og8of/L0cgQFWuHw8K6w2ESILGPVRQcf+d0dz2WUOcoNSqiUG4+bQ9WIQC1ftPkBPRy5nh+F6IZCrH/oh84pQ92McN9OnnEc0QeAUmUbQ6Kj3VR8gzAIIiNTPXgaG0SKg60= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM5PR11MB1753.namprd11.prod.outlook.com (2603:10b6:3:10d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Thu, 16 Sep 2021 15:23:58 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd%4]) with mapi id 15.20.4523.016; Thu, 16 Sep 2021 15:23:58 +0000 From: "Ananyev, Konstantin" To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [PATCH v9 03/12] bpf: allow self-xor operation Thread-Index: AQHXqo/UYFGrQfG7kk+chBtnILr3raumyHbQ Date: Thu, 16 Sep 2021 15:23:58 +0000 Message-ID: References: <20210903004732.109023-1-stephen@networkplumber.org> <20210916001416.39998-1-stephen@networkplumber.org> <20210916001416.39998-4-stephen@networkplumber.org> In-Reply-To: <20210916001416.39998-4-stephen@networkplumber.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: networkplumber.org; dkim=none (message not signed) header.d=none;networkplumber.org; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7e9e24cd-ec21-4984-0247-08d97926010d x-ms-traffictypediagnostic: DM5PR11MB1753: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UnHhSCzLqgCC+ngShpq6+Dzd48RkfOQNci6fQqAAm1Qtdt2PQRjnKINssFKx6mvEnthsJZeFkGwXbZc5IpRYlTyc2VEa7Esi74xm7bhKb/2u+9W5P2x+Cx0bmHDJGJDusaOnxHtweMumI0hUBKdq+CtU1Om3lpqJ32lk8HPo/bn4EsgrhjuuA9nun7S0BLkiOOO5YIjamMcxVDxqfFCWgZDpmr41fHxQR8W38VLA7kWhz7nel+kYShK9kuCvIK/JHcU24JBGXuRt6k304E8zkcT3gUrw1HnLfg+f4NoHaxHOHR18yKbj9XfC42Gb+NwXzjY1TIiGXUOPOjZRdM9Jqk6QyGmJgLBY+zZA2zN/aAew2saUk8lRg65kdC8P8Pe3zd3QUpIJTkmgyw9AXa3bpam60aGKaWegCG65B/6n6A1iOB9M2FWA1jon7qHd5fpok1lHC4B00N4WAkfz1ABQUP9CbRq4faUeeGtcMuvqCJAKZ/2DfyCL4jJ58UIPXPsxUSK6brb5Blj3AumRgUhWi6Q27wyuRgSTkDh1Jnwb+zlLIiO++ONPz+9PlX6lOTcXnAhhDubBwdj3VkX6u/fhCYONkgALhyRm0cn3I4aU1Yk4hvdyh7u9rcOD+hW5nTw53r9q2TCQPKvezwnp+pmR4kQlekRKBYlnSDnui+7goFP2sg235NI1tuKQv3aUAgifdWPSOR1b7pgxBb6ULn/0Yw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(396003)(346002)(366004)(136003)(376002)(83380400001)(38070700005)(110136005)(316002)(26005)(478600001)(8676002)(6506007)(38100700002)(5660300002)(52536014)(8936002)(64756008)(66476007)(66556008)(66446008)(122000001)(7696005)(66946007)(76116006)(86362001)(55236004)(186003)(2906002)(71200400001)(9686003)(33656002)(55016002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?BFvJ0MmX7f0781bS0Lub456bqzyGebVyU1cHyz7thApMQankpCbcjpRqH0jv?= =?us-ascii?Q?CEiR2uB+nx+kFEWcws7GlOZCq68nlstQUS4ERtlpx90t8hKy4zRPPECSvR7Q?= =?us-ascii?Q?bXKVWje2ydMlJrly1vrByXZCs44K8nstwPlxN6uWAj1gz1oI/ObLHgtzy5+b?= =?us-ascii?Q?QzJyPAk1j4CdR4mf8ekQTczKfYyrgpoup0iy1yUEDaWbLmcycOEkp5E5K2lo?= =?us-ascii?Q?yr3IXpzXZN90zTZ2xQU5Jq4jL61p/1qFLDb8Mk3+Ryiq25jaqyBA9Ts0HDMx?= =?us-ascii?Q?fMRiNHENvTmiO7EUI35waeISOD+WBerMjeBQdvBDAfT0exK79I+FL5p0Q3Df?= =?us-ascii?Q?T4RvgQy69Ji5z/H2N+D4XgwSXKhrnJHqOuWbw1Wsq33aUTHUE0McDhcCe9Dn?= =?us-ascii?Q?KBMdN5UyTHaImeFe3kObyJk0PX9oHO2/Dx0cbyrDlRYWhy6hjh/iVHzJB7e7?= =?us-ascii?Q?CLUAj9095zue9F/08pC+3JMO1e5zyUnpla66ws72J8p08rtlwVtmEW4ycg/l?= =?us-ascii?Q?Vwf5FlKUvn49EF6O0lYLR6ihZAotKNMhuJYwk+qmGMbe41qC3qRNeUvjuaQc?= =?us-ascii?Q?6M8HEydYSgS+EeaSabZpvnwkCy7P7lYuGEtt8Fy+16DZ8AJt1H8tfjORQ3p0?= =?us-ascii?Q?GhwqpZzLoCB0zo41ZVo3flcWYnMb1UAmLMgKtTe2yxEjDRD9C0uKnaW0jjE/?= =?us-ascii?Q?atBTCBcgLB8CCig+AsF3crHFB+I1jmo0tEsXPYUixLCneGGxtiyLCOxlDoXD?= =?us-ascii?Q?2ycN9ijvxZYZAlGqlPHzTsX23ITA7pQPJ+hsI+7AZoPKHTwSHSdCkPx6XEJI?= =?us-ascii?Q?Xf9/HQiLfk2zH11utWT4xhJugrkmpLcU4KYXRfvxIsCiHrzepY+WNQ37qEpX?= =?us-ascii?Q?yHx8uLWn/DeIeP+9wjqegk6dFcBoNrc4fvjwSoD78+hjSJ/vNwrJjMY3bctq?= =?us-ascii?Q?b9iP94ONYDRwAfSiIH1EV9MdxAZolbY6bRt93G39Z4Uo28mm2bzli0dh7E3T?= =?us-ascii?Q?qMkTwRsIrJakAkcSUvFSDAPoP5mmL05VWHB+WJO55IyvjyOlTm8OmoTlYm3q?= =?us-ascii?Q?hK4Ml0WyanpLM2wWfcv55UZNlKdzGYH5vZLwBmsylAXL5vlzZmWp6iMFTMxg?= =?us-ascii?Q?78er0BUlsly/3OQMNlBOgGEQ1uQyrsuhrY5ELgD9NXYhteS9gn1+rXSTN/8C?= =?us-ascii?Q?a/C0qJocN6JRpcD9Rl7+cv4R/GuCNSGze6NSl3WDVBKZSBS3qOzFeYdpVxVr?= =?us-ascii?Q?2HbUqJT5p9yUWsiqwgTMBWyyotgr1s6WoOLz/Coqc85UgyfmVZPbOM+2Rhkd?= =?us-ascii?Q?95GyYMep64d6Bsy2tDaWG+RI?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e9e24cd-ec21-4984-0247-08d97926010d X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Sep 2021 15:23:58.2514 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: tN+gIPedVEElRIlbPUWvqSJqau8s9yiRtsyF5tL3wVBEVAQNvvZ7ne3jAkOEw7VC4zRk7Iku/WbiFSXxwLUFX7OjwKmTSmZ9B9IJV+AwdDo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1753 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v9 03/12] bpf: allow self-xor operation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > Some BPF programs may use XOR of a register with itself > as a way to zero register in one instruction. > The BPF filter converter generates this in the prolog > to the generated code. >=20 > The BPF validator would not allow this because the value of > register was undefined. But after this operation it always zero. >=20 > Fixes: 8021917293d0 ("bpf: add extra validation for input BPF program") > Cc: konstantin.ananyev@intel.com > Signed-off-by: Stephen Hemminger > --- > lib/bpf/bpf_validate.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c > index 7b1291b382e9..853279fee557 100644 > --- a/lib/bpf/bpf_validate.c > +++ b/lib/bpf/bpf_validate.c > @@ -661,8 +661,15 @@ eval_alu(struct bpf_verifier *bvf, const struct ebpf= _insn *ins) >=20 > op =3D BPF_OP(ins->code); >=20 > + /* Allow self-xor as way to zero register */ > + if (op =3D=3D BPF_XOR && BPF_SRC(ins->code) =3D=3D BPF_X && > + ins->src_reg =3D=3D ins->dst_reg) { > + eval_fill_imm(&rs, UINT64_MAX, 0); > + eval_fill_imm(rd, UINT64_MAX, 0); > + } > + > err =3D eval_defined((op !=3D EBPF_MOV) ? rd : NULL, > - (op !=3D BPF_NEG) ? &rs : NULL); > + (op !=3D BPF_NEG) ? &rs : NULL); > if (err !=3D NULL) > return err; >=20 > -- Acked-by: Konstantin Ananyev > 2.30.2