Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4011642rwl; Tue, 28 Mar 2023 01:01:16 -0700 (PDT) X-Google-Smtp-Source: AKy350YZ7nk6KmWWNSu53q8ghWM8k5NvTwjtFeS3iwIUquNMBDftOidPzr7zrrIu5wHSiuHNxxPt X-Received: by 2002:a17:907:11cf:b0:93d:7ad:a954 with SMTP id va15-20020a17090711cf00b0093d07ada954mr15415692ejb.37.1679990476495; Tue, 28 Mar 2023 01:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679990476; cv=none; d=google.com; s=arc-20160816; b=AoeILXE3uhfEewKTTzsH9Vlb3MlBb/lnLGR8Cz7qiCGCgJbPue3BFvr2CtecmpAZ8i xYreU0WZNNFlYsNchV6ejd+91kODFJhvyIRH7Vu9gN1EEI6OYZ/wMlBENCMhRxANhBtC QQuUjxM5wVTvym1G9lS8XTGPyjYYLhYkAEZDBqPcPUZeVRAHWWc5tDRUbQW3lPYlYBct AJ4LiVeoIVGzCzqwWpFG15YC/0Az38ljhv8puc6KYedWcNC1DSoZpBj8P6Avje62fhXp jNfGFKakN/9Re7MTETSOqwW8H35ngb76Jwvuztt1+mZ2rscwgvFWK8mTvgGKmkB0sNK/ MgjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=THlMC7mHZNwkxEvHH6ehvGWPPkNRxsCAxu+AtBZqMXQ=; b=avOmFerTfv9hw8vl37rIE6MZxWBs6Sc9dRoDHNLpWAR5iU8BIPC5Vm9W/t3nhOh/e4 y0M3cXePKMexEcoyd44rPdeth6+Tsy/Vi+G3oB1N05kBy82QPE/ltS/Y6uhlwSAnslg0 KmwHP0+bg4Tnm/2eE9ypx3v+jv+e1tLznsjf62QqQeuvIPZ2RW5yia8Ry1II0dgzyfF5 i8TTpfA0OgWHBtf58IbYrQBLO6WW07SNbRowJ+yRdHLv6hz+EnmaD6QbOua49vq/TwGk tFhzWy2F01/lIlbY4qp49wbgkX+1sieEZDAsXqCvFhymBhLvJGBiTSo+6II7VtTr4pRq 6Dng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=D4kjclj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du18-20020a17090772d200b0093d8a309f6esi14470796ejc.160.2023.03.28.01.00.48; Tue, 28 Mar 2023 01:01:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=D4kjclj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232303AbjC1Hw6 (ORCPT + 99 others); Tue, 28 Mar 2023 03:52:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229809AbjC1Hw4 (ORCPT ); Tue, 28 Mar 2023 03:52:56 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBCE3A3; Tue, 28 Mar 2023 00:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1679989971; bh=Jn2x0nOTgnxlUFnZ2c/7x81qzDXrhBH81tHUgVzMh84=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=D4kjclj9I5MlPea1nrgZ+Jp1SADA82MHNz9O/BLHhL5rmlE2Pynqw4BDIYZsiQ8DN vdxcfu6HsITGmbGv41PgCAfRTn2AG3su0XSosEei+5OYdimDyyGMZtctbsj3KWaq7x 4OAfX0q6HoOWQS2Boz5dIVSuH8/tETISuWhJj+VE= Received: from [100.100.33.167] (unknown [220.248.53.61]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 44761600CE; Tue, 28 Mar 2023 15:52:51 +0800 (CST) Message-ID: Date: Tue, 28 Mar 2023 15:52:50 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v2] loongarch/bpf: Skip speculation barrier opcode, which caused ltp testcase bpf_prog02 to fail Content-Language: en-US To: Daniel Borkmann , George Guo Cc: ast@kernel.org, bpf@vger.kernel.org, chenhuacai@kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, masahiroy@kernel.org, michal.lkml@markovi.net, ndesaulniers@google.com, hengqi.chen@gmail.com, yangtiezhu@loongson.cn, tangyouling@loongson.cn References: <20230328071335.2664966-1-guodongtai@kylinos.cn> From: WANG Xuerui In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/3/28 15:22, Daniel Borkmann wrote: > On 3/28/23 9:13 AM, George Guo wrote: >> Here just skip the opcode(BPF_ST | BPF_NOSPEC) that has no couterpart >> to the loongarch. >> >> >> >> diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c >> index 288003a9f0ca..d3c6b1c4ccbb 100644 >> --- a/arch/loongarch/net/bpf_jit.c >> +++ b/arch/loongarch/net/bpf_jit.c >> @@ -1022,6 +1022,11 @@ static int build_insn(const struct bpf_insn >> *insn, struct jit_ctx *ctx, bool ext >>           emit_atomic(insn, ctx); >>           break; >> +    /* Speculation barrier */ >> +    case BPF_ST | BPF_NOSPEC: >> +        pr_info_once("bpf_jit: skip speculation barrier opcode >> %0x2x\n", code); >> +        break; > > Thanks that looks better. Question to LoongArch folks (Cc): There is no > equivalent > to a speculation barrier here, correct? Either way, I think the > pr_info_once() can > just be removed given there is little value for a users to have this in > the kernel > log. I can take care of this while applying, that's fine. I can confirm there's currently no speculation barrier equivalent on lonogarch. (Loongson says there are builtin mitigations for Spectre-V1 and V2 on their chips, and AFAIK efforts to port the exploits to mips/loongarch have all failed a few years ago.) And yes I'd agree with removing the warning altogether. Thanks for the reviews! Acked-by: WANG Xuerui > >>       default: >>           pr_err("bpf_jit: unknown opcode %02x\n", code); >>           return -EINVAL; >> > -- WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/