Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp542203pxf; Wed, 31 Mar 2021 09:35:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1R2qTt48bZaNYp1bcsWnjSddYx0S6I34ofLI35u+OGt8E60w0hDUHIiRYB8yLPhIoTI5O X-Received: by 2002:a17:906:3388:: with SMTP id v8mr4544662eja.278.1617208553754; Wed, 31 Mar 2021 09:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617208553; cv=none; d=google.com; s=arc-20160816; b=GVkSF8aFuHutGmJXD8/Arw19SlAh9Y/4J68ceO/+ZLTMy1DLZeQdCUGcynUHhcdS0b vd4I9vbWj6Fi9b8HBw+cYqNJJduaLgNwtcJVZqS9BLh+qJUBgxHNeVJH/HvTQd39nx6m vjFDWMlR4UDjxDHf7v+bRzM1bSxC6KLVEsVIYGe310RAE22520mS0bHx2X+7ObPCmSLh S94gc3orLWRz2gG7y0hxLpObc01qSVZKu8DakteRqyqMhLWb2HfMUv6GqVOqAGuhoEE1 /UCvPR7uwqofLkXVu2Shdt/k27Dcbg4VjiZEjd4HUMmpmK1ccCPvICQw3dKeCiBDyDTV TTyA== 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=U/zf0HIMP4ocarD/A2HHIzXKbTCY/sA/Dbr+GnFz9UYeveOs3Wfm84qTWPoXRFEovl oxFQRALUR41/y5m7T1DyP5UP6gOqdVza72JvQNTJfMTVytsa9zcr81/S0RXz14f7VOnE NwA5xItzKinh0Q4HRXH3l3RtIpRFi7PSo8WUh4g8imV8+1oZgziSQnOD2tMpuuWUfzTQ YNqRxcGsb4/JDSNXDquxzbyrNhBt4aGyhKhRQNi5DZGMmnDa4ZFejRLkSXKD8pl9Ok4E hmDexmREZ/FLIB1eEG79YPLYUJJxR5f4NWEzNzMX5zM96fBSrkJP9M4UjJ+w+i2Of4C0 7hxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mail.ustc.edu.cn header.s=dkim header.b=dplSMM64; 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 r16si2104027edw.458.2021.03.31.09.35.26; Wed, 31 Mar 2021 09:35:53 -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=dplSMM64; 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 S233966AbhCaQeB (ORCPT + 99 others); Wed, 31 Mar 2021 12:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233757AbhCaQdm (ORCPT ); Wed, 31 Mar 2021 12:33:42 -0400 Received: from ustc.edu.cn (email6.ustc.edu.cn [IPv6:2001:da8:d800::8]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2B47CC061574; Wed, 31 Mar 2021 09:33:40 -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=dplSMM64neaG+R6m2APl3sO2awXSOCMkHoy9yS8OL9brm6Au3m PZOi83TLMbqJoMvBGBD45Gc3FN+fvvL+BnydW+2lNbLFY4LDQVaa1Y7n97dZNUOT l6MR7VN4+tzWnYKmEGVYPhPNZJBptpzGBTG25KXi9wYyuBRPz9n3IajRE= Received: from xhacker (unknown [101.86.19.180]) by newmailweb.ustc.edu.cn (Coremail) with SMTP id LkAmygC3vExVpGRgsL56AA--.1359S2; Thu, 01 Apr 2021 00:33:26 +0800 (CST) Date: Thu, 1 Apr 2021 00:28:29 +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 , Song Liu , Yonghong Song , John Fastabend , KP Singh , Luke Nelson , Xi Wang Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v2 7/9] riscv: bpf: Avoid breaking W^X on RV64 Message-ID: <20210401002829.50b71b64@xhacker> In-Reply-To: <20210401002442.2fe56b88@xhacker> References: <20210401002442.2fe56b88@xhacker> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CM-TRANSID: LkAmygC3vExVpGRgsL56AA--.1359S2 X-Coremail-Antispam: 1UD129KBjvdXoW7GFy3Cw1DXF1xGF4fXw1DKFg_yoWfXwc_C3 WxJFyxWw1rtr48Zw4DWFWFyr1Syw4rCF4kuFn3Zry2ka98uF17tF95t342qry7Zry09r97 WryfX3yIqw4avjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb4AYjsxI4VWDJwAYFVCjjxCrM7AC8VAFwI0_Xr0_Wr1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2 8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0 cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4 vEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40E FcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAFwI0_Jr 0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JM4IIrI8v6xkF7I0E8cxan2IY 04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI 0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVW8ZVWrXwCIc40Y 0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UMIIF0xvE42xK8VAvwI8IcIk0rVW8JVW3JwCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7IU84KZJ 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