Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1915679pxb; Mon, 12 Apr 2021 09:33:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxExQodegEI4f66a2HMiACUi+Xz/BQniT0vRtnudN1wt9wNtuVRXSfpQWIxp7f0iGi81ho9 X-Received: by 2002:a17:90a:138b:: with SMTP id i11mr13704557pja.220.1618245222066; Mon, 12 Apr 2021 09:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618245222; cv=none; d=google.com; s=arc-20160816; b=SQB6qhnQHq0I7xCZz/ihA3qlN6y9iaxxGcSsIzHPmC3859wEFRqRKHaPxGLKoKpP/D 2QXTqWvJwTl9Ps76Yq0trAnCzDnhQeGnMdgnB+rSS4JPKZFszkrGWqVJRttXpoDXxgG5 Nf2K6UfAtykDGelmgMS4Kglt7dehghjIveQku3lUI1IPA/NPH/28jAjuxU9wuS8kidIv XdAPcQPvplnDIZ5Mld0PAVzStEAtST53D9lEkzLJWbA/0/D5WWk5piEdS4Gj70s1wvxa zCYZWBR82moxp9hwY8DzMP3UfWtSSM5WQX6DgTxOpKXKODfs7pxd7hSpc/xGhS4W+SBt wpcw== 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=kspMpVWA8RdaDQw/ELkzB8D1gwcI58BWj8lpK1+dMAw=; b=LExqMcsq4ljl77IhK4SAkCNkrVO/3xvqmt/4k5cW625ZhrwkCDBm9NKiXukz8rNWbR 6+H3C30OgwTjyQfnnzNRuqREkOM58PsurfadpL2Ho/KkF67AdpbXSENbqFxHr+sLY9W6 /cX9a66NT+Bk7FqhYh6Qd3d4MKu4hhsPjZrODCTozGRsj6DZNMIiZuGIx1w4VQX0RUoz tWHqcV5sjABtpx6KdWYCvSfEWc256dxUIC6W7WkuGK/UHZFzZVNd79FOz9h1KsCeQjcF tohSFrU5F/RsdfuFKTDX5FtAKdzSqnsEM4QRc354EAt0+YQLOxnr80dBmw15c9kZKasG pS6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mail.ustc.edu.cn header.s=dkim header.b=JlbU+pF1; 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 np13si14456170pjb.75.2021.04.12.09.33.29; Mon, 12 Apr 2021 09:33:42 -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=JlbU+pF1; 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 S244664AbhDLQa5 (ORCPT + 99 others); Mon, 12 Apr 2021 12:30:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243313AbhDLQZH (ORCPT ); Mon, 12 Apr 2021 12:25:07 -0400 Received: from ustc.edu.cn (email6.ustc.edu.cn [IPv6:2001:da8:d800::8]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A6869C061574 for ; Mon, 12 Apr 2021 09:24:32 -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=kspMpVWA8RdaDQw/ELkzB8D1gwcI58BWj8 lpK1+dMAw=; b=JlbU+pF1wd04/Ehk57s4QvIE6OVhtORqwI/+LF/idRyPCfrUYq ooLtSocatCCxk2eXp5scBclx6Ec+OPoHf46bfxjS//h4M4auwaFMA8y4gw3d+7Ss 3AWvKpEd5wAvrB+NMQ4ZU68LqHFqYYHA9GWjx28Db8Cy+vc94OemXU3k8= Received: from xhacker (unknown [101.86.20.15]) by newmailweb.ustc.edu.cn (Coremail) with SMTP id LkAmygA3PKQWdHRgqUDLAA--.44789S2; Tue, 13 Apr 2021 00:23:51 +0800 (CST) Date: Tue, 13 Apr 2021 00:18:48 +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 08/10] riscv: bpf: Avoid breaking W^X on RV64 Message-ID: <20210413001848.157891f1@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: LkAmygA3PKQWdHRgqUDLAA--.44789S2 X-Coremail-Antispam: 1UD129KBjvdXoW7GFy3Cw1DXF1xGF4fXw1DKFg_yoWfXwc_C3 WxJFyxWw1rtr48Zw4DWFWFyr1Syw4rCF4kuFn3Zry2ka98uF17tF95t342qry7Zry09r97 WryfX3yIqw4avjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb4AYjsxI4VWDJwAYFVCjjxCrM7AC8VAFwI0_Xr0_Wr1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2 8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0 cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4 vEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40E FcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWrXwAv7VC2z280aVAFwI0_Jr 0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JM4IIrI8v6xkF7I0E8cxan2IY 04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI 0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVW8ZVWrXwCIc40Y 0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UMIIF0xvE42xK8VAvwI8IcIk0rVW8JVW3JwCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7IU8aYLP UUUUU== X-CM-SenderInfo: xmv2xttqjtqzxdloh3xvwfhvlgxou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jisheng Zhang bpf_jit_binary_lock_ro() in core not only set RO but also set EXEC permission when JIT is done, so no need to allocate RWX from the beginning, and it's not safe. Signed-off-by: Jisheng Zhang --- arch/riscv/net/bpf_jit_comp64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c index b44ff52f84a6..1c61a82a2856 100644 --- a/arch/riscv/net/bpf_jit_comp64.c +++ b/arch/riscv/net/bpf_jit_comp64.c @@ -1153,7 +1153,7 @@ void *bpf_jit_alloc_exec(unsigned long size) { return __vmalloc_node_range(size, PAGE_SIZE, BPF_JIT_REGION_START, BPF_JIT_REGION_END, GFP_KERNEL, - PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, + PAGE_KERNEL, 0, NUMA_NO_NODE, __builtin_return_address(0)); } -- 2.31.0