Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1007727pxf; Thu, 1 Apr 2021 21:19:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKwLGvseWo55x22l04jFr518fNFwU3UUAALnL3B7sUi/m4umPdDdrXeLfQQOH19reLLboy X-Received: by 2002:a17:906:a86:: with SMTP id y6mr12517366ejf.354.1617337169316; Thu, 01 Apr 2021 21:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617337169; cv=none; d=google.com; s=arc-20160816; b=kWJoSkfGXBSrxxIJizCHWFrPFdxsxUMhqT7Giy41w+5H+dtTboo2adUVTvUFncTcGm 88qHlUWn1+7i1qCpN2rVlLzDN3v55O2SuwJ3DXoRv2sk9QRaCT6b3tMYpNyxdvg5+0E4 W3zENrKgo3ZQ+NaWYZe5mED26uA3B42DJFOVrj9aonMGensXhJIE7uCW1+Qy34oPJyYU 06ER2iCqiUddxzcJLxd+V2rXWmnn5/ZMmpiJozZi85Mf4/+PW2EXZJ9YYovIqCRMlddc G7aHMCAfYkgqeXrtcIRf9fciKsV+xkMEf0dIpui41OPILxaHyF8NOwUi6/r9YCbOl2Mq yupQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gEf69q7AWE2x1/Rq0Iy3chkYVF+eXWxDAEWrpJWIPb0=; b=OzyRgo5e16R/YlXR5e4CySpSG6pJ1t6Nqr5K3TRgND+nUy5Z4xDHEMQc1VTqJkF+QG l2a/CIoXB7OQOc4LkW8fpqb3JdgE8AqAt1TqyiGmwT+JYR5ZPw+23CYpXTH5TiKQuU8y Od1tltYcf6LIOemV6Q3ka50J6ZUaqBb62I6Jt9DI7ZeoKOhxGp/cQqd12/6G5xEQxEEu P/so3AmpXZQccfdPeIDZaNjw7F7//0ahiJDgvDo2rdSdQmp3L9NBDsU0zJUJJAxfhKiS 8oGab9IPycQOVhHJwhTRW8Xh8/vVyiRvNfIzXPN2fOot62gCdZzxcLMq5cAX7GHNfsJl 3wKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b="BiN5pFW/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si5388081edw.610.2021.04.01.21.19.06; Thu, 01 Apr 2021 21:19:29 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b="BiN5pFW/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbhDBESl (ORCPT + 99 others); Fri, 2 Apr 2021 00:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbhDBESk (ORCPT ); Fri, 2 Apr 2021 00:18:40 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C8AAC0613E6 for ; Thu, 1 Apr 2021 21:18:40 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id r14-20020a05600c35ceb029010fe0f81519so311150wmq.0 for ; Thu, 01 Apr 2021 21:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gEf69q7AWE2x1/Rq0Iy3chkYVF+eXWxDAEWrpJWIPb0=; b=BiN5pFW/O77DiJXd0zx2/X1iLpsaPL6JiRjeMEk1PTjCMe5IYyCVuNyE/BDjW9dIjZ uoHOhBWvf5BPD2vTlyDG6HjXQg07ebuyoMX1EfVMRxOK2GWLsjRPkz7J2sb+ef6//hgr pt4sNPV9i0Rtcuj5utnP8QuvOClSES26++sg+APEy0lcDT7xhN8CEVVgMN50DjD9YY2e QksmwcQnz+uOeY8ntNWTj8qV3MgiYDpoQ7WOn/sQqqbxBQTO9DtVbBi7GHOhks+t+0dp Rad0fUf0hiiSKPClQTyzzg5Se1Drv7oKzWSNbevXc+Kway8nQRGPGr+qfVqI9MneH2ff YWSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gEf69q7AWE2x1/Rq0Iy3chkYVF+eXWxDAEWrpJWIPb0=; b=jmZhLn0k6//7kxyIoJapDHq2M89jwZ77CW+mgVmKjJwsMvfoh7cHyADbIwencP2VvW JH77HxTMHiThfXuXSqxjHyRhwntF5kA179TaF+UPsGlW5NiAk6RsDE4ZYyZ2hZCjyou8 gnLByjNiNulb275WWbTA5dlE5qkSmWe2Cbw1m6Auyl4SRIVQO/pn977MsrL/sbcmNijW EVhcYa21Di27VUCEa/gJDlPe9vwDWRnfIWlUxiCvHkYpEa7lOUM6I8ZE9AZwsdfPNdne w37Mr79+rCpKuQBNBJ1jbokTh/Or0UMEIZMvWpWtm72TN7Q3zz3nobOhQLJLJ9gIW2Rl C2Gg== X-Gm-Message-State: AOAM530YbqUHVbEhwy9xANyEB6OD4W0Zhn8yNgvZf3K5pf5iRuPXlbTT fUtHQTHP5tejqRMvtgMDV14eKiAngiWFmIyTQlqf0g== X-Received: by 2002:a1c:60c2:: with SMTP id u185mr10663309wmb.157.1617337118714; Thu, 01 Apr 2021 21:18:38 -0700 (PDT) MIME-Version: 1.0 References: <20210401002442.2fe56b88@xhacker> <20210401002900.470f3413@xhacker> In-Reply-To: <20210401002900.470f3413@xhacker> From: Anup Patel Date: Fri, 2 Apr 2021 09:48:27 +0530 Message-ID: Subject: Re: [PATCH v2 8/9] riscv: module: Create module allocations without exec permissions To: Jisheng Zhang Cc: 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 , linux-riscv , "linux-kernel@vger.kernel.org List" , kasan-dev@googlegroups.com, netdev@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 31, 2021 at 10:04 PM Jisheng Zhang wrote: > > From: Jisheng Zhang > > The core code manages the executable permissions of code regions of > modules explicitly, it is not necessary to create the module vmalloc > regions with RWX permissions. Create them with RW- permissions instead. > > Signed-off-by: Jisheng Zhang Looks good to me. Reviewed-by: Anup Patel Regards, Anup > --- > arch/riscv/kernel/module.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c > index 104fba889cf7..e89367bba7c9 100644 > --- a/arch/riscv/kernel/module.c > +++ b/arch/riscv/kernel/module.c > @@ -407,14 +407,20 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, > return 0; > } > > -#if defined(CONFIG_MMU) && defined(CONFIG_64BIT) > +#ifdef CONFIG_MMU > + > +#ifdef CONFIG_64BIT > #define VMALLOC_MODULE_START \ > max(PFN_ALIGN((unsigned long)&_end - SZ_2G), VMALLOC_START) > +#else > +#define VMALLOC_MODULE_START VMALLOC_START > +#endif > + > void *module_alloc(unsigned long size) > { > return __vmalloc_node_range(size, 1, VMALLOC_MODULE_START, > VMALLOC_END, GFP_KERNEL, > - PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, > + PAGE_KERNEL, 0, NUMA_NO_NODE, > __builtin_return_address(0)); > } > #endif > -- > 2.31.0 > > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv