From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="Y36OvVre"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="RB8oYVKs" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E3EB10C4 for ; Sat, 9 Dec 2023 04:20:13 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 05BE73200C9F; Sat, 9 Dec 2023 07:20:11 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 09 Dec 2023 07:20:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1702124411; x=1702210811; bh=AUdI2/H3TJofTowYr1gIaAWbIWHtgQ1LSy6 E4A9WJwA=; b=Y36OvVreWzqi2aClkPAOhko+mCMpZCmEotNJGsKyf0JFpsjs1Yg 3qu5pokjpkj9SGlWVWxVuJe4X+XSiDcCznxKlFE/a37VnuOvi64cH22T4vsgIRnw 3b5elZqWevZJmG4k4vu6uB/qg9yPRYaS4eyI/HNSVcfze9sPbNgrLwKgp5Hx7FyB uxQUHB8lAd1PLlojMa6UNM+wmLYKKu7u8lQSHhXfbLAfutuWe1WVqKgzY9XSFzWT PoLnBqyaHoc/Y0yokvNEeV926QEqW1k+wKzO3PmY4M0LK0IpYPL0s4l1BPsRQrxW LwB0rbNCSl0MnIzestHULyfJFvrAy+l3Pag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1702124411; x=1702210811; bh=AUdI2/H3TJofTowYr1gIaAWbIWHtgQ1LSy6 E4A9WJwA=; b=RB8oYVKsuUpnMdUMGtL62uMHtV30/bQiUMulPrMd8RZkpZP/zqW rJA+eKMuyOeMCxQnOqVGqP8uspsUYxQTKUHygijd7OZIJ3DL/FJ5Ciq8Po1nzBTz gwmfRurMnlFx678Z5GUO2Faq59mH8X5idoFhUt4u24uewI/D+dO6oUldUNccDE5W dh0ryxo/eV84DunMtrMwYMnj2V/AGhCmpQcgepGhBWvKWd/EcQmY1zEETGh71p4+ 3i0wlxLxC0pQ2m0B82tgFylggdhHR6xX+27+NouIZvtZn28x5CReo3T30W7hLYX2 8vwZbRfg3vzZNDd0aOo1x6EOcgjwXB+VTFg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudekkedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfhfgggtugfgjgesth ekredttddtjeenucfhrhhomhepifhrvghgucfmjfcuoehgrhgvgheskhhrohgrhhdrtgho mheqnecuggftrfgrthhtvghrnhepleekheejjeeiheejvdetheejveekudegueeigfefud efgfffhfefteeuieekudefnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhroh grhhdrtghomh X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Dec 2023 07:20:10 -0500 (EST) Date: Sat, 9 Dec 2023 13:20:09 +0100 From: Greg KH To: mhiramat@kernel.org Cc: stable@vger.kernel.org, JP Kobryn Subject: Re: [PATCH 6.6.y] kprobes: consistent rcu api usage for kretprobe holder Message-ID: <2023120932-follow-willow-32f3@gregkh> References: <2023120316-seduce-vehicular-9e78@gregkh> <20231206015711.39492-1-mhiramat@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231206015711.39492-1-mhiramat@kernel.org> On Wed, Dec 06, 2023 at 10:57:11AM +0900, mhiramat@kernel.org wrote: > From: JP Kobryn > > It seems that the pointer-to-kretprobe "rp" within the kretprobe_holder is > RCU-managed, based on the (non-rethook) implementation of get_kretprobe(). > The thought behind this patch is to make use of the RCU API where possible > when accessing this pointer so that the needed barriers are always in place > and to self-document the code. > > The __rcu annotation to "rp" allows for sparse RCU checking. Plain writes > done to the "rp" pointer are changed to make use of the RCU macro for > assignment. For the single read, the implementation of get_kretprobe() > is simplified by making use of an RCU macro which accomplishes the same, > but note that the log warning text will be more generic. > > I did find that there is a difference in assembly generated between the > usage of the RCU macros vs without. For example, on arm64, when using > rcu_assign_pointer(), the corresponding store instruction is a > store-release (STLR) which has an implicit barrier. When normal assignment > is done, a regular store (STR) is found. In the macro case, this seems to > be a result of rcu_assign_pointer() using smp_store_release() when the > value to write is not NULL. > > Link: https://lore.kernel.org/all/20231122132058.3359-1-inwardvessel@gmail.com/ > > Fixes: d741bf41d7c7 ("kprobes: Remove kretprobe hash") > Cc: stable@vger.kernel.org > Signed-off-by: JP Kobryn > Acked-by: Masami Hiramatsu (Google) > Signed-off-by: Masami Hiramatsu (Google) > (cherry picked from commit d839a656d0f3caca9f96e9bf912fd394ac6a11bc) > --- > include/linux/kprobes.h | 8 +++----- > kernel/kprobes.c | 4 ++-- > 2 files changed, 5 insertions(+), 7 deletions(-) Did you build this? It breaks the build in 6.6.y in horrible ways: ./include/linux/kprobes.h:145:33: error: field ‘pool’ has incomplete type 145 | struct objpool_head pool; | ^~~~ I'll drop this, can you please provide a working version? thanks, greg k-h