Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2810267lqz; Wed, 3 Apr 2024 09:11:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUS/TkHwqlwm8ByKrJHBYwtOlNn/ZALBUjhgVspxalVq7sZ33VNPLAt0L1Vw3MSflngXl7lLLlqCBdgxbeum0D4e7NO54Yi+UI7eWg1Ng== X-Google-Smtp-Source: AGHT+IHVLXEwyL/Pw/xQQzsRcjMSP5oFe+pDbARFwjCfDrkVWO/CSXYhhlFsuwdDCujmSMQIataT X-Received: by 2002:a17:906:cf87:b0:a45:f4d9:acc5 with SMTP id um7-20020a170906cf8700b00a45f4d9acc5mr1921295ejb.29.1712160672260; Wed, 03 Apr 2024 09:11:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712160672; cv=pass; d=google.com; s=arc-20160816; b=R6R6mBLpXI8kzEX8C5IoXTU9CeTgouaZmIBLMdPfSP3phB6PYHe3WLO34mkJ+pLjfJ 4eJHuOBBepddbZrnoO1pQha2VrpJJunj7yRiI2W+Ixz0HYDa4dJkcftlyt+fbZZhCdkX 3cTx7/LbRF0Npdc2T7cil9XFA2X1CX/mEIeHoPSsjuytyrSXHAXJNsXlNhfnSHHffWNn X81/9zhekxC9k0zhEMh2qDJ8BvGpXebNTVNiBl7kX053UmkMugRHaIPzvOfp0OQLb4Cm wA5rN/DQX9NYqCC9bqgA4dVI7DLru3Wl1+t39M+2KSEkuXeySCywsPyrf/uy9rMIJZbg Bbew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=8SaZHuoSOvzFGJ3KhvTw9jgsRyY/UYjt1dl/0qTwXQ4=; fh=1aWX4RRS5CjZep4bcBRWxLuRek/SeH4MBLZtFrQeaxU=; b=rzBW8Z6mSRx1QfsdunzCp6oRhOtY6ith6t7f7mUvkP6EeXLM6WcL5h4mcv58yn7C8d RLZY3S6lVf9PGaljCxAjMBCJodMdAtPxCpZkgUNULurahFMLyg7WOo+rJq0ng+6lkqL5 Fxvo9AxNYu/hT918uufZobVWi+wDTswrmYT8TK2df9snKLEwdFf2gzudhcck2bNKQRjZ 1g3BYAHz2Fv8ysQKVBjF28PuXiJyNRgN+HYdGLiZdEAlNGopA/knMwlBKYwDKIhhRgds oWUhpVVkqeD1i+Mo8mProWEglemL8sUzxHpRwPqGsYkzpXisFksLadiqe/TA8nN4+3hB aRFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gjPhTdrk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id nc19-20020a1709071c1300b00a4e539d21f4si4492919ejc.166.2024.04.03.09.11.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gjPhTdrk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130173-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 033FE1F222B2 for ; Wed, 3 Apr 2024 16:11:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60D9D14EC48; Wed, 3 Apr 2024 16:11:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gjPhTdrk" 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 8A73714B073 for ; Wed, 3 Apr 2024 16:11:04 +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=1712160664; cv=none; b=PrDGrv5Spk8tEALL8q6A5LxLNegdsSnapjlDxSEOQZX55SYOibkK0q/H4mibOr23rToVYLWvqCktFY/y9WLkHjJGBeGY13//4jTVwwCZBZ2EwSfSO9bPVAMHme+vJZlgctxCovlrGZkNSyL8MXPutIjotkYb4nIoaQmBip6fkOs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712160664; c=relaxed/simple; bh=nyU0F3ej83LHBArYWvHTmUMX9HPrzUZJ7A/Qsu6qybw=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=sR3gUkVP1gE7vDeIl6Plv8BXlXHlJFYASBcHf1HAffhGVTjeOoHyggRA2dYQRjQXAKveAvhYyaqqSgzzUVbwKu8ZQdve3wHZBkESItpsjwBDOp9BhOtQXfkUw7lmN7Fjy2hj8vch/XQl19pgLXPan3JVLV66RYh4surQjQNlBmM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gjPhTdrk; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 167ACC433C7; Wed, 3 Apr 2024 16:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712160664; bh=nyU0F3ej83LHBArYWvHTmUMX9HPrzUZJ7A/Qsu6qybw=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=gjPhTdrkX6vjBSuS+zaKuaiyoGR/UHwImYh5jczdwkYJGVKzTI8yf2hpvYuYivheF 9cAasLK2QGmMR19zPptwl9h0ZbUmVIMRICLp23Kjwu2VcYz0+/6ZeLdy4bzT59PDc2 l63iyGVEr2qZXLKQT6+2lXJITHV3yENnPasAhVdiRKDDtUBVDx+h/fqVo0cbFGV7t1 u7dlbbHFhMewEnqBVLHRm7gTFbvCN1GWPuV+Llr16q96XepFSjlvVBfIIp39cnhcMb LqkfZqDv4tft76m0tI2QRTWTUo2DDnMJBAR90COOO/G7XwDSHBgrqRskp2gieKHvJt RLvt1DTrQcT8g== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 03 Apr 2024 19:10:58 +0300 Message-Id: Cc: , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH 4/4] kprobes: Remove core dependency on modules From: "Jarkko Sakkinen" To: "Mark Rutland" , X-Mailer: aerc 0.17.0 References: <20240326163624.3253157-1-mark.rutland@arm.com> <20240326163624.3253157-5-mark.rutland@arm.com> In-Reply-To: On Wed Apr 3, 2024 at 2:20 PM EEST, Mark Rutland wrote: > On Tue, Mar 26, 2024 at 04:36:24PM +0000, Mark Rutland wrote: > > From: Jarkko Sakkinen > >=20 > > 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=3Dy, all the other module-speci= fic > > code only exist to handle the case when MODULES=3Dy, and can be hidden > > behind ifdeffery. > >=20 > > Add the necessary ifdeffery, and remove the dependency on MODULES=3DN w= hen > > KPROBES_USE_MODULE_ALLOC=3Dn. > >=20 > > Currently this allows kprobes to be used when CONFIG_MODULES=3Dn on arm= 64 > > 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. > >=20 > > 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(-) > >=20 > > 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 > > =20 > > 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_AL= LOC > 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 ba= se > patch) once I've locally tested that for architectures with and without > HAVE_KPROBES_ALLOC. OK, please put to me to the CC list as I'm not ATM subscribed to the tracing list. BR, Jarkko