Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1170098lqt; Sat, 20 Apr 2024 03:54:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMy55PFq3UoBq4uokqrfq8ALkHpdA+jDJeGaLz8MFdb79m9Q4bFqD4pPBdgk52XpIrwrq8bGF2tqGr9FCGzGauTDwkQ+xN3htR4nq8Nw== X-Google-Smtp-Source: AGHT+IFhH6rD45FQn9z+ctUoZUnODG0TWdbTECifvPBiEgxeZL+mItRqDrIuhrtEFGwOxz7gGz+Y X-Received: by 2002:a05:6a00:a0f:b0:6ea:f43b:b961 with SMTP id p15-20020a056a000a0f00b006eaf43bb961mr12376951pfh.6.1713610442132; Sat, 20 Apr 2024 03:54:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713610442; cv=pass; d=google.com; s=arc-20160816; b=XLH+wKENIDuf0wQPUS5/93sGY9x0eJ/2SYUG1go7abM3pH5CueDrGz6LNsHk671eGf 91EXViwDjo6Er0YDr24xFNBvxolsT9HCrh1PPSJrtACnCvCdSEYDoMxKHUhX1DTWN925 MDvws1x1BNbw8wYVJrgxwJRELuplZNplNHPLHOIDuF+fm02mhC2+vwBwVPs7BcpNF8cZ ATEDvwX0gCIZCsKAsKNpkax4BNZodf5KGp6WIDP23f/lMIDFDQR3Xbi4YwVQaGzF244g WJ+U/LzLr6mMl/j4Cn/5dNr5t+nC2Dwt3zQ8UJe+2UrXjuNfzoZWLeUbsM82DFqQhb4K DKbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VuD6rCvhxOSch1QmW7CafX0+vUh/pKa95M7G5Tk+xlM=; fh=1PLnUpFrVGspoqx5qZjM2Vxw617XgRnun2cLg4Dr5pc=; b=z6fy9KcVn5yKN3cJA5hmBlJvAWlVIIFnyxmcBpolsTXNwm5qGlYsXnEmD8njjo1c78 w7y9mN0Cazk/GR5PtfSDjO+ZzxrbBe9Y/oS1cqaVbx9tvoFEeLl47OZFntPPevfcDEyV rQOYQ8vnqm1L+IEYF0MlS8DNhjI9cQ1EMvAgVa0eEyXDTvke97SxajGl7v/CFrS5QQlm 053LL0LUEbjFpkXnHVsg3jEh7ljW1HvQ98yMEXlRzO8QcABOoEj0ZzlKiEQSQfyl0MOh VUxEJ75PNrc7UU241rMAKnLr0avf1casyzKBZh+Sk0uM9/SkAAM7Dy6saPWWY8xqW2/F ta7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X3eyeiLy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-152232-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152232-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s22-20020a056a00195600b006edced072bdsi4902012pfk.58.2024.04.20.03.54.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 03:54:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152232-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X3eyeiLy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-152232-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152232-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C3EC32815CA for ; Sat, 20 Apr 2024 10:54:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89B5A29CFA; Sat, 20 Apr 2024 10:53:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X3eyeiLy" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 676CC14273; Sat, 20 Apr 2024 10:53:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713610428; cv=none; b=dhiY3/x0/9/8c2XF3wZ3TuyZQtQSeoHqlsIJIg/Hgw9p3R4PBClSUWy2l0eIP2ae8MC5Y5E2CmmKKfdMzSSd0l7HaFbQMyvUaF2IxqBx1YPh/9YevN9N/+D6BvVZ9d9/aHcKceuFFeBOa1zEn/loWPRDysDt549816haSrqwOKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713610428; c=relaxed/simple; bh=SM7VfRahGBLcoMQTiuF9XwON0oAIQm3UPvX2eiqyDXo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B379p1/kc4juQFlkHH+3LJhZad49RSBm76RIHBkLVYifKzVKHEa96448eyXSnKi4w/TAZFTFpNipR/I9vPkm5C2+2oR/halV7ENDHl6/5mlL/V/TweTfv1cOIZGDJczKd52N/dDx8B+KIueL4VTLH5Jp94MLgvJcranozjJ/qiM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X3eyeiLy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F744C072AA; Sat, 20 Apr 2024 10:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713610427; bh=SM7VfRahGBLcoMQTiuF9XwON0oAIQm3UPvX2eiqyDXo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X3eyeiLylPAUkLSbyyrlGHXzvYV/bgYpLPhV7vw8xijwr2D1MExbuRdRactesAT8X zdt7h71F5DqBQu/eRbhv/5Y0Rre5yGM+3/QnKDXleUxYNRTZmWf1Vo3WU+1+o9lafL JRP9zqL5lB14IFxVzQv/2Y2x11fPGHO1UTIDooMmj7MCyEzwQSZ7FSoL/8Q352iA+B xJtavt8SFXQQ13eBr6UXoSA7CP3oDA+2zBywG990wKdhsiRvE/zNe3PUQwDEQ+0Y6e BUuBnLZ3CWf9tTcjXso+bnm9SeKBHDu3KkkjgF+H+J+dCs6K3ICndd93HsxM2BWoMW e8kLY5pax56uw== Date: Sat, 20 Apr 2024 13:52:27 +0300 From: Mike Rapoport To: Masami Hiramatsu Cc: Christophe Leroy , "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> <20240420181500.07b39c77f1ca086e8a5161b4@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240420181500.07b39c77f1ca086e8a5161b4@kernel.org> On Sat, Apr 20, 2024 at 06:15:00PM +0900, Masami Hiramatsu wrote: > On Sat, 20 Apr 2024 10:33:38 +0300 > Mike Rapoport wrote: > > > 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. > > Hmm, this part should be inline functions like; > > #ifdef CONFIG_MODULES > static inline bool module_is_coming(struct module *mod) > { > return mod->state == MODULE_STATE_COMING; > } > #else > #define module_is_coming(mod) (false) I'd prefer static inline module_is_coming(struct module *mod) { return false; } > #endif > > Then we don't need the enum. > Thank you, > > -- > Masami Hiramatsu (Google) -- Sincerely yours, Mike.