From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mail.toke.dk (Postfix) with ESMTPS id 181AD9C50DC for ; Wed, 23 Nov 2022 15:24:32 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hfkHRm6u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669213471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+HXGpPooIMe6sNdUgSAzfW/8NtY/urg9PVU34CjlakY=; b=hfkHRm6ugsoM2dJR5KgI4JOVQWUhy/ugNhGOQD9NsCvfa5KAWKABbi7Nx32pnpbLaY5X6j 0Bpf4s+kziJN+M4kZtVqhj1oea2fRzh0HWLb9AxPcN/tRRWaukaDekQf3l1gl44Hv96bgd WWHpKcIV/z668xYVODPxE8PhQTBH+RI= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-99-T788PgkTNvK9r3Am2RNd4g-1; Wed, 23 Nov 2022 09:24:26 -0500 X-MC-Unique: T788PgkTNvK9r3Am2RNd4g-1 Received: by mail-ej1-f70.google.com with SMTP id ga41-20020a1709070c2900b007aef14e8fd7so10149416ejc.21 for ; Wed, 23 Nov 2022 06:24:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+HXGpPooIMe6sNdUgSAzfW/8NtY/urg9PVU34CjlakY=; b=Ob85kUAg8IeOB08JU5x/vWjV+6jFOI9vKaZnKhaGI49V7e9jjPZYzXR+YoNCsbzUbs uS9ObIgvVGXCXBGdpyjCNrkqb6+Hjr+rJX7Cl9fncbwxOPIfvJOshcXbZsIEfF7/IzPL xqXnN40FC4809H0l/cZpzsLwkAyveaAJRwugxfwBgCWESe1FamUgr10nrHx0xilNWvPT 7EkkPXgdu77PJ8fxgCIOTG6wS6vMkWan/p8yh83M614OQ4oPH928roU64eqRGiY+7ksh Hl25qyZf4rFIETxfOFkF4RnxZxhc5ejNeZN+p0uTb8cmS/N0u97FhGc6nqGyOKPYV+8b rgqg== X-Gm-Message-State: ANoB5pnW0v9O/8zPJUgw8DsZmhcqUuCttIHEca7aRg/6SGfvrsWI/9zE +PBpg4k+JRAYy7/kVfdWNjRaWR1/ifZqsXfZMvJq4eGKA3NxJJu7zNslFqH++BFg2Aqu7Hd+Unv JK2F0xHdZIH0iw++bkYYp X-Received: by 2002:a17:906:b749:b0:7b6:6e0a:17dd with SMTP id fx9-20020a170906b74900b007b66e0a17ddmr8326443ejb.590.1669213465273; Wed, 23 Nov 2022 06:24:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf4TlTtotUdHzjVrM8lE5ZJ5PpqfjRzrePg1TyOkbZEtVq8E4QPMbh+AfzYYZrhKKTyMbjQLbQ== X-Received: by 2002:a17:906:b749:b0:7b6:6e0a:17dd with SMTP id fx9-20020a170906b74900b007b66e0a17ddmr8326415ejb.590.1669213464920; Wed, 23 Nov 2022 06:24:24 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id ee47-20020a056402292f00b00468f7bb4895sm7369868edb.43.2022.11.23.06.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 06:24:24 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 81EF07D5114; Wed, 23 Nov 2022 15:24:23 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Stanislav Fomichev , bpf@vger.kernel.org In-Reply-To: <20221121182552.2152891-3-sdf@google.com> References: <20221121182552.2152891-1-sdf@google.com> <20221121182552.2152891-3-sdf@google.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Wed, 23 Nov 2022 15:24:23 +0100 Message-ID: <87a64hvje0.fsf@toke.dk> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Message-ID-Hash: 6AHSWU4KATV2DIQXP3DAVIQWW4VCLMVY X-Message-ID-Hash: 6AHSWU4KATV2DIQXP3DAVIQWW4VCLMVY X-MailFrom: toke@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v2 2/8] bpf: XDP metadata RX kfuncs List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: > static int fixup_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn, > struct bpf_insn *insn_buf, int insn_idx, int *cnt) > { > @@ -15181,6 +15200,15 @@ static int fixup_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn, > return -EINVAL; > } > > + if (resolve_prog_type(env->prog) == BPF_PROG_TYPE_XDP) { > + int imm = fixup_xdp_kfunc_call(env, insn->imm); > + > + if (imm) { > + insn->imm = imm; > + return 0; This needs to also set *cnt = 0 before returning; otherwise the verifier can do some really weird instruction rewriting that leads to the JIT barfing on invalid instructions (as I just found out while trying to test this). -Toke