From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by mail.toke.dk (Postfix) with ESMTPS id D8B019C52B3 for ; Wed, 23 Nov 2022 19:43:28 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=ZSB9LJVj Received: by mail-oi1-x236.google.com with SMTP id e205so19932231oif.11 for ; Wed, 23 Nov 2022 10:43:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7Irgo3YjKXzoeD31Az+GVGwZOn12NdR2LQJ0FUiLokw=; b=ZSB9LJVj4rfiHsPpPOayipyYq29mmRQDF5rr0RqYa2oq3KzQxLsBdtzlpVaGZ1hmaa i9kKbgFg/RdbDib3k6NQst5uRRoHDJPZeZRV1n7y8pGe1YLIKDRKjXSJV8jKUpvKCq7b yv4NH2mBtfrDvknBMa1rbcMF6qx3U1RDuJKpc+pzydUCqYHzbRp6qmPC1G1In1kj8eme X9ObmmkI75VjD8aFFhur0ArCwGfsKmYcf5HK0YUE8N5acqdrf59lwY5j35ZTor0/3/ao wQ7+e28doqOyH3f8cZgRD9FaZRFUpkGjDmTj5X254kD2Cz5otlA/9S990V+Snl2KyvJR 8BeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7Irgo3YjKXzoeD31Az+GVGwZOn12NdR2LQJ0FUiLokw=; b=tHjABKOckPsi/rVMU63z5KFMwvT4IJaRovuE9TQ8t1TCZYodea7pNWAr9ZRC2tyiIC 0xQtopEuTx5j6dbM0Euac3qXxlrDgPH9TFluVgfKNQt12QoY0gmnha90AnbymFMXwNEA OoUnrAR6janFC5aKP+8ZghsuSHAcpUJPWXwqsja9WJJC96u/fztCSWZZon2BLbbKB/yc nBWPybboybvGCZ8hT0rVWzAiHT4o5NtivT3yy4dW0aNRPv/mT/CZLCQLcIzHdI8PtkP/ Fs7HuU3SqKBxjQ3edi8uHuutpuhjIVszYMqp29Wd5JNJ2XoD3dGNRtcu1k0+yrJV4v1m eRVw== X-Gm-Message-State: ANoB5pkeZd+Kc5ffkTiPhEkYRSul2FfLO4OJ2LpZ/QMroXFmcWFs6oTk vroZLiGVWfhXUhDWft40vgizMTbotq/2mFdfnWGFNQ== X-Google-Smtp-Source: AA0mqf5ItMcroMxXTwrst2RomLCDDcyBnhT32jbFeF4Um49IzchyNfvbVdUyw3x+FIEEGVjePAqgvYqbQJc/QXE3ztk= X-Received: by 2002:a05:6808:f09:b0:354:8922:4a1a with SMTP id m9-20020a0568080f0900b0035489224a1amr4538359oiw.181.1669229006872; Wed, 23 Nov 2022 10:43:26 -0800 (PST) MIME-Version: 1.0 References: <20221121182552.2152891-1-sdf@google.com> <20221121182552.2152891-3-sdf@google.com> <87a64hvje0.fsf@toke.dk> In-Reply-To: <87a64hvje0.fsf@toke.dk> From: Stanislav Fomichev Date: Wed, 23 Nov 2022 10:43:16 -0800 Message-ID: To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4B7LD4NDC4JQCFTSF2BQ4GQW5TNKKKLF X-Message-ID-Hash: 4B7LD4NDC4JQCFTSF2BQ4GQW5TNKKKLF X-MailFrom: sdf@google.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: bpf@vger.kernel.org, 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, 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: On Wed, Nov 23, 2022 at 6:24 AM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > > static int fixup_kfunc_call(struct bpf_verifier_env *env, struct bpf_i= nsn *insn, > > struct bpf_insn *insn_buf, int insn_idx, int = *cnt) > > { > > @@ -15181,6 +15200,15 @@ static int fixup_kfunc_call(struct bpf_verifie= r_env *env, struct bpf_insn *insn, > > return -EINVAL; > > } > > > > + if (resolve_prog_type(env->prog) =3D=3D BPF_PROG_TYPE_XDP) { > > + int imm =3D fixup_xdp_kfunc_call(env, insn->imm); > > + > > + if (imm) { > > + insn->imm =3D imm; > > + return 0; > > This needs to also set *cnt =3D 0 before returning; otherwise the verifie= r > 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). Oops, that was me not paying too much attention during the merge.. Yonghong actually did some kfunc unrolling, yay :-)