From: Andi Kleen <a...@linux.intel.com> __output_copy always pads byte sized fields to a multiple of u64. This was not documented in the perf_event.h documentation. Explicitly mention this in the comments.
Also add notes that the strings are 0 terminated. Only comments are changed. Cc: eran...@google.com Cc: pet...@infradead.org Signed-off-by: Andi Kleen <a...@linux.intel.com> --- include/uapi/linux/perf_event.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 2fc1602..06b2c8a 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -525,6 +525,7 @@ enum perf_event_type { /* * The MMAP events record the PROT_EXEC mappings so that we can * correlate userspace IPs to code. They have the following structure: + * filename is zero terminated and padded to 8 bytes. * * struct { * struct perf_event_header header; @@ -533,7 +534,7 @@ enum perf_event_type { * u64 addr; * u64 len; * u64 pgoff; - * char filename[]; + * char filename[ALIGN(len, 8)]; * struct sample_id sample_id; * }; */ @@ -549,12 +550,13 @@ enum perf_event_type { */ PERF_RECORD_LOST = 2, - /* + /* comm is 0 terminated and padded to 8 bytes. + * * struct { * struct perf_event_header header; * * u32 pid, tid; - * char comm[]; + * char comm[ALIGN(len, 8)]; * struct sample_id sample_id; * }; */ @@ -637,12 +639,14 @@ enum perf_event_type { * # the stability of its content, it may vary depending * # on event, hardware, kernel version and phase of * # the moon. + * # + * # data[size] is padded to 8 bytes. * # * # In other words, PERF_SAMPLE_RAW contents are not an ABI. * # * * { u32 size; - * char data[size];}&& PERF_SAMPLE_RAW + * char data[ALIGN(size, 8)];}&& PERF_SAMPLE_RAW * * { u64 nr; * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK @@ -651,7 +655,7 @@ enum perf_event_type { * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER * * { u64 size; - * char data[size]; + * char data[ALIGN(size, 8)]; * u64 dyn_size; } && PERF_SAMPLE_STACK_USER * * { u64 weight; } && PERF_SAMPLE_WEIGHT @@ -663,6 +667,7 @@ enum perf_event_type { /* * The MMAP2 records are an augmented version of MMAP, they add * maj, min, ino numbers to be used to uniquely identify each mapping + * filename is 0 terminated and padded to 8 bytes. * * struct { * struct perf_event_header header; @@ -675,7 +680,7 @@ enum perf_event_type { * u32 min; * u64 ino; * u64 ino_generation; - * char filename[]; + * char filename[ALIGN(len, 8)]; * struct sample_id sample_id; * }; */ -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/