From 4dcc2a4d6c37c36155ea6d6305f15e599531b862 Mon Sep 17 00:00:00 2001 From: Sebastian Ott Date: Fri, 5 Oct 2012 10:43:31 +0200 Subject: [PATCH] s390/chsc: make headers usable Make sure that exported headers are save to be included by userspace exploiting /dev/chsc. Reported-by: Michael Holzheu Signed-off-by: Sebastian Ott Signed-off-by: Martin Schwidefsky --- arch/s390/include/asm/chpid.h | 10 +++++----- arch/s390/include/asm/chsc.h | 10 ++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/s390/include/asm/chpid.h b/arch/s390/include/asm/chpid.h index e5bde9f9291f..8af0b92c90c6 100644 --- a/arch/s390/include/asm/chpid.h +++ b/arch/s390/include/asm/chpid.h @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp. 2007 + * Copyright IBM Corp. 2007, 2012 * Author(s): Peter Oberparleiter */ @@ -12,10 +12,10 @@ #define __MAX_CHPID 255 struct chp_id { - u8 reserved1; - u8 cssid; - u8 reserved2; - u8 id; + __u8 reserved1; + __u8 cssid; + __u8 reserved2; + __u8 id; } __attribute__((packed)); #ifdef __KERNEL__ diff --git a/arch/s390/include/asm/chsc.h b/arch/s390/include/asm/chsc.h index aea451fd182e..1c6a7f85a581 100644 --- a/arch/s390/include/asm/chsc.h +++ b/arch/s390/include/asm/chsc.h @@ -1,7 +1,7 @@ /* * ioctl interface for /dev/chsc * - * Copyright IBM Corp. 2008 + * Copyright IBM Corp. 2008, 2012 * Author(s): Cornelia Huck */ @@ -9,9 +9,12 @@ #define _ASM_CHSC_H #include +#include #include #include +#define CHSC_SIZE 0x1000 + struct chsc_async_header { __u16 length; __u16 code; @@ -23,15 +26,14 @@ struct chsc_async_header { struct chsc_async_area { struct chsc_async_header header; - __u8 data[PAGE_SIZE - 16 /* size of chsc_async_header */]; + __u8 data[CHSC_SIZE - sizeof(struct chsc_async_header)]; } __attribute__ ((packed)); - struct chsc_response_struct { __u16 length; __u16 code; __u32 parms; - __u8 data[PAGE_SIZE - 8]; + __u8 data[CHSC_SIZE - 2 * sizeof(__u16) - sizeof(__u32)]; } __attribute__ ((packed)); struct chsc_chp_cd { -- 2.30.2