提交 4dcc2a4d 编写于 作者: S Sebastian Ott 提交者: Martin Schwidefsky

s390/chsc: make headers usable

Make sure that exported headers are save to be included by userspace
exploiting /dev/chsc.
Reported-by: NMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: NSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 9be5f34f
/* /*
* Copyright IBM Corp. 2007 * Copyright IBM Corp. 2007, 2012
* Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
*/ */
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#define __MAX_CHPID 255 #define __MAX_CHPID 255
struct chp_id { struct chp_id {
u8 reserved1; __u8 reserved1;
u8 cssid; __u8 cssid;
u8 reserved2; __u8 reserved2;
u8 id; __u8 id;
} __attribute__((packed)); } __attribute__((packed));
#ifdef __KERNEL__ #ifdef __KERNEL__
......
/* /*
* ioctl interface for /dev/chsc * ioctl interface for /dev/chsc
* *
* Copyright IBM Corp. 2008 * Copyright IBM Corp. 2008, 2012
* Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
*/ */
...@@ -9,9 +9,12 @@ ...@@ -9,9 +9,12 @@
#define _ASM_CHSC_H #define _ASM_CHSC_H
#include <linux/types.h> #include <linux/types.h>
#include <linux/ioctl.h>
#include <asm/chpid.h> #include <asm/chpid.h>
#include <asm/schid.h> #include <asm/schid.h>
#define CHSC_SIZE 0x1000
struct chsc_async_header { struct chsc_async_header {
__u16 length; __u16 length;
__u16 code; __u16 code;
...@@ -23,15 +26,14 @@ struct chsc_async_header { ...@@ -23,15 +26,14 @@ struct chsc_async_header {
struct chsc_async_area { struct chsc_async_area {
struct chsc_async_header header; 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)); } __attribute__ ((packed));
struct chsc_response_struct { struct chsc_response_struct {
__u16 length; __u16 length;
__u16 code; __u16 code;
__u32 parms; __u32 parms;
__u8 data[PAGE_SIZE - 8]; __u8 data[CHSC_SIZE - 2 * sizeof(__u16) - sizeof(__u32)];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct chsc_chp_cd { struct chsc_chp_cd {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册