Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f13c12c6 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar
Browse files

perf_events: Fix perf_event_attr layout



The miss-alignment of bp_addr created a 32bit hole, causing
different structure packings on 32 and 64 bit machines.

Fix that by moving __reserve_2 into that hole.

Further, remove the useless struct and redundant __bp_reserve
muck.

Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1260902591.8023.781.camel@laptop>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent cdccc690
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -211,17 +211,11 @@ struct perf_event_attr {
		__u32		wakeup_watermark; /* bytes before wakeup   */
	};

	struct { /* Hardware breakpoint info */
	__u32			__reserved_2;

	__u64			bp_addr;
	__u32			bp_type;
	__u32			bp_len;
		__u64		__bp_reserved_1;
		__u64		__bp_reserved_2;
	};

	__u32			__reserved_2;

	__u64			__reserved_3;
};

/*
+1 −1
Original line number Diff line number Diff line
@@ -4564,7 +4564,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
	if (attr->type >= PERF_TYPE_MAX)
		return -EINVAL;

	if (attr->__reserved_1 || attr->__reserved_2 || attr->__reserved_3)
	if (attr->__reserved_1 || attr->__reserved_2)
		return -EINVAL;

	if (attr->sample_type & ~(PERF_SAMPLE_MAX-1))