From patchwork Tue Sep 12 22:46:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puranjay Mohan X-Patchwork-Id: 13382267 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 27134EE49B7 for ; Tue, 12 Sep 2023 22:47:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237815AbjILWrE (ORCPT ); Tue, 12 Sep 2023 18:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237813AbjILWrD (ORCPT ); Tue, 12 Sep 2023 18:47:03 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F4510EF; Tue, 12 Sep 2023 15:46:59 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-403012f27e1so42464965e9.1; Tue, 12 Sep 2023 15:46:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694558817; x=1695163617; 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=Vapbmpx4kHHnDeZPSymjWm+kxhmkjrMGYPDoYN863/0=; b=KvwGakzvA8fZIvgUYktGJpztbNfYPIIkemd9w75oQY9amw3HurQ4ojrzlyKVkgytH6 wN/I9Xls1IogYeV2Gzmjyy99uBC8gycwmzmzd5ZUey1pAjmvM6r1mlQ7VHTDY/O7t1Go 9RAh6BYAZR041009d3mspkjKXt3FI68FWzdkIDjJLNImRXILAjYtvMFrLOJ2bw9TY8w8 8FloAVbQy8+Zho+4DOQv2YsNCTPo1bFW5k24DD9K87EhyEf5XWyU6k5sCBhGpuwfyD8F +UkyJAJF9RXoXHhXwng3HuX2AoGbnSzbEFC766Mziexjn5Rr6ECjAoDhqppBGqBu3b6/ MScQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694558817; x=1695163617; 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=Vapbmpx4kHHnDeZPSymjWm+kxhmkjrMGYPDoYN863/0=; b=E6kZPQleAdzqVX4UPLHtNBIrdAcvC2oxwqRHbRNMfbVTR+Htj5oAcU4tWUqedMgJTq fas0tpW/sqsgeX+0hdkXxjp5wWS68/F/7AJGGptVJw1AuSbs9uokyyZIAHbi85bJP4AH +1ijKm9e88Pvj8FGf+JZQCGRtYk6UyRwiaYcjGk6WCCW2sZ2SReTGDnywCcAU4P0JZMO EP2AJWxMTCLwer6D7wLZjZZq0VeudTqEUefjjdy45jPN+EmAIbtzUNbKj2UTEenQnkQ7 dBKuq6J7Ou+2BRrNqFNCEzDbpDgvhSCjqWx2IBl3AGpPkO6U4amkpLiw1GINV/Y3D7Z1 PIpA== X-Gm-Message-State: AOJu0YzLTFNo7a+K71gCqcV+/9gg2vAKt2mE7n38VyXvE20kaCdSSg7K q05wIgUNA34BCEvrYvQLh9E= X-Google-Smtp-Source: AGHT+IGYaSde42//e2zWhzE0pBMJ3eH7x1xRhsn/tGbjooCPwkOeTE3BOytCJBgEeqN+vRwsYu0ZSg== X-Received: by 2002:adf:f302:0:b0:317:ddd3:1aed with SMTP id i2-20020adff302000000b00317ddd31aedmr616529wro.68.1694558817139; Tue, 12 Sep 2023 15:46:57 -0700 (PDT) Received: from ip-172-31-30-46.eu-west-1.compute.internal (ec2-34-242-166-189.eu-west-1.compute.amazonaws.com. [34.242.166.189]) by smtp.gmail.com with ESMTPSA id e15-20020a5d594f000000b00317df42e91dsm13921794wri.4.2023.09.12.15.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 15:46:56 -0700 (PDT) From: Puranjay Mohan To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shubham Bansal , Russell King , "James E.J. Bottomley" , Helge Deller , "Naveen N. Rao" , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Luke Nelson , Xi Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Wang YanQing , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: puranjay12@gmail.com Subject: [PATCH bpf-next 1/6] bpf, riscv32: Always zero extend for LDX with B/W/H Date: Tue, 12 Sep 2023 22:46:49 +0000 Message-Id: <20230912224654.6556-2-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230912224654.6556-1-puranjay12@gmail.com> References: <20230912224654.6556-1-puranjay12@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org The JITs should not depend on the verifier for zero extending the upper 32 bits of the destination register when loading a byte, half-word, or word. A following patch will make the verifier stop patching zext instructions after LDX. Signed-off-by: Puranjay Mohan --- arch/riscv/net/bpf_jit_comp32.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/riscv/net/bpf_jit_comp32.c b/arch/riscv/net/bpf_jit_comp32.c index 529a83b85c1c..8f8255519ba1 100644 --- a/arch/riscv/net/bpf_jit_comp32.c +++ b/arch/riscv/net/bpf_jit_comp32.c @@ -847,18 +847,15 @@ static int emit_load_r64(const s8 *dst, const s8 *src, s16 off, switch (size) { case BPF_B: emit(rv_lbu(lo(rd), 0, RV_REG_T0), ctx); - if (!ctx->prog->aux->verifier_zext) - emit(rv_addi(hi(rd), RV_REG_ZERO, 0), ctx); + emit(rv_addi(hi(rd), RV_REG_ZERO, 0), ctx); break; case BPF_H: emit(rv_lhu(lo(rd), 0, RV_REG_T0), ctx); - if (!ctx->prog->aux->verifier_zext) - emit(rv_addi(hi(rd), RV_REG_ZERO, 0), ctx); + emit(rv_addi(hi(rd), RV_REG_ZERO, 0), ctx); break; case BPF_W: emit(rv_lw(lo(rd), 0, RV_REG_T0), ctx); - if (!ctx->prog->aux->verifier_zext) - emit(rv_addi(hi(rd), RV_REG_ZERO, 0), ctx); + emit(rv_addi(hi(rd), RV_REG_ZERO, 0), ctx); break; case BPF_DW: emit(rv_lw(lo(rd), 0, RV_REG_T0), ctx); From patchwork Tue Sep 12 22:46:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puranjay Mohan X-Patchwork-Id: 13382268 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 C5881EE3F39 for ; Tue, 12 Sep 2023 22:47:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237832AbjILWrI (ORCPT ); Tue, 12 Sep 2023 18:47:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237811AbjILWrE (ORCPT ); Tue, 12 Sep 2023 18:47:04 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 278DA10EB; Tue, 12 Sep 2023 15:47:00 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-31aec0a1a8bso205520f8f.0; Tue, 12 Sep 2023 15:47:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694558818; x=1695163618; 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=sT29HscYryKGVaLS4ITmGogx99J9Puoxilk7JdApwLE=; b=bwB5e18CqTc89LsjuJwxjDmt+aK1qXTSzO/IfsJFcHHFm99ufKgkx1qLse08YVt2EM +yS2Sdz4oyvxwzEDMeSuU3LKmhEHeVA6qEHfFFMB2dbtSpaGl8/Q8p+n3KEdFhxYB7m1 gRGLK2zLEM+w0wSl3nOxp2PlgGZmPftv9maovSn1OSflD+9kjp0CtiHgR4QIDq97Z7g9 B7fuZ3YPZ3rmTUX1B9wshXzI8J3DzHXxNBthDb4B3ncgagEbdYt1VD+zuujIpq0Xhtfe DeLrSx5tL5OeEozFNjoZYXteI5bC9Y9nC9ha12WjY91xOIzjXq959vzmVsy8dJ6gMLTC M1zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694558818; x=1695163618; 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=sT29HscYryKGVaLS4ITmGogx99J9Puoxilk7JdApwLE=; b=tES/UnK7u1pq+cDf2/+eD52aICP352rjjLfkXNOi/vBy2HZ+Bf4WKVVoRUSCx9fZh+ lNw2/94EvyjX6S03FhydVbSxo+63mYQgQoFehHQ0HyV+UN9iVc81WpQhwVO0AT/H544w jf2F8holtlcq0WEClUd7yXymt+MwXWigtA9GWHs3Ti+d1pbfKEJwyXVBvvOQ1SgStAL7 kbSVdOQHvxJY0mtZFf0sdhMNxOVHobeRb3cLztLs9fSeP01a8m/nLPN+lRqQpcpf+GV5 3DHwRC3Jb5UqS1OEY9eCiTCQhDfEorb0T8TMCsfRhZJ345TyZtnDh1wgi/GsUy3QmmBR hdBg== X-Gm-Message-State: AOJu0YxcVvOw8fPjBzNvVAg71R7n1aYpDR1B9g2bUdUeVjWeXGNZupdU 7l396FuaXYQFGSQxwmKdJbU= X-Google-Smtp-Source: AGHT+IGmXcseiJIR5TJ93E0zDMbc0daNf/KmJUUYoyIE/Gf3HMcwKKCMLML9MVROQedqC+pALyVq0A== X-Received: by 2002:adf:dc85:0:b0:319:5234:5c92 with SMTP id r5-20020adfdc85000000b0031952345c92mr596882wrj.35.1694558818289; Tue, 12 Sep 2023 15:46:58 -0700 (PDT) Received: from ip-172-31-30-46.eu-west-1.compute.internal (ec2-34-242-166-189.eu-west-1.compute.amazonaws.com. [34.242.166.189]) by smtp.gmail.com with ESMTPSA id e15-20020a5d594f000000b00317df42e91dsm13921794wri.4.2023.09.12.15.46.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 15:46:58 -0700 (PDT) From: Puranjay Mohan To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shubham Bansal , Russell King , "James E.J. Bottomley" , Helge Deller , "Naveen N. Rao" , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Luke Nelson , Xi Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Wang YanQing , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: puranjay12@gmail.com Subject: [PATCH bpf-next 2/6] bpf, x86-32: Always zero extend for LDX with B/W/H Date: Tue, 12 Sep 2023 22:46:50 +0000 Message-Id: <20230912224654.6556-3-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230912224654.6556-1-puranjay12@gmail.com> References: <20230912224654.6556-1-puranjay12@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org The JITs should not depend on the verifier for zero extending the upper 32 bits of the destination register when loading a byte, half-word, or word. A following patch will make the verifier stop patching zext instructions after LDX. Signed-off-by: Puranjay Mohan --- arch/x86/net/bpf_jit_comp32.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c index 429a89c5468b..aef9183ff107 100644 --- a/arch/x86/net/bpf_jit_comp32.c +++ b/arch/x86/net/bpf_jit_comp32.c @@ -2050,8 +2050,6 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, case BPF_B: case BPF_H: case BPF_W: - if (bpf_prog->aux->verifier_zext) - break; if (dstk) { EMIT3(0xC7, add_1reg(0x40, IA32_EBP), STACK_VAR(dst_hi)); From patchwork Tue Sep 12 22:46:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puranjay Mohan X-Patchwork-Id: 13382269 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 2E606EE49A4 for ; Tue, 12 Sep 2023 22:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237831AbjILWrJ (ORCPT ); Tue, 12 Sep 2023 18:47:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237823AbjILWrF (ORCPT ); Tue, 12 Sep 2023 18:47:05 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C2D110EF; Tue, 12 Sep 2023 15:47:01 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-401d2e11dacso2002075e9.0; Tue, 12 Sep 2023 15:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694558819; x=1695163619; 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=Oda7cl9iVFTkbJ1PzPqgjhpi/bhkWFnkRBdUJ5tFX88=; b=A0LVimUD4sN1eWovAba0UeemlTHr1Tuq8rUcEuOVdN+tR5d+coPDvMOgJuYjAVdAbm avOUEh23dyVcHfqdeSBjvJTKhFmZFgiugM9sqBLZBwJG+ZOnfvraKpFL0C3cYjYg2tEL qMpZwX3ctidI0VSQqWpvDjgqo0MSpWHPjFEPuodaQM5kMAnGpdgqRPB+ZqmKOia9e0ii TXYNMWsfZkJtWi+2CuC04+WV9sSx/S6GayCx5Fv1AN4qqtsTw3PMv5RfBTakinDHFY9n hmzLMj9nHVfFzXPSD7ZC0zG15ojRpc08f4YQRTeCbXLT5YNUbU9j7PcKAetzp7L/3Iwd O9oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694558819; x=1695163619; 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=Oda7cl9iVFTkbJ1PzPqgjhpi/bhkWFnkRBdUJ5tFX88=; b=s0u6rqHSHPpYXWXhIJZmwZRnCB13K7KHk/fbYbwLr0LOt9rtV28XR51h/iVp5d50Vj lAsY/LzFHTQnm76WjR0OMOdiGnP9Z9KPz1f+pz2Wc0Cl14n9SdhtnXll/4AQZOjwN2x1 elauW8Oljcp1tGa1MVVnqCGQ232eHK9EsLcMy8OCYkP+wmCDhvw9aERncTG/mBlTSoOM XRz+OXxlB+rbZjR9GAtm2/+tGQDdTR2x3hW6LWimXjax/gckmT9BAfS+nTyw56qt8X9Y HENeTx3sUaaxACpmV6BXv3fGqdOO3grdu16cKYKG+9V+X3uShjEJPPSPM46dCbHhKLZy 8jlA== X-Gm-Message-State: AOJu0YydvsWexjX2w1nZYxvqVo33RHAu7LG5VB6RM0+ysdh8XhopvPay 9znvVgCmscqNDk1diXEy6po= X-Google-Smtp-Source: AGHT+IHcd9xLp1ws84Is5QLcU4SiUEHRnEtZ9HHHFgMinXaJVjwni/sneatzZERdYAHhMylr9POa6g== X-Received: by 2002:a5d:484a:0:b0:31a:cca0:2f3a with SMTP id n10-20020a5d484a000000b0031acca02f3amr3150339wrs.0.1694558819326; Tue, 12 Sep 2023 15:46:59 -0700 (PDT) Received: from ip-172-31-30-46.eu-west-1.compute.internal (ec2-34-242-166-189.eu-west-1.compute.amazonaws.com. [34.242.166.189]) by smtp.gmail.com with ESMTPSA id e15-20020a5d594f000000b00317df42e91dsm13921794wri.4.2023.09.12.15.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 15:46:59 -0700 (PDT) From: Puranjay Mohan To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shubham Bansal , Russell King , "James E.J. Bottomley" , Helge Deller , "Naveen N. Rao" , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Luke Nelson , Xi Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Wang YanQing , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: puranjay12@gmail.com Subject: [PATCH bpf-next 3/6] bpf, parisc32: Always zero extend for LDX with B/W/H Date: Tue, 12 Sep 2023 22:46:51 +0000 Message-Id: <20230912224654.6556-4-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230912224654.6556-1-puranjay12@gmail.com> References: <20230912224654.6556-1-puranjay12@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org The JITs should not depend on the verifier for zero extending the upper 32 bits of the destination register when loading a byte, half-word, or word. A following patch will make the verifier stop patching zext instructions after LDX. Signed-off-by: Puranjay Mohan --- arch/parisc/net/bpf_jit_comp32.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/parisc/net/bpf_jit_comp32.c b/arch/parisc/net/bpf_jit_comp32.c index 5ff0cf925fe9..cc3972d6c971 100644 --- a/arch/parisc/net/bpf_jit_comp32.c +++ b/arch/parisc/net/bpf_jit_comp32.c @@ -1026,18 +1026,15 @@ static int emit_load_r64(const s8 *dst, const s8 *src, s16 off, switch (size) { case BPF_B: emit(hppa_ldb(off + 0, srcreg, lo(rd)), ctx); - if (!ctx->prog->aux->verifier_zext) - emit_hppa_copy(HPPA_REG_ZERO, hi(rd), ctx); + emit_hppa_copy(HPPA_REG_ZERO, hi(rd), ctx); break; case BPF_H: emit(hppa_ldh(off + 0, srcreg, lo(rd)), ctx); - if (!ctx->prog->aux->verifier_zext) - emit_hppa_copy(HPPA_REG_ZERO, hi(rd), ctx); + emit_hppa_copy(HPPA_REG_ZERO, hi(rd), ctx); break; case BPF_W: emit(hppa_ldw(off + 0, srcreg, lo(rd)), ctx); - if (!ctx->prog->aux->verifier_zext) - emit_hppa_copy(HPPA_REG_ZERO, hi(rd), ctx); + emit_hppa_copy(HPPA_REG_ZERO, hi(rd), ctx); break; case BPF_DW: emit(hppa_ldw(off + 0, srcreg, hi(rd)), ctx); From patchwork Tue Sep 12 22:46:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puranjay Mohan X-Patchwork-Id: 13382270 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 6B292EE57CC for ; Tue, 12 Sep 2023 22:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237872AbjILWrK (ORCPT ); Tue, 12 Sep 2023 18:47:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237825AbjILWrG (ORCPT ); Tue, 12 Sep 2023 18:47:06 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1153210F4; Tue, 12 Sep 2023 15:47:02 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31c65820134so5762419f8f.1; Tue, 12 Sep 2023 15:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694558820; x=1695163620; 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=qhUNqTKNJ5t40WxcJkQJJc6NwQozn+LNI3JL0/ULous=; b=dsh8CodRO/rjPAwHsY5JMfDmx8BK07PZ4jrSu27Py0Tef5Mr+XoxzwVHp7iuX7a51c Dvikoo4hYXxMHrL8vcxwFNL8zxnaLK6MTHe/4xOQqWoHVBm4WgDyJhCBNXN730LSYUgk SF2JWi3oU99EMGbDqsVqFrDp8liz8DHqJV3hPMhNuN0V87V749ae1wgCGtkDHlBT/JHP fbRNxYZrDe2FcS9TZvws1003xu03L32J2uo/Q0k+OZtsDkCenl7mEk8qnYqcqaYg/gSM WJNk0DaBfxkneFNf6zZmFyrhqimnuQX7IElCVRKWBCaNvaV5/gXp3KBD1+i7G86O5htO 1ERg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694558820; x=1695163620; 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=qhUNqTKNJ5t40WxcJkQJJc6NwQozn+LNI3JL0/ULous=; b=sWI9ps6tej+A/643AqH/qPTq7bSRsWooXjxvOwPmFleT1zV/3KDsLPwUQQQ93Xtons Uwea9uDI5mYZBdmm2xNNKUlTdQgssv44a35Lb+2yyIfEuSf0RFWiJG5TUraqjXfS7X8q bbmhCisDBa4RiR31Ub41DgwEyzpY70T6YxORUzFEULhd4B9UFSVduF372VIUqwEQGu3I NJKngj2bwhmFH7VLVkCVHHsmcml9zcfnkDkz5LZGbinpbMLtNUV70xQbezaNCRWpTXo5 la9/i1yB6McKi+CemJZvQd38uANxuEwsVicUBPwgIQav0+8eQtsYOwkyIQtlFllFkxiU Fqsg== X-Gm-Message-State: AOJu0YyS1ChUxTAQZCE9oQNPsTcPdAF9R7btvAuGG9ezuKf1hhLrx4uZ hCw+QijRnbYnW0OegWemGQw= X-Google-Smtp-Source: AGHT+IFgAH0fOtyaF0ehV56I8y/PX0drowIs04cM59dILrqCnUI/euGHNvJaohPj3FXuSexhWOZw7g== X-Received: by 2002:a5d:628c:0:b0:319:7a9f:c63 with SMTP id k12-20020a5d628c000000b003197a9f0c63mr718103wru.50.1694558820430; Tue, 12 Sep 2023 15:47:00 -0700 (PDT) Received: from ip-172-31-30-46.eu-west-1.compute.internal (ec2-34-242-166-189.eu-west-1.compute.amazonaws.com. [34.242.166.189]) by smtp.gmail.com with ESMTPSA id e15-20020a5d594f000000b00317df42e91dsm13921794wri.4.2023.09.12.15.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 15:47:00 -0700 (PDT) From: Puranjay Mohan To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shubham Bansal , Russell King , "James E.J. Bottomley" , Helge Deller , "Naveen N. Rao" , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Luke Nelson , Xi Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Wang YanQing , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: puranjay12@gmail.com Subject: [PATCH bpf-next 4/6] bpf, powerpc32: Always zero extend for LDX Date: Tue, 12 Sep 2023 22:46:52 +0000 Message-Id: <20230912224654.6556-5-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230912224654.6556-1-puranjay12@gmail.com> References: <20230912224654.6556-1-puranjay12@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org The JITs should not depend on the verifier for zero extending the upper 32 bits of the destination register when loading a byte, half-word, or word. A following patch will make the verifier stop patching zext instructions after LDX. Signed-off-by: Puranjay Mohan --- arch/powerpc/net/bpf_jit_comp32.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c index 7f91ea064c08..0a952a2cfaac 100644 --- a/arch/powerpc/net/bpf_jit_comp32.c +++ b/arch/powerpc/net/bpf_jit_comp32.c @@ -936,14 +936,13 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context * PPC_BCC_SHORT(COND_GT, (ctx->idx + 4) * 4); EMIT(PPC_RAW_LI(dst_reg, 0)); /* - * For BPF_DW case, "li reg_h,0" would be needed when - * !fp->aux->verifier_zext. Emit NOP otherwise. + * For BPF_DW case, "li reg_h,0" would be needed emit NOP otherwise. * * Note that "li reg_h,0" is emitted for BPF_B/H/W case, * if necessary. So, jump there insted of emitting an * additional "li reg_h,0" instruction. */ - if (size == BPF_DW && !fp->aux->verifier_zext) + if (size == BPF_DW) EMIT(PPC_RAW_LI(dst_reg_h, 0)); else EMIT(PPC_RAW_NOP()); @@ -974,7 +973,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context * break; } - if (size != BPF_DW && !fp->aux->verifier_zext) + if (size != BPF_DW) EMIT(PPC_RAW_LI(dst_reg_h, 0)); if (BPF_MODE(code) == BPF_PROBE_MEM) { @@ -982,20 +981,12 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context * int jmp_off = 4; /* - * In case of BPF_DW, two lwz instructions are emitted, one - * for higher 32-bit and another for lower 32-bit. So, set - * ex->insn to the first of the two and jump over both - * instructions in fixup. - * - * Similarly, with !verifier_zext, two instructions are - * emitted for BPF_B/H/W case. So, set ex->insn to the - * instruction that could fault and skip over both - * instructions. + * Two instructions are emitted for LDX. + * So, set ex->insn to the instruction that could fault and skip + * over both instructions. */ - if (size == BPF_DW || !fp->aux->verifier_zext) { - insn_idx -= 1; - jmp_off += 4; - } + insn_idx -= 1; + jmp_off += 4; ret = bpf_add_extable_entry(fp, image, pass, ctx, insn_idx, jmp_off, dst_reg); From patchwork Tue Sep 12 22:46:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puranjay Mohan X-Patchwork-Id: 13382271 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 A15B1EE3F3F for ; Tue, 12 Sep 2023 22:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237864AbjILWrJ (ORCPT ); Tue, 12 Sep 2023 18:47:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237829AbjILWrI (ORCPT ); Tue, 12 Sep 2023 18:47:08 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ED9910F9; Tue, 12 Sep 2023 15:47:03 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-401da71b7faso72322075e9.2; Tue, 12 Sep 2023 15:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694558821; x=1695163621; 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=9kqE25xddEGWdkAd5IJWaOPr3bcznXZB6DbOZ/MzuKY=; b=CoRXAahptuRkL8SsIVeDj3ObxXrfCw8u4+j7VRtnnA9lLibob9UB23lXRhbob5ONXX HsJ2pBd9R3/50QfiB/xYttGbWUMGq+YFqHubDAfZkg0JGy2daXNJYVkVYIZOHQZ33bsa pPTnc/LkGz177lSMT7qpBqhZ4d6ZfWAH6gummX1vVxgaX/p5KnFUr5KqmJPjCioizIk1 VErLKbwO+4JPsz8knfA9YCAlbLcALCZe7hQCc8z/Ujt7fyELW2O8SgZn54VbwUOVhcVr Ld80KKRNvQzLH3JRZ+z68txpk5O9nT/UBsQ1DQ28K/DHUiCs908ZmE36oh9IrM9x+Cv+ YRrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694558821; x=1695163621; 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=9kqE25xddEGWdkAd5IJWaOPr3bcznXZB6DbOZ/MzuKY=; b=MinWX+D11KDq8mHbaGbwstMgF7noRAZ8kR1sDwa9381tj9taGmpVzUGLUZ1cN0DWXB gr2e0p/DnKArvhoBuZW9LFF4xAhJR6RYnI9dXmaBIipLAjmaBllvijbprmacNF5NfbJC w7jSn9Ao3VgyHKFdfeLAPgJjJ955NtiDSa48YP6eB70k7YE8t0wHGD3TST7c/0HaufdR 2pl5cbQK/hV4tZY9rCK5QLCXLiH4bCCFnyAwM7qV3fxHxvjHnAkxH3KtlTkcV8DKEj2b BXLYloOe/xlvIT46aCMa0AoMIjC1WhYvmtW1vfp6UtRIKDFbCwetWom0MyoUc/uIDS34 c5RQ== X-Gm-Message-State: AOJu0Yzm5JRZjjlUY/xOuekpfMM4zJ8cc/ffQa+A4upT8JCBEEC6l8WD HHnZYPKNg890sdbK2x5g5aM= X-Google-Smtp-Source: AGHT+IFtRPmqCA45qZeOfe4gap2/v8LgzERhETar42HTdZcTU3NFDWNWl1Q7ouaYhNuNBRQewOmqOA== X-Received: by 2002:a7b:cbcc:0:b0:3fe:db1b:8c39 with SMTP id n12-20020a7bcbcc000000b003fedb1b8c39mr604002wmi.41.1694558821453; Tue, 12 Sep 2023 15:47:01 -0700 (PDT) Received: from ip-172-31-30-46.eu-west-1.compute.internal (ec2-34-242-166-189.eu-west-1.compute.amazonaws.com. [34.242.166.189]) by smtp.gmail.com with ESMTPSA id e15-20020a5d594f000000b00317df42e91dsm13921794wri.4.2023.09.12.15.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 15:47:01 -0700 (PDT) From: Puranjay Mohan To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shubham Bansal , Russell King , "James E.J. Bottomley" , Helge Deller , "Naveen N. Rao" , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Luke Nelson , Xi Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Wang YanQing , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: puranjay12@gmail.com Subject: [PATCH bpf-next 5/6] bpf, arm32: Always zero extend for LDX with B/H/W Date: Tue, 12 Sep 2023 22:46:53 +0000 Message-Id: <20230912224654.6556-6-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230912224654.6556-1-puranjay12@gmail.com> References: <20230912224654.6556-1-puranjay12@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org The JITs should not depend on the verifier for zero extending the upper 32 bits of the destination register when loading a byte, half-word, or word. A following patch will make the verifier stop patching zext instructions after LDX. Signed-off-by: Puranjay Mohan --- arch/arm/net/bpf_jit_32.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index 6a1c9fca5260..757a99febba5 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c @@ -1081,20 +1081,17 @@ static inline void emit_ldx_r(const s8 dst[], const s8 src, case BPF_B: /* Load a Byte */ emit(ARM_LDRB_I(rd[1], rm, off), ctx); - if (!ctx->prog->aux->verifier_zext) - emit_a32_mov_i(rd[0], 0, ctx); + emit_a32_mov_i(rd[0], 0, ctx); break; case BPF_H: /* Load a HalfWord */ emit(ARM_LDRH_I(rd[1], rm, off), ctx); - if (!ctx->prog->aux->verifier_zext) - emit_a32_mov_i(rd[0], 0, ctx); + emit_a32_mov_i(rd[0], 0, ctx); break; case BPF_W: /* Load a Word */ emit(ARM_LDR_I(rd[1], rm, off), ctx); - if (!ctx->prog->aux->verifier_zext) - emit_a32_mov_i(rd[0], 0, ctx); + emit_a32_mov_i(rd[0], 0, ctx); break; case BPF_DW: /* Load a Double Word */ From patchwork Tue Sep 12 22:46:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puranjay Mohan X-Patchwork-Id: 13382272 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 2FBBDEE7FF4 for ; Tue, 12 Sep 2023 22:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237817AbjILWrL (ORCPT ); Tue, 12 Sep 2023 18:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237841AbjILWrI (ORCPT ); Tue, 12 Sep 2023 18:47:08 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24E881708; Tue, 12 Sep 2023 15:47:04 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-31aeedbb264so6597900f8f.0; Tue, 12 Sep 2023 15:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694558822; x=1695163622; 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=GxeItlNv04+BjzshAn31wAsB9adLvt962s1bQaHQhqk=; b=qkDC7lydUruK+up4ibdg5dKJAohUWVCTp+4NBx524I2YL7zZVduRLYAlDwpC/jjmUb R+Z9ZRFQJ8RqepOGSlG3bkVnNZ5Zofvov5QBXV+mq3mxxIPMHM+I3Aq6xGfmacmk8BGu YsV9xSqrV6GW6owSRIe4f2YSzostnhu9dn3wsUu/UQXKxVXl6uA9xN8reeDQtGehTwdR qVnCzMAyxUcIR3Ipl8Nv+GjrF4h63D+zin2vjp68FApH7wxZOS38o1k6oEHbFbc0J8ps AejUvVu6NZ2nacbgbQ3gl8Gvz8h5QAMn/A+xncv9UPOKVEYPMJFj5sedZSzkF3fDKd1u M8QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694558822; x=1695163622; 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=GxeItlNv04+BjzshAn31wAsB9adLvt962s1bQaHQhqk=; b=M8XBBwvWUJ14TkS3XPZIlnRPJ1mxnNYmOK1fz573PuTZgri6R2TOTw8mATEfO0AYGS wdrkkm0BaI76FG9hxKMKqUdbUdZZAsKb24lggG2cs3L00b7gyBt1CekKQhFiaPW4/NRg C+Is3IE0Y7Z8T0DiP1jOE5YcQRNClTHhAT72vR2cyHUVokWY1aubRauNKmYJJ/aWx610 iCVPz8JPYl6xqrXY/agF5HuQh0kH2uGeS68X9/mKqcjhK1PoIFn0uk2nw9w4b8uyfyPF Nmr2FTFj4Jod6ySmhQJmkMNmXemh+fBHO0TZSHKFQFgVrW51wr0JwKFNacQglk8UOn7G yc+g== X-Gm-Message-State: AOJu0YxRLjva5vrNwg3uPLWbHnybuXk5wil6jVO5u2mWDb2Uuzv5Font zSNEbDFoxsqK2JqYttsGFS4= X-Google-Smtp-Source: AGHT+IGIRL1pLS66Q0kL+tNt95f9G7dGNYYYAmglWQ49OAUKZ2P+a9yQAWCML5eZu0IFvzTnTl7LPw== X-Received: by 2002:a5d:45d0:0:b0:31f:9838:dfc4 with SMTP id b16-20020a5d45d0000000b0031f9838dfc4mr646970wrs.33.1694558822455; Tue, 12 Sep 2023 15:47:02 -0700 (PDT) Received: from ip-172-31-30-46.eu-west-1.compute.internal (ec2-34-242-166-189.eu-west-1.compute.amazonaws.com. [34.242.166.189]) by smtp.gmail.com with ESMTPSA id e15-20020a5d594f000000b00317df42e91dsm13921794wri.4.2023.09.12.15.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 15:47:02 -0700 (PDT) From: Puranjay Mohan To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shubham Bansal , Russell King , "James E.J. Bottomley" , Helge Deller , "Naveen N. Rao" , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Luke Nelson , Xi Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Wang YanQing , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: puranjay12@gmail.com Subject: [PATCH bpf-next 6/6] bpf, verifier: always mark destination of LDX as 64-bit Date: Tue, 12 Sep 2023 22:46:54 +0000 Message-Id: <20230912224654.6556-7-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230912224654.6556-1-puranjay12@gmail.com> References: <20230912224654.6556-1-puranjay12@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org All 64-bit JITs utilize a single instruction to load + zero-extend a byte, word, or a half-word. The optimisation of emitting zext for LDX is not useful for most of the JITs. All the JITs that relied on the verifier for zero extension of LDX desitination registers have been modified to always zero extend the destination. Now the verifier can safely mark LDX destination as 64-bit and stop emitting zero-extension instructions for it. Signed-off-by: Puranjay Mohan --- kernel/bpf/verifier.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index dbba2b806017..02a1ac1a1327 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -3028,9 +3028,7 @@ static bool is_reg64(struct bpf_verifier_env *env, struct bpf_insn *insn, return false; if (class == BPF_LDX) { - if (t != SRC_OP) - return BPF_SIZE(code) == BPF_DW; - /* LDX source must be ptr. */ + /* LDX source must be a ptr. and LDX destination is always zero-extended. */ return true; }