Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1137322lqt; Sat, 20 Apr 2024 02:15:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSp1JCRPhy9J5kmCTN/0psdSjdfNwHQGtPKCXp1S5yGm2SKfrsqI/ztjUP4d+lmjIs0lai1f2hlhuhZpsxBa8CGAyAkhAQgIDqAAIsgw== X-Google-Smtp-Source: AGHT+IG3wbx1y/vWsPEG3WOYD96E4G9OP1ieRCmQnzTB56PVl457yceFZsMuSDLbkb1Y9orM1xrS X-Received: by 2002:a17:90a:df12:b0:2a2:9464:f58 with SMTP id gp18-20020a17090adf1200b002a294640f58mr3868308pjb.49.1713604526596; Sat, 20 Apr 2024 02:15:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713604526; cv=pass; d=google.com; s=arc-20160816; b=GUlFGNYqy/U3W17JIA7eA7McilvU3kKgYX+QkJX7cA3655RUw0xqPN9gMqwgQ3ZR+A 9GvVORsji/7psu+AI008NEfUfdvIX5e5snCOoShQOUnvdh7Vce37zGizzl+9DvFyps0V WY8HW6YrsOWdFd4irXkj4f7digYGnhcutmZgpSZLxn1aWDkjZlhsJXR+0L+ZCy7qtjpL Wi1Tf44jYc9a486ti+6ZRlzgTNWHx8dFx4mbrwbDmNfdYXmGSBqa/fO9TjTrhT6qAT97 CS8G8Hzz4XNuSJKdOqGEd2ksZwTPWP152z5KHPRgUSkE18XZ6sOTtT7hYEaKf91kCc1F XX6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=AmoEP5EqNLaoMSApXxXfEao3NQocddZzEqTUNkpwMsc=; fh=PYUs/IhdrvBGGXDJohJ/u9KH61NQCpBswCEdx7jE0T4=; b=SCBwNw3tj/JyCHVrwDCFpLOrBd5QWPFslvU1TDMY4VI3YFGHLv+ixQE/BqLd5RymcU cMyB5FPaBYlabRzCvqxYqoXy9++4qiCvEERsDQKaQ0x6AQxKNbdWTx7Bj0AbwITeRwfi Jr24Lz0ehUhM1JiPrS4UNmj7uycBo2MVgtaSP88JZxZYn5pu0GyHfcImgQTOKHYCDIkD oPp8e4wApVIRr0HkwW+MhoRX+scXWXiYEZAmmIG64THVzZALP+ZQEyUXOmUhzIH+9scj 5TY5b1aeBXZKZdOYRTXryVfTDOKodvyS/Ey84EfcD+Ic9UsDSIaUs1TV9Gw/VgXWhftF A9jQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="aBds/mgW"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-152204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152204-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9-20020a17090a114900b002a5566ccf28si6119011pje.50.2024.04.20.02.15.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 02:15:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="aBds/mgW"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-152204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152204-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 3E72D280E36 for ; Sat, 20 Apr 2024 09:15:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A43717BCA; Sat, 20 Apr 2024 09:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aBds/mgW" 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 E762D15E97; Sat, 20 Apr 2024 09:15:11 +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=1713604512; cv=none; b=XkvVgKg40754WGadFyEP5bPSTb6qIzsLABd/NEOmdfxp1uULQTqydmU8LlnEWZJVp0Ksg0i6nl+FJD7LQox7GL3dTy1bXE5Mkzx54enwU7x2Bx8Cex8pD+40AZQJ3rL8SJohMnYQfI2GPtIE8ZavBE96euD54zytdK81UQqL1mE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713604512; c=relaxed/simple; bh=gV7rq1jKylsNR0A2TW7KiHW+6f/l5HNOVcKuwfOfcOQ=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=LBjTs2hbsPCIAlgtvKbUgbsqypO+T/7MtQzE4jgD+cAGVxcc/xrDf3ITUoWA3LzKWAe+LFhGzal4YkujVQ82v0vsslL9Zf9vUHB720HlqtGt/Mhhms+vjPgP/FaA0CQqXRlnThRmYxpCklI99eVO7DbFyJknsUMnJ0Opqdz7VPA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aBds/mgW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25CFFC072AA; Sat, 20 Apr 2024 09:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713604511; bh=gV7rq1jKylsNR0A2TW7KiHW+6f/l5HNOVcKuwfOfcOQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aBds/mgWklBGTNfKNq4+Z+94Zp0L3MS4pRFwWjdivOkW3wt77ZSOQfMjY+YYfJZ22 EbOsSdkOWssNdBi3AWqliDK9OwzxsFKXe7srGGHbb4foIL1rR+4xeE7wz/4thWRvf3 BmKK1D9Se8H0/h0Uw/vLAld6i8akxChgiSs8Oa4Avx+zJ1C5hFs5npdPznTRfCWZrf th5mEJA/mw5c94mvYsJOBeAvvZwpVWPpCkBwxsqSy7LgrPU1ayqlu8b38rvXCOVsAE WTdAfWWtTcOpMJCjvDynmh95BCxhT0vOjYzaGiV5GDS7KPjZZmh5efTkoPiO6btvOI JgxLZzkBg4/CA== Date: Sat, 20 Apr 2024 18:15:00 +0900 From: Masami Hiramatsu (Google) To: Mike Rapoport Cc: Christophe Leroy , "linux-kernel@vger.kernel.org" , Alexandre Ghiti , Andrew Morton , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , 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: <20240420181500.07b39c77f1ca086e8a5161b4@kernel.org> In-Reply-To: References: <20240411160051.2093261-1-rppt@kernel.org> <20240411160051.2093261-15-rppt@kernel.org> <20240418061615.5fad23b954bf317c029acc4d@gmail.com> <321def3e-8bf1-4920-92dd-037b20f1272d@csgroup.eu> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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=UTF-8 Content-Transfer-Encoding: 8bit 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) #endif Then we don't need the enum. Thank you, > > > > > > >> -- > > >> Masami Hiramatsu > > > > > -- > Sincerely yours, > Mike. > -- Masami Hiramatsu (Google)