From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793209551; b=OZ2FFFN1Dj4vNYL8+vjOX5xYrvo9KJdEWZjms4PvUi2VgGhowMIpd5oe3BCoVI0PRceC djQgTS26C8s+hbf3rSeKKOnSw5bLkccW41SR6BO14MTPV8f1asL0OF18u0DeLd2Oilvlo +4lLRaY/HpAx5ZJMWr3n/Ye7Z9f51SNWchX4APT68yJb/gMpzCMqLrHEaSWIBRIVjNK18 rjeOvNenxImgwLvT21CySC5Yx6O9ifCmXA96Iy5V5FbbuKUvz5bm1VKUuYoVvfIzdPStu VvONI7gmUjssddI+FYvQvxsaMSE4HbAYrLWpKBWofRfZgbCrdEMiiefca37d9Po2BWA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793209551; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=+PDapsyW9HS1xj7BsfwheswmXEVn9dz6J+HJ5v6wOdg=; b=JBzTwDjLcojkN7Zi1ltaY1LqXpmYdCggu7CONP+AMUpdauL14aApkLd+czxZdNZEGtqa Q/N1pCkldw4skZjJbPFyBswITsjQ7jVKXoGWOpomc3QoV4jaXyP5+mLbf381q04ukiKP0 Wp/1x1+yXibyM1c4ivETKmKUPj/qGfzbRPeWk6B5OPK89/F5UEQdfOP+v9gVcTapegzoE JH+eARsfmAPOlQ8eABhytnRqtkZ5pYC70sGrfgBddnc1Pdv5RcWNU1S669VZOsi/lLh2E eLlI/WCJkb9xavvty9zzo35zZARudG8sSbxA/x1XNgqk2TFOaBtHuzPOY266D9WDH+g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=MtIkEiY4; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83DE1606A31A; Wed, 28 Oct 2026 17:45:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=MtIkEiY4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4BDE1F01825; Wed, 28 Oct 2026 17:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793209551; bh=+PDapsyW9HS1xj7BsfwheswmXEVn9dz6J+HJ5v6wOdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MtIkEiY4MKyrQ174Gs/JDSWS0Mp750k/vCHpknQVTO3rPYL2+CMxjes9GrbQcm2g2 OuLjeAi1SPDXBCO4dK0FKP2hdk1HVAeOZggVY7xzkStEtdolhbe3AQrtjf3R1F9FbA IFEcy67bguFIzaMfn73OMndH1VuPeJxnKtyF44fM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, sashiko-bot@kernel.org, Donggeun Yoo , Steven Rostedt Subject: [PATCH 5.10 509/516] tracing: Fix 64-bit and signed histogram fields on 32-bit kernels Date: Wed, 28 Oct 2026 18:01:01 +0100 Message-ID: <20261028170015.535713833@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261028170003.522232767@linuxfoundation.org> References: <20261028170003.522232767@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Donggeun Yoo commit 443d23176812803d0fa182b8d05ef066a7b8271f upstream. DEFINE_HIST_FIELD_FN() reads a trace event field and widens it to the u64 the histogram uses as a key or a value: type *addr = (type *)(event + hist_field->field->offset); return (u64)(unsigned long)*addr; unsigned long is 32 bits on a 32-bit kernel, so the intermediate cast discards the upper half of a 64-bit field, and widens a signed field by zero extension from 32 bits rather than sign extension from its own width. Five of the eight instantiations are wrong there: s64, u64, s32, s16 and s8. The cast came in with commit 79e577cbce4c ("tracing: Support string type key properly"), which also added hist_field_dynstring() and hist_field_pstring(). Those convert a char * to u64 and do warn without an unsigned long in between on 32-bit. DEFINE_HIST_FIELD_FN() converts an integer and never a pointer, so it gains nothing from the cast and only loses information. Drop the intermediate cast and let the usual arithmetic conversions widen *addr according to its own type. unsigned long is 64 bits on LP64, so the two forms are identical there and 64-bit kernels are unaffected. Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260917015532.103081-1-donggeunyoo.kernel@gmail.com Fixes: 79e577cbce4c ("tracing: Support string type key properly") Reported-by: sashiko-bot@kernel.org Closes: https://lore.kernel.org/all/20260914054614.82A9B1F000FF@smtp.kernel.org/ Signed-off-by: Donggeun Yoo Signed-off-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_events_hist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -261,7 +261,7 @@ static u64 hist_field_unary_minus(struct { \ type *addr = (type *)(event + hist_field->field->offset); \ \ - return (u64)(unsigned long)*addr; \ + return (u64)*addr; \ } DEFINE_HIST_FIELD_FN(s64);