Skip to contentSkip to conversation

profiling-fix-sampling-step-on-64-bit-big-endian-systems.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Oct 24

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: profiling: fix sampling step on 64-bit big-endian systems
has been removed from the -mm tree. Its filename was
profiling-fix-sampling-step-on-64-bit-big-endian-systems.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Avi Weiss <[email protected]>
Subject: profiling: fix sampling step on 64-bit big-endian systems
Date: Tue, 20 Oct 2026 13:12:24 +0300

read_profile() stores the sampling step in an unsigned long but copies only four bytes to userspace. On 64-bit big-endian systems (not common obviously), this copies the upper 32 bits and discards the rest, causing /proc/profile to report zero for normal shift values.

Cast to unsigned int so we get the correct 4 bytes, while keeping the shift calculation in unsigned long.

A small C reproducer under qemu-s390x reproduced this and proved the fix works for prof_shift=2.

Fixes 2d186afd04d6 ("profiling: fix shift-out-of-bounds bugs")

---

 kernel/profile.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/profile.c renamed from kernel/profile.c~profiling-fix-sampling-step-on-64-bit-big-endian-systems +1 -1
@@ -156,7 +156,7 @@ read_profile(struct file *file, char __u
 	unsigned long p = *ppos;
 	ssize_t read;
 	char *pnt;
-	unsigned long sample_step = 1UL << prof_shift;
+	unsigned int sample_step = (unsigned int)(1UL << prof_shift);
 
 	if (p >= (prof_len+1)*sizeof(unsigned int))
 		return 0;

_

Patches currently in -mm which might be from [email protected] are