Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1105708lqt; Sat, 20 Apr 2024 00:35:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWJOi5Eyncxs4+AX1w+1RXpT3Yg8KMrNr4FfdMIxW01kYauJER4MVlsnbUojUOfi2x2hKQiaaQbhi776pvYP8coCppPqax5ZC/XPSwMKQ== X-Google-Smtp-Source: AGHT+IGUyH0aR6OWoFOogOvRBB58Y/r231kB5mr7kCSQK+iFUZCNgEdCJsBl0fQI9ffJuwS9txvD X-Received: by 2002:a05:622a:647:b0:439:613f:db7e with SMTP id a7-20020a05622a064700b00439613fdb7emr2626204qtb.0.1713598514686; Sat, 20 Apr 2024 00:35:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713598514; cv=pass; d=google.com; s=arc-20160816; b=VEEeNXfOGoEtAcLfI96kdz3JZfTmiBySxa8rRkhZpXRoBKfBG5MobSVxL4a3qPCjK7 8rBZ/wCY7SJUu2uBUHMGd1tDeBzvUAre/kt3bsY03EYBYrNhdKBYlpNPQFipgISm4GVE KdtPXe9It3PL5a4mS8uK1ICr81vW8ZeENXiC5IRjob4UCnRUZcBMwWbZo7U8Y4nmgTBN 9VLOPo3q8o+HhVj3elQPZgfZQrSjoi/r1oRG6p6vE7YY4m1Fx6jfVrZwx6hi4IMwR/ET S+EWzQE/BEoyjCR78UKtbwgtAn0BLX8ZHAoXDcUA0LOxCrPlksQ2JzSC+aa1b3Mo7loL s/Pw== 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=zb+Lcy8tVh1jiR7dc54rf0VFL8P5IXRm4rDjLSWD/aA=; fh=aTh+DRNPPtAiW5VSJxOrFOvVUlOLac0ox775GKE7Yss=; b=DDXUhK5qYEn7po+fPDWH6zZiD0gf8CRxV0XvYPq48cFuECfGu/CIXy2shqP/XlvYzj PeO68kU89O0+EqUw341PdiW6UPLpUDCFd/raCKWXW4LUDhTTcO9tZh+LfDBeB8LyrBfg ym8/k8i2iiJOHAPN9XbBwoXQShe5ylZomQBPW6W5p+jlUIOwGX6sw2oq73bxiIMlTL9A t7InV4RZEw8Gibb5eU+bDvTJ89JQw6FpUEy5ZoT+z+XEJzQPoq9dcnkN6dzx4r301JQg AntZLJwqua6qY9FSRB7BJzZlnwp2sJd2QWuTsVaeP/tsM8uCcy/EqpI3KXHHjRbIMyJQ j4VA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HstIwZ4k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-152165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h11-20020ac8584b000000b004390fc7486dsi2231211qth.461.2024.04.20.00.35.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 00:35:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HstIwZ4k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-152165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152165-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6AE9A1C208D1 for ; Sat, 20 Apr 2024 07:35:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99DE714F65; Sat, 20 Apr 2024 07:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HstIwZ4k" 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 90D4720EB; Sat, 20 Apr 2024 07:35:01 +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=1713598501; cv=none; b=NEJIQASP3Ux0IRBMlmLbRO1DwkcnRXowI+ccL0hzeoDZKOOfU8/RMng5REfSY15sIvPAzNlS6mvu+TCUmmUhN+BFpwP0C0eVoaEMIstQgbhVDGRD4clvXzmN0U3EWwboWhDps0TZVFWeJrUzCcWe2A99ek+g3H3KIYLKt2LVpNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713598501; c=relaxed/simple; bh=YQ9KfPtm5Gq9HYepBoPJrHlxAcwZYbjakD5piFpGBCI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XLxl6jNNEst2IqF5XyMzMm82Xg8yJj4+7+iWllu0I+9/7J/iwHLHvBsh8AuzwxMOwekkExF8wcmFVqi/Cg8qyyN3l4WwEDpA1H12Ki3o1gYt2QeHg7FwgCnr1Vof9BkqkBnCwGTNYSzmQ6N+NLAkyoeBp99rBZLphCBV9icN8UQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HstIwZ4k; arc=none smtp.client-ip=10.30.226.201 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> 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: <321def3e-8bf1-4920-92dd-037b20f1272d@csgroup.eu> 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.