Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp89267lqo; Wed, 27 Mar 2024 07:42:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8HAdq939xWVPXFnzngJIC2hxYC6UDt13LFnaGG8wNlr3a07/20OlomvndEzA1KmvjxYBHmj7TSQ4igMa12Dfs4OV5jy4XNYJeQWt3Zw== X-Google-Smtp-Source: AGHT+IHtixSwpEu6PnrLYGpYp+gmomNcGoKgbgp4aiIDFmupc9iQEKH4AbMclLL7vQqF2e5l2+J8 X-Received: by 2002:a9d:6a88:0:b0:6e5:22d6:5197 with SMTP id l8-20020a9d6a88000000b006e522d65197mr135016otq.23.1711550551334; Wed, 27 Mar 2024 07:42:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711550551; cv=pass; d=google.com; s=arc-20160816; b=YAlT3RZ7j1uNPBkjxQrlN6PZlGs7FWWF73J4fntznsdFxgO71wOJjZcTq4SeipOc9g DHiORKVZ9UKjbPJiePIetxvhNdIbzhkVxYUD+0CPWiCxruX+EFQHQFGmahjvhyIy26XF eLucA9KvZy71sEYLMLqYfQPh1Hmh+B2uXjE9mdgdomXtnm6LkK5TtvL5PBwtn7NuClSo kduz4JztvILwzJTXY1j6q3j7y5dTnX+amoEGqVg/3znW+WVKpr9jVndXJZoXevI489ms uXj7CP3UQjTxY/q1Oe7LyP1dhbosAeI1Y21stHUVjXN7Gfc0Fe5+yt6nxaIuC7CvJQfg 5k/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=LJgS6pfD5X5wZr4AP6C4oimCSt1Sxdd/qzcmz4ny2SY=; fh=1cX66fQMLY4XA9h7hBSb41FQkvH9Qozj5ASRgUt0SCM=; b=zPwdj2YErk4650Ux6xgN/A0W59fexG1MIQFu1xAxGBGDhNsrraK8IqV4ZO1gN5gG23 A1sZj4O0drironofL6BpOskY/r2ChTl5aIIg5vanEWsQVZ9I+Q9+U5kL8WXyN7Jk/FLv ZV/TsmkuNA3wRrrvlVOk6q78R9mBM9yjquvPFmWsatD7chYad80XC5wyU1DDeN8xsAhg kgNGeiInyi1nUNUCWqo6waJy4h06/PNxAXofHaWNOTP7ULpU1D+Zpzw2bM1cIH0cCKgN SI+QDKS/D6b05MTnq2vuww2lIxEBTBvIohs2A7JBsWPQLPSO2cAMoMFHxI6DbhD0EcqT 5gfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z+b05JUj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-121360-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121360-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y26-20020a37e31a000000b00788748a69ddsi10012397qki.87.2024.03.27.07.42.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 07:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121360-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z+b05JUj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-121360-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121360-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 131271C27775 for ; Wed, 27 Mar 2024 14:42:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 623BC13957F; Wed, 27 Mar 2024 13:23:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z+b05JUj" 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 80E9A127B5F for ; Wed, 27 Mar 2024 13:23:30 +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=1711545810; cv=none; b=hpB1m+s8yfREsPmC9eYj8qxqZ952JZ+WyJ/uuxnpzPTFpfiOMiO8leN99rVeoGo5XGGHhj1PczgNCAcsPYCujHcD92lxnUENtvhjanqm3XmEKGzQ/ge5+lIx3jSms75xCvJJXu+g5/By9EWOmRgWELR3lj9iPnyYJWHRsFYO1B4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711545810; c=relaxed/simple; bh=U7abAYA8MCl0AIbIYaTfhg3/P08q63VTWwI22U1GpRo=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=lU99OqbN0bLmmaY7A2in8p3ALNbM8eZX2d66Smmr7rLNFR/363OKIYAn6BbQNsmS3f7edNpLtc/vFOYGavFASp/CpOYt6Zui2rUK5D8/NvITNUU+20fXjgQhvWd/mVEPyfT/+BEGM2YCxy2+Z/PaQPj0YQ32Q0+TtrIF1gdS3zw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z+b05JUj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A6AAC43394; Wed, 27 Mar 2024 13:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711545810; bh=U7abAYA8MCl0AIbIYaTfhg3/P08q63VTWwI22U1GpRo=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Z+b05JUje7LfkVLWp2X/on6sDdqTF4W2g/f4omGVP4ZosDCiI3xVXCdCEClOLvID7 KLVVoNUWBnDIhjDIHxZtuIj2ZOjUOz1tElMOQIu1VuSt5Ky6nWuDbVGthZHXHmsxrE eqtaKq1V2ABFMCS/OfnPQOPMp2IpfLPX0NFOJWSZ+yn/9kPaW6UZYyDE3s3WdXVyfE FEKeg0OIodQL7NKr3+KwJbOduoWiciKPsUfDCuADvVppCjAz2l7KWel9y5Plpfa2yq wjsxnN9rtfXsrAXII+73GJ9Ja0NLXgCHTuYyESt4y5wT2wFbB5M8TAGiuIaWU2/HL4 i/kiwtdft8dAA== Message-ID: Subject: Re: [PATCH 4/4] kprobes: Remove core dependency on modules From: Jarkko Sakkinen To: Masami Hiramatsu , Mark Rutland Cc: linux-kernel@vger.kernel.org, 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, jcalvinowens@gmail.com, linux-arm-kernel@lists.infradead.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 Date: Wed, 27 Mar 2024 15:23:24 +0200 In-Reply-To: <20240327090155.873f1ed32700dbdb75f8eada@kernel.org> References: <20240326163624.3253157-1-mark.rutland@arm.com> <20240326163624.3253157-5-mark.rutland@arm.com> <20240327090155.873f1ed32700dbdb75f8eada@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Wed, 2024-03-27 at 09:01 +0900, Masami Hiramatsu wrote: > On Tue, 26 Mar 2024 17:38:18 +0000 > Mark Rutland wrote: >=20 > > On Tue, Mar 26, 2024 at 07:13:51PM +0200, Jarkko Sakkinen wrote: > > > On Tue Mar 26, 2024 at 6:36 PM EET, Mark Rutland wrote: > >=20 > > > > +#ifdef CONFIG_MODULES > > > > =C2=A0 /* Check if 'p' is probing a module. */ > > > > =C2=A0 *probed_mod =3D __module_text_address((unsigned long) p- > > > > >addr); > > > > =C2=A0 if (*probed_mod) { > > > > @@ -1605,6 +1606,8 @@ static int > > > > check_kprobe_address_safe(struct kprobe *p, > > > > =C2=A0 ret =3D -ENOENT; > > > > =C2=A0 } > > > > =C2=A0 } > > > > +#endif > > >=20 > > > This can be scoped a bit more (see v7 of my patch set). > >=20 > > > > +#ifdef CONFIG_MODULES > > > > =C2=A0static nokprobe_inline bool trace_kprobe_module_exist(struct > > > > trace_kprobe *tk) > > > > =C2=A0{ > > > > =C2=A0 char *p; > > > > @@ -129,6 +130,9 @@ static nokprobe_inline bool > > > > trace_kprobe_module_exist(struct trace_kprobe *tk) > > > > =C2=A0 > > > > =C2=A0 return ret; > > > > =C2=A0} > > > > +#else > > > > +#define trace_kprobe_module_exist(tk) false /* aka a module > > > > never exists */ > > > > +#endif /* CONFIG_MODULES */ > > > > =C2=A0 > > > > =C2=A0static bool trace_kprobe_is_busy(struct dyn_event *ev) > > > > =C2=A0{ > > > > @@ -670,6 +674,7 @@ static int register_trace_kprobe(struct > > > > trace_kprobe *tk) > > > > =C2=A0 return ret; > > > > =C2=A0} > > > > =C2=A0 > > > > +#ifdef CONFIG_MODULES > > > > =C2=A0/* Module notifier call back, checking event on the module */ > > > > =C2=A0static int trace_kprobe_module_callback(struct notifier_block > > > > *nb, > > > > =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unsigned long val, v= oid > > > > *data) > > > > @@ -699,6 +704,9 @@ static int > > > > trace_kprobe_module_callback(struct notifier_block *nb, > > > > =C2=A0 > > > > =C2=A0 return NOTIFY_DONE; > > > > =C2=A0} > > > > +#else > > > > +#define trace_kprobe_module_callback (NULL) > > > > +#endif /* CONFIG_MODULES */ > > >=20 > > > The last two CONFIG_MODULES sections could be combined. This was > > > also in > > > v7. > >=20 > > > Other than lgtm. > >=20 > > Great! I've folded your v7 changes in, and pushed that out to: > >=20 > > =C2=A0 > > https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h= =3Dkprobes/without-modules > >=20 > > I'll hold off sending that out to the list until other folk have > > had a chance > > to comment. >=20 > Yeah, the updated one looks good to me too. >=20 > Thanks! Yeah, I'm also planning to test this with x86 instrumenting sgx_* calls as I need to test the cgroups support for it so can help with the coverage both RISC-V and x86 (as I find a good time slot). BR, Jarkko