Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2635142lqz; Wed, 3 Apr 2024 04:20:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWKWH1BfhB52c9gNI4p5DoysbMkHypXxJIe1Q6TVCwtRwm6xWnP35G2/7kGYCe3FC2Rmh46Fn+d1jzqnrG5iJtIZUSdf9VETc4NWq+gOQ== X-Google-Smtp-Source: AGHT+IG1mEzqFT8qKqrA0aM86K0YCt5krrNin9zcaD0sj1nex/m7VHkCdQ2X4foKocdFed5oG/Zu X-Received: by 2002:a50:8713:0:b0:56e:aca:83d1 with SMTP id i19-20020a508713000000b0056e0aca83d1mr796236edb.38.1712143255550; Wed, 03 Apr 2024 04:20:55 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u26-20020a50a41a000000b0056df1e895a9si1487453edb.355.2024.04.03.04.20.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 04:20:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-129654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129654-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4AF851F270E9 for ; Wed, 3 Apr 2024 11:20:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8ABD7142E8A; Wed, 3 Apr 2024 11:20:47 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B27D973506 for ; Wed, 3 Apr 2024 11:20:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712143247; cv=none; b=Zc7QThrhFjRCYPuFsbEx38wnAZJ4DPrhYjgXH9aiU/Kc3ytdupQdWGxHlZQJ35LyDkX1h2HEN0UNmgLy/gfwLIdSrSaLG5f0QZ8dwOQ5DweDVGmYyLuJJAr4RoGO0/ONPhhfAlsmOM4/AJkcyF1jX+kWvMtIJ3A7VUdkIhE9Rgc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712143247; c=relaxed/simple; bh=S6kayVt4WvqiDLd16zycrRONGPF78Qx9a0MeQPkyGFg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=evOkM84Lu4gVXMxaRgOgv10u8JKtNIE9BfJfanMb/adffQt7b/tNr0HrnwTHkT0iEEreWm+Tky8AP9rOGZVCRnVLMINUc27stAnEei9M3fPfvWY7C4qLJlaMbcSiRb5vaFRkBbplgWgMJjY9lt/0pBdsYaGKAwzOVwOJmC8HoHQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 132641007; Wed, 3 Apr 2024 04:21:16 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.16.212]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 84A8A3F64C; Wed, 3 Apr 2024 04:20:41 -0700 (PDT) Date: Wed, 3 Apr 2024 12:20:38 +0100 From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: agordeev@linux.ibm.com, anil.s.keshavamurthy@intel.com, aou@eecs.berkeley.edu, bp@alien8.de, catalin.marinas@arm.com, dave.hansen@linux.intel.com, davem@davemloft.net, gor@linux.ibm.com, hca@linux.ibm.com, jarkko@kernel.org, jcalvinowens@gmail.com, linux-arm-kernel@lists.infradead.org, mhiramat@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, palmer@dabbelt.com, paul.walmsley@sifive.com, tglx@linutronix.de, will@kernel.org Subject: Re: [PATCH 4/4] kprobes: Remove core dependency on modules Message-ID: References: <20240326163624.3253157-1-mark.rutland@arm.com> <20240326163624.3253157-5-mark.rutland@arm.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240326163624.3253157-5-mark.rutland@arm.com> On Tue, Mar 26, 2024 at 04:36:24PM +0000, Mark Rutland wrote: > From: Jarkko Sakkinen > > Tracing with kprobes while running a monolithic kernel is currently > impossible because KPROBES depends on MODULES. While this dependency is > necessary when KPROBES_USE_MODULE_ALLOC=y, all the other module-specific > code only exist to handle the case when MODULES=y, and can be hidden > behind ifdeffery. > > Add the necessary ifdeffery, and remove the dependency on MODULES=N when > KPROBES_USE_MODULE_ALLOC=n. > > Currently this allows kprobes to be used when CONFIG_MODULES=n on arm64 > and riscv, and other architectures can enable support by implementing > their own kprobes_alloc_insn_page() and kprobes_free_insn_page() which > do not depend on MODULES. > > Signed-off-by: Jarkko Sakkinen > Link: https://lore.kernel.org/all/20240326012102.27438-1-jarkko@kernel.org/ > [Mark: Remove execmem changes, depend on !KPROBES_USE_MODULE_ALLOC] > Signed-off-by: Mark Rutland > Cc: Anil S Keshavamurthy > Cc: David S. Miller > Cc: Jarkko Sakkinen > Cc: Masami Hiramatsu > Cc: Naveen N. Rao > --- > arch/Kconfig | 2 +- > kernel/kprobes.c | 12 +++++++++++- > kernel/trace/trace_kprobe.c | 15 +++++++++++++-- > 3 files changed, 25 insertions(+), 4 deletions(-) > > diff --git a/arch/Kconfig b/arch/Kconfig > index 85bb59f7b8c07..cf43de9ffb5b9 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -52,7 +52,7 @@ config GENERIC_ENTRY > > config KPROBES > bool "Kprobes" > - depends on MODULES > + depends on MODULES || !KPROBES_USE_MODULE_ALLOC Whoops; that should be: depends on MODULES || HAVE_KPROBES_ALLOC .. with similar fixups in the commit message to describe HAVE_KPROBES_ALLOC rather than KPROBES_USE_MODULE_ALLOC (which does not exist in any version of the series that got sent to the list). I'll send a v2 with that fixed (and the other changes from Jarkko's v7 base patch) once I've locally tested that for architectures with and without HAVE_KPROBES_ALLOC. Mark.