Skip to contentSkip to conversation

xfs_logprint: fix pointer bug

PATCH In review Darrick J. Wong 3 participants 6 messages Dec 9, 2025 – Dec 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_logprint: fix pointer bug

From: Darrick J. Wong <[email protected]>

generic/055 captures a crash in xfs_logprint due to an incorrect refactoring trying to increment a pointer-to-pointer whereas before it incremented a pointer.

Fixes 5a9b7e95140893 ("logprint: factor out a xlog_print_op helper")
---
 logprint/log_misc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
logprint/log_misc.c +1 -1
index 16353ebd728f35..8e0589c161b871 100644
@@ -992,7 +992,7 @@ xlog_print_op(
 			printf("0x%02x ", (unsigned int)**ptr);
 			if (n % 16 == 15)
 				printf("\n");
-			ptr++;
+			(*ptr)++;
 		}
 		printf("\n");
 		return true;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

generic/055 captures a crash in xfs_logprint due to an incorrect refactoring trying to increment a pointer-to-pointer whereas before it incremented a pointer.

Oops, sorry. This somehow did not show up in xfstests for me, where did you run into it?

Looks good:

#2 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

generic/055 captures a crash in xfs_logprint due to an incorrect refactoring trying to increment a pointer-to-pointer whereas before it incremented a pointer.

Oops, sorry. This somehow did not show up in xfstests for me, where did you run into it?

FSTYP         -- xfs (debug)
PLATFORM      -- Linux/x86_64 ca-nfsdev5-mtr00 6.18.0-xfsx #6 SMP PREEMPT_DYNAMIC Tue Dec  9 10:29:14 PST 2025
MKFS_OPTIONS  -- -f -m metadir=1,autofsck=1,uquota,gquota,pquota, -n size=8k, /dev/sdf

MOUNT_OPTIONS -- /dev/sdf /opt

Quoted 3 lines

Looks good:

Full log here
https://djwong.org/fstests/output/ca-nfsdev5-mtr00/ca-nfsdev5-mtr00_2025-12-09_18-36-11/generic_055.full.br

user aibots
pass suck

--D

#3 lore raw
Quoted 14 lines · Darrick J. Wong
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

generic/055 captures a crash in xfs_logprint due to an incorrect refactoring trying to increment a pointer-to-pointer whereas before it incremented a pointer.

Oops, sorry. This somehow did not show up in xfstests for me, where did you run into it?

FSTYP         -- xfs (debug)
PLATFORM      -- Linux/x86_64 ca-nfsdev5-mtr00 6.18.0-xfsx #6 SMP PREEMPT_DYNAMIC Tue Dec  9 10:29:14 PST 2025
MKFS_OPTIONS  -- -f -m metadir=1,autofsck=1,uquota,gquota,pquota, -n size=8k, /dev/sdf
Quoted 8 lines

MOUNT_OPTIONS -- /dev/sdf /opt

Quoted 3 lines

Looks good:

Full log here
https://djwong.org/fstests/output/ca-nfsdev5-mtr00/ca-nfsdev5-mtr00_2025-12-09_18-36-11/generic_055.full.br

Hmm, generic/044...

Quoted 2 lines

user aibots
pass suck

?

#4 lore raw
In reply to Darrick J. Wong
Quoted 18 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

generic/055 captures a crash in xfs_logprint due to an incorrect refactoring trying to increment a pointer-to-pointer whereas before it incremented a pointer.

Fixes 5a9b7e95140893 ("logprint: factor out a xlog_print_op helper")
---
 logprint/log_misc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
logprint/log_misc.c +0 -0
index 16353ebd728f35..8e0589c161b871 100644

logprint/log_misc.c xlog_print_op( · line 998

Quoted 8 lines
logprint/log_misc.c +1 -1
@@ -992,7 +992,7 @@ xlog_print_op(
 			printf("0x%02x ", (unsigned int)**ptr);
 			if (n % 16 == 15)
 				printf("\n");
-			ptr++;
+			(*ptr)++;
 		}
 		printf("\n");
 		return true;

Hmm, checking the results I also see the segfauls in 055.full but test is passing. Is there any xfstests setting to make it fail on coredumps/segfaults?

Signature · 1 line
- Andrey
#5 lore raw
Quoted 23 lines · Andrey Albershteyn
Quoted 22 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

generic/055 captures a crash in xfs_logprint due to an incorrect refactoring trying to increment a pointer-to-pointer whereas before it incremented a pointer.

Fixes 5a9b7e95140893 ("logprint: factor out a xlog_print_op helper")
---
 logprint/log_misc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
logprint/log_misc.c +1 -1
index 16353ebd728f35..8e0589c161b871 100644
@@ -992,7 +992,7 @@ xlog_print_op(
 			printf("0x%02x ", (unsigned int)**ptr);
 			if (n % 16 == 15)
 				printf("\n");
-			ptr++;
+			(*ptr)++;
Quoted 8 lines

logprint/log_misc.c xlog_print_op( · line 998

Quoted 4 lines
logprint/log_misc.c +0 -0
 		}
 		printf("\n");
 		return true;

Hmm, checking the results I also see the segfauls in 055.full but test is passing. Is there any xfstests setting to make it fail on coredumps/segfaults?

Well in theory it already captures coredumps ... if they're named "core" and get written to $here. But then coredumpctl intervenes and whisks them all away so fstests never sees them.

Starting Nov 2025, fstests can query coredumps from systemd:
https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git/commit/?id=9886baabdec372387b5e874fdcaf59390a75f4a9

though obviously this isn't compatible with check-parallel because there's no good way to tag a process tree for coredumpctl so that you can query dumps only from that tree later.

--D

Quoted 4 lines
Signature · 1 line
- Andrey