Skip to contentSkip to conversation

tracing/remotes: Align field offset in remote_event_format_show()

PATCH In review Vincent Donnefort 2 participants 2 messages Oct 9 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing/remotes: Align field offset in remote_event_format_show()

remote_event_format_show() doesn't take into account each field's alignment leading to an incorrect reporting of the actual field offset. Use the existing field->align.

Fixes 072529158e60 ("tracing: Add events to trace remotes")
---
 kernel/trace/trace_remote.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_remote.c +1 -0
index 2d5bc423efca..7e35f48ae467 100644
@@ -1098,6 +1098,7 @@ static int remote_event_format_show(struct seq_file *s, void *unused)
 
 	field = &evt->fields[0];
 	while (field->name) {
+		offset = ALIGN(offset, field->align);
 		seq_printf(s, "\tfield:%s %s;\toffset:%zu;\tsize:%u;\tsigned:%d;\n",
 			   field->type, field->name, offset, field->size,
 			   field->is_signed);

base-commit: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a

Signature · 1 line
2.56.0.385.gd3acb90ef8-goog
Reviewed-by Tested-by on v1 1/1
#1 lore raw

Hi Vincent,

Quoted 3 lines · Vincent Donnefort

remote_event_format_show() doesn't take into account each field's alignment leading to an incorrect reporting of the actual field offset. Use the existing field->align.

Tested in pKVM: the format files under remotes/hypervisor now report hyp_enter's vcpu at offset 4 and selftest's id at 8, matching the structs, and the hypervisor ftracetest still passes.

Cheers,
/fuad