From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81CC4C4345F for ; Sat, 20 Apr 2024 07:35:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 917446B007B; Sat, 20 Apr 2024 03:35:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C64E6B0083; Sat, 20 Apr 2024 03:35:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 766896B0085; Sat, 20 Apr 2024 03:35:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5807F6B007B for ; Sat, 20 Apr 2024 03:35:10 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EE11516045F for ; Sat, 20 Apr 2024 07:35:08 +0000 (UTC) X-FDA: 82029099096.28.BF060F4 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf25.hostedemail.com (Postfix) with ESMTP id BB0A3A0003 for ; Sat, 20 Apr 2024 07:35:06 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HstIwZ4k; spf=pass (imf25.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713598507; a=rsa-sha256; cv=none; b=rAn6rPSj6k7B0ugEYhAS7e3NHB5d6pKa3GS+m+CGxWONxf6fkRjjDPDGzBvchyL5PwDCAt 6vBpbe7puTuGt/GwLSpYosteLOiRLhezdZ4Y3cBEGdWpHID5LWa8MBrrdRauLXcXRXAYzD 8wJIgwf1zD9730C7+2TB9ZfixMztjP4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HstIwZ4k; spf=pass (imf25.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713598507; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zb+Lcy8tVh1jiR7dc54rf0VFL8P5IXRm4rDjLSWD/aA=; b=7iQGSe5RqktfcB64r6bdfeFcAIUpwxI3gytmTs+hq9+n1lm43CoNBZ9anf9wDEbY1NiJ/m jU+Ila3+rCjKrQk4EP/9tUJD+ywlUKa8fd7oFPUYaK0Q+6A/1NBohuY3+7IPCKkifv2rNt JOMwcpOieb3GswRDOLt3mfQnimN/1wY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id F15A6CE10BD; Sat, 20 Apr 2024 07:35:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FB26C113CE; Sat, 20 Apr 2024 07:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713598501; bh=YQ9KfPtm5Gq9HYepBoPJrHlxAcwZYbjakD5piFpGBCI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HstIwZ4kXYt594F3dTAKefbjqk59LgLelJ4wfeugjHKdccg9U6QSsThvKUdOj6kpr cxBq3QX4LKiL1ekSZ4hlwHrg2Qo19wEMdjfcoqJC1hKB987QXK8Wq3oegsKl2zZTfI 0ahwnVH2zTwg0WMFDB5bQY2DWepkh6sfONxxfG+SnniZiiLcfZnS8gmDD4/taXFr4a gNoyuT99b/yZU19nTHh4Wm4L6MjmbQoSYrPwuVYcHB2CCTGISZcttYnTQA36iEYp8c S1AEVNMPdbCPnyweb2c/fhVBUzL5EOQDTyFmN+U+fX6hUzHCENDjnN15hBAkD3dzc1 3OfMh4fyGR7Ag== Date: Sat, 20 Apr 2024 10:33:38 +0300 From: Mike Rapoport To: Christophe Leroy Cc: Masami Hiramatsu , "linux-kernel@vger.kernel.org" , Alexandre Ghiti , Andrew Morton , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Catalin Marinas , "David S. Miller" , Dinh Nguyen , Donald Dutile , Eric Chanudet , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Luis Chamberlain , Mark Rutland , Michael Ellerman , Nadav Amit , Palmer Dabbelt , Puranjay Mohan , Rick Edgecombe , Russell King , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , "bpf@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mips@vger.kernel.org" , "linux-mm@kvack.org" , "linux-modules@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "linux-trace-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "loongarch@lists.linux.dev" , "netdev@vger.kernel.org" , "sparclinux@vger.kernel.org" , "x86@kernel.org" Subject: Re: [PATCH v4 14/15] kprobes: remove dependency on CONFIG_MODULES Message-ID: References: <20240411160051.2093261-1-rppt@kernel.org> <20240411160051.2093261-15-rppt@kernel.org> <20240418061615.5fad23b954bf317c029acc4d@gmail.com> <321def3e-8bf1-4920-92dd-037b20f1272d@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <321def3e-8bf1-4920-92dd-037b20f1272d@csgroup.eu> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: BB0A3A0003 X-Stat-Signature: 7gwwdywebyogn9obrpj53yigxj9ftjqn X-Rspam-User: X-HE-Tag: 1713598506-526268 X-HE-Meta: U2FsdGVkX18xK1i44+CsR5GdJNkTQtmtHoYOWIKabtmUkKCgPR7CO3NJbJ2mEocbALLCZrzF0eK5YyYFptdo7m/IGz0gIiqYFLeggPvFAcQtf880YdcppyIsslCPs/LIoxFpYAUza0dIjchH2q1hel4T8bU3QlnvqfXVMa87bwx0hwhkCIWUbrvWovPme9YK1alu5Jgc30NEvzJDAXnjJgKttqdZDQWdy0aa8qaW8Jc9ZqZz5WKdOYUew2OgC9bX5w5gAxbF8OJKWft0VnxoIxDlu1t/HUpl25pVYw9SJHMN/fvxif/GN8FUFggA0TyPZY8bxlTGaHEy29kckagPbEwCd++OQeE5v3ap364D/fluTlt2wqLX2vpAkJxSEeNBHH9bZEaKHlgch3x2GiyWyj9MmABAtnRyrYxWZLEOUdm4grxB4tCC70Y97eKgOBzIuc08wCpG3okz/1txjk299Venof/W3Ahw/NAJcPnjDCybfCAbuDprfkf8d/+VRmMRMtXrdALj3hs2sBCzGx3Mlkm5DhyXWOOt8r3VVXI+5A+MonfQ7ffB06AflyjWaBcN47Il4uup8L9SR3b/ionABKXmw//s0Fxro5uCW+hJzmHvu7g924RMgMuqQ9yCak6z6gduyUOFsYfG0BT9LO+013Fak3aliK36cbd4JKsb9VGYg2kjOfBMzmqSx88WfHzp7lC+Gl4BqKEKMe+oSq9JQtpB/NhI1Q730y4YWqdgiGbSCdYgBl2e3b0fknxcAEhbDayMkfb2gayAE/mkVK2sECg4tHXmPhhkaieeplIxtj70OFghp/g5CydcgkBoMH/CBcyDsNjNE0VXBXBNmqsctFgNGlip6BTt1X9dl/fNprr/3FzQ3Cuj4+NGQIv2iDiA9XbWYS2zy2cSgFFy/d5KtlRDzgn2AkgRAecCNWNLg1wr2IMNuIww2P/Wcptm3cGv3dejCl0HRJXvi24A1dM I+E5jxW+ W8IWdlx/HkDQ0tno4YLnpIh+LeIeF1OnrVAs8xWKSZjHWONISrdEsLH9Kto6rhr0iTZroxNf7JyLo8wE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Apr 19, 2024 at 03:59:40PM +0000, Christophe Leroy wrote: > > > Le 19/04/2024 à 17:49, Mike Rapoport a écrit : > > Hi Masami, > > > > On Thu, Apr 18, 2024 at 06:16:15AM +0900, Masami Hiramatsu wrote: > >> Hi Mike, > >> > >> On Thu, 11 Apr 2024 19:00:50 +0300 > >> Mike Rapoport wrote: > >> > >>> From: "Mike Rapoport (IBM)" > >>> > >>> kprobes depended on CONFIG_MODULES because it has to allocate memory for > >>> code. > >>> > >>> Since code allocations are now implemented with execmem, kprobes can be > >>> enabled in non-modular kernels. > >>> > >>> Add #ifdef CONFIG_MODULE guards for the code dealing with kprobes inside > >>> modules, make CONFIG_KPROBES select CONFIG_EXECMEM and drop the > >>> dependency of CONFIG_KPROBES on CONFIG_MODULES. > >> > >> Thanks for this work, but this conflicts with the latest fix in v6.9-rc4. > >> Also, can you use IS_ENABLED(CONFIG_MODULES) instead of #ifdefs in > >> function body? We have enough dummy functions for that, so it should > >> not make a problem. > > > > The code in check_kprobe_address_safe() that gets the module and checks for > > __init functions does not compile with IS_ENABLED(CONFIG_MODULES). > > I can pull it out to a helper or leave #ifdef in the function body, > > whichever you prefer. > > As far as I can see, the only problem is MODULE_STATE_COMING. > Can we move 'enum module_state' out of #ifdef CONFIG_MODULES in module.h ? There's dereference of 'struct module' there: (*probed_mod)->state != MODULE_STATE_COMING) { ... } so moving out 'enum module_state' won't be enough. > > > >> -- > >> Masami Hiramatsu > > -- Sincerely yours, Mike.