Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3656552rwd; Fri, 16 Jun 2023 23:16:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Jg9UlzeFydbgpisREeW5kZBYzyN4Spx1uyLoI5Wp458ZRNZdOH+lYkOAYvy3qwr/SExnc X-Received: by 2002:a17:902:da88:b0:1b2:28ca:d38 with SMTP id j8-20020a170902da8800b001b228ca0d38mr5392681plx.10.1686982566732; Fri, 16 Jun 2023 23:16:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686982566; cv=none; d=google.com; s=arc-20160816; b=u91ypURdC3CoCk4Io3SKfug62jY3p1ZSBcrFYMoRWGaVUAvumsdQ9Rk8iUhkLfqzMn Tr4BHHFHEFvmrJ6guPDsVvd8F19GKIPP/goPmdS5NTESZUgSbh6wniqbExiVxxK0T9ke E96ZicbrpQssdYiMZeNSqlTRj6ES3qncnYAfxw1mJttrFOCySvSVJvKQS+eC+QGBbqyq I4WxmB330nP2tjqdt93YsFsMikYmVspGy3fvpqGPTiarRdQNqu+W1AsiiMSpmhAr/lcb c1AEk3JoIrVne6KIQG2q0mRYtQvH+omhjq2ST9GFA6h9p9VScH8TSHRGRScdQ/foFLEh OO9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6UBPYWqYKa19qS7/amCR8aFKWn98VrHZbuXsmbrcg7Y=; b=ef+lvMWwtIxacDfUJtqZSCXGiFQSFstXvDmyVKO7Pnq3+icjD0Z8oOXVRiWuwHeJOh EBOho0JBai6iVI1PKO27sd0aH7Xrkqe916jrHfefWb8Ldv25neK3tUJ/ychQZPWRuJcq vkHVF8X6TeUeVJ4isUYrSBnS7dTIUWzyUqpw2HBWtMrhC5bWKPt0nG0D/pKO2aX5kLRl fwaETV6MCSXmtjRu+OJMTg206jOk7hkPuIErFfKCFueBjW8GChcTgVEMhtxdUSs686An TEghTifbvZZD4FyI/z2u8/w0rWOKpYHKWEIfFrMYSH9p8nsvZx59QgOTbajd6GqhXcAy G9Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lpj2dpfi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m16-20020a170902f65000b001990520ebccsi16436745plg.587.2023.06.16.23.15.54; Fri, 16 Jun 2023 23:16:06 -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=@kernel.org header.s=k20201202 header.b=lpj2dpfi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233189AbjFQFxp (ORCPT + 99 others); Sat, 17 Jun 2023 01:53:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjFQFxo (ORCPT ); Sat, 17 Jun 2023 01:53:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41A5F1987; Fri, 16 Jun 2023 22:53:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C4E2161142; Sat, 17 Jun 2023 05:53:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24536C433C8; Sat, 17 Jun 2023 05:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686981222; bh=TluszqxdgR0a0IwbMuuhT/6JAXY40kPgAznuGjSXri0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lpj2dpfi9Ji3xzZ2kbgOQVYp/ZmysDx8WqNHlHmdTvMZEZsbjfL4hE6m7SXkjz4Zo Mkq0iog3xkwtSwK3WOjB9XwUu05VRpcB0eogiPxG2WXCBK0aumyezzFkPPpZnGtjc7 5x++BGdF8JI0RHFvISKKMXQLn7exxg6GH1B4T2YCX3C0Zr0t9A89VOCr3b7IhrP+qG ZzJIZ0zukBYcwghAr54w2jBQdBKljd+YnNYrk8GHhTFw3utqrXxsX2NC3voAWygO8q svafETOLy9nPtmeHj06Y/0ZWzWAt+idrvmT6go/EJzAEpVusozQOwG5k1TndPIMv23 z+o01h8acz8Lg== Date: Sat, 17 Jun 2023 08:52:56 +0300 From: Mike Rapoport To: "Edgecombe, Rick P" Cc: "linux-kernel@vger.kernel.org" , "tglx@linutronix.de" , "mcgrof@kernel.org" , "deller@gmx.de" , "davem@davemloft.net" , "nadav.amit@gmail.com" , "linux@armlinux.org.uk" , "netdev@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "hca@linux.ibm.com" , "catalin.marinas@arm.com" , "kent.overstreet@linux.dev" , "puranjay12@gmail.com" , "linux-s390@vger.kernel.org" , "palmer@dabbelt.com" , "chenhuacai@kernel.org" , "tsbogend@alpha.franken.de" , "linux-trace-kernel@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "christophe.leroy@csgroup.eu" , "x86@kernel.org" , "mpe@ellerman.id.au" , "mark.rutland@arm.com" , "rostedt@goodmis.org" , "linuxppc-dev@lists.ozlabs.org" , "will@kernel.org" , "dinguyen@kernel.org" , "naveen.n.rao@linux.ibm.com" , "sparclinux@vger.kernel.org" , "linux-modules@vger.kernel.org" , "bpf@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "song@kernel.org" , "linux-mm@kvack.org" , "loongarch@lists.linux.dev" , "akpm@linux-foundation.org" Subject: Re: [PATCH v2 01/12] nios2: define virtual address space for modules Message-ID: <20230617055256.GM52412@kernel.org> References: <20230616085038.4121892-1-rppt@kernel.org> <20230616085038.4121892-2-rppt@kernel.org> <6f9e9c385096bd965e53c49065848953398f5b8e.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6f9e9c385096bd965e53c49065848953398f5b8e.camel@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Fri, Jun 16, 2023 at 04:00:19PM +0000, Edgecombe, Rick P wrote: > On Fri, 2023-06-16 at 11:50 +0300, Mike Rapoport wrote: > > ?void *module_alloc(unsigned long size) > > ?{ > > -???????if (size == 0) > > -???????????????return NULL; > > -???????return kmalloc(size, GFP_KERNEL); > > -} > > - > > -/* Free memory returned from module_alloc */ > > -void module_memfree(void *module_region) > > -{ > > -???????kfree(module_region); > > +???????return __vmalloc_node_range(size, 1, MODULES_VADDR, > > MODULES_END, > > +?????????????????????????????????? GFP_KERNEL, PAGE_KERNEL_EXEC, > > +?????????????????????????????????? VM_FLUSH_RESET_PERMS, > > NUMA_NO_NODE, > > +?????????????????????????????????? __builtin_return_address(0)); > > ?} > > ? > > ?int apply_relocate_add(Elf32_Shdr *sechdrs, const char *s > > I wonder if the (size == 0) check is really needed, but > __vmalloc_node_range() will WARN on this case where the old code won't. module_alloc() should not be called with zero size, so a warning there would be appropriate. Besides, no other module_alloc() had this check. -- Sincerely yours, Mike.