Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1914010pxb; Mon, 12 Apr 2021 09:31:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuXbjxwcO06uvjsebDWYkG80RusHi9Ehl9PC/UBK5ikUPXiEeZOSfegNNhDPctGAWgTpIn X-Received: by 2002:a17:906:d04d:: with SMTP id bo13mr27848275ejb.157.1618245085868; Mon, 12 Apr 2021 09:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618245085; cv=none; d=google.com; s=arc-20160816; b=Hin+FrGd3aOO5FWwxHOm9/H4m+I8udGk4gYP3z27ITuVHcVyzZV5YS8yygOXIXf/du X6DmNF1csLhN4sMwD/ZJ83CSRo0xw6Cqn3LT5igKUOqNeqeQPIhqErPVW75aTO/jGocO A6GMIboU9KDtM+4oLbsP3eTnoGc9QeJ7j4iKBE3hCLFxKeNH+Ud2glCAHy/NMzczjMU8 caYtxeNAUAMIYqkaLv5gi7kVpvu0O7xMsdv06MlglcrHfbLG2xQhzri1gl+2RijRBWzf FtakzCHpWBAMGK6X6F5lEjxsixN6cRRxPp0ng7D4hd3viZBRvMi2rc6SuEMv1eC3HLFJ Mf7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8lRS5PKRg+wSW2+e9kKETn+Cn0NAuvZahdIC8PRgBYM=; b=hM61YhJB1W+S7Mz40SnU2P3E8yHgT3cJO/U9abDXw90nc3P1++E5CpCOCtt3WVE/1e l+fKttmppu5QX8CpfwjR//STdccpNiwKDRFOdwWI5dpXIzHGK6PllqK6gkEnraA/YhTc YxleoSRejhazBPOPD1WJR5OAiqeJTH7mXAWgHnYNrvNdhrlfwB5C3EW0s0Ps5cudjw53 Kk9tfMa360v2UZqeLxdRN5tEQFFGn+bn4HeOYrhiCN6NFIzD+szkINY4Z2gXFupnIibG e/mOuc1kBooZaO+fDFopHHPkJoSwPtaj0YdeLT6oUo8eCyeEkbmiE2L7AgCpld3waMkY WILw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mail.ustc.edu.cn header.s=dkim header.b=WC+KjpWa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mail.ustc.edu.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si7952117edd.567.2021.04.12.09.31.02; Mon, 12 Apr 2021 09:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mail.ustc.edu.cn header.s=dkim header.b=WC+KjpWa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mail.ustc.edu.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243682AbhDLQ04 (ORCPT + 99 others); Mon, 12 Apr 2021 12:26:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243258AbhDLQYS (ORCPT ); Mon, 12 Apr 2021 12:24:18 -0400 Received: from ustc.edu.cn (email6.ustc.edu.cn [IPv6:2001:da8:d800::8]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DC42DC061574 for ; Mon, 12 Apr 2021 09:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ustc.edu.cn; s=dkim; h=Received:Date:From:To:Cc:Subject: Message-ID:In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=8lRS5PKRg+wSW2+e9kKETn+Cn0NAuvZahd IC8PRgBYM=; b=WC+KjpWaqSKQ1sOC4IQyxTGw3Mxis3xFPpTlZNEYw3pW5vJZU4 JjvPk+sdW2CS7lnpHTwoO0St0X60St3GzO6ON78S5jYa18zIELSBXZvZ2sbpJ6nM HFeYcMhmEd4rFWJJVPtfVRyCgMhhbsHA02A3+deg0/2bLLovs0NIMA3VM= Received: from xhacker (unknown [101.86.20.15]) by newmailweb.ustc.edu.cn (Coremail) with SMTP id LkAmygDX3Ejzc3RgBUDLAA--.24267S2; Tue, 13 Apr 2021 00:23:16 +0800 (CST) Date: Tue, 13 Apr 2021 00:18:13 +0800 From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , " =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?=" , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Luke Nelson , Xi Wang , Anup Patel Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 07/10] riscv: bpf: Write protect JIT code Message-ID: <20210413001813.36b397bc@xhacker> In-Reply-To: <20210413001110.7209bae6@xhacker> References: <20210413001110.7209bae6@xhacker> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CM-TRANSID: LkAmygDX3Ejzc3RgBUDLAA--.24267S2 X-Coremail-Antispam: 1UD129KBjvdXoW7GFyfAF4xCFy7WrW5tr4UXFb_yoW3XFg_Z3 W8ta4xW3s3Jr4xAr4DZr4rZr10yw1FkFZ5Zr1xXryUAas0gr15KasaqrWFgr97ursYqrW3 Wr97JryxXw4aqjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb4AYjsxI4VW3JwAYFVCjjxCrM7AC8VAFwI0_Xr0_Wr1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2 8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0 cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4 vEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40E FcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAFwI0_Jr 0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JM4IIrI8v6xkF7I0E8cxan2IY 04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI 0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVW8ZVWrXwCIc40Y 0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UMIIF0xvE42xK8VAvwI8IcIk0rVW8JVW3JwCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7IU8S1v3 UUUUU== X-CM-SenderInfo: xmv2xttqjtqzxdloh3xvwfhvlgxou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jisheng Zhang Call bpf_jit_binary_lock_ro() to write protect JIT code. Signed-off-by: Jisheng Zhang --- arch/riscv/net/bpf_jit_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/net/bpf_jit_core.c b/arch/riscv/net/bpf_jit_core.c index 3630d447352c..40d5bf113fee 100644 --- a/arch/riscv/net/bpf_jit_core.c +++ b/arch/riscv/net/bpf_jit_core.c @@ -152,6 +152,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) bpf_flush_icache(jit_data->header, ctx->insns + ctx->ninsns); if (!prog->is_func || extra_pass) { + bpf_jit_binary_lock_ro(jit_data->header); out_offset: kfree(ctx->offset); kfree(jit_data); -- 2.31.0