lkml.org 
[lkml]   [2009]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] perf: fix perf_event_attr layout -v2
From
Date
On Tue, 2009-12-15 at 19:36 +0100, Peter Zijlstra wrote:
> [now with lkml added too]

compile tested...

>
> 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: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/perf_event.h | 12 +++---------
kernel/perf_event.c | 2 +-
2 files changed, 4 insertions(+), 10 deletions(-)

Index: linux-2.6/include/linux/perf_event.h
===================================================================
--- linux-2.6.orig/include/linux/perf_event.h
+++ linux-2.6/include/linux/perf_event.h
@@ -211,17 +211,11 @@ struct perf_event_attr {
__u32 wakeup_watermark; /* bytes before wakeup */
};

- struct { /* Hardware breakpoint info */
- __u64 bp_addr;
- __u32 bp_type;
- __u32 bp_len;
- __u64 __bp_reserved_1;
- __u64 __bp_reserved_2;
- };
-
__u32 __reserved_2;

- __u64 __reserved_3;
+ __u64 bp_addr;
+ __u32 bp_type;
+ __u32 bp_len;
};

/*
Index: linux-2.6/kernel/perf_event.c
===================================================================
--- linux-2.6.orig/kernel/perf_event.c
+++ linux-2.6/kernel/perf_event.c
@@ -4564,7 +4564,7 @@ static int perf_copy_attr(struct perf_ev
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))




\
 
 \ /
  Last update: 2009-12-15 19:47    [W:0.040 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site