1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <linux/compat.h>
25#include <linux/errno.h>
26#include <linux/highuid.h>
27#include <linux/init.h>
28#include <linux/msg.h>
29#include <linux/shm.h>
30#include <linux/syscalls.h>
31#include <linux/ptrace.h>
32
33#include <linux/mutex.h>
34#include <linux/uaccess.h>
35
36#include "util.h"
37
38int get_compat_ipc64_perm(struct ipc64_perm *to,
39 struct compat_ipc64_perm __user *from)
40{
41 struct compat_ipc64_perm v;
42 if (copy_from_user(&v, from, sizeof(v)))
43 return -EFAULT;
44 to->uid = v.uid;
45 to->gid = v.gid;
46 to->mode = v.mode;
47 return 0;
48}
49
50int get_compat_ipc_perm(struct ipc64_perm *to,
51 struct compat_ipc_perm __user *from)
52{
53 struct compat_ipc_perm v;
54 if (copy_from_user(&v, from, sizeof(v)))
55 return -EFAULT;
56 to->uid = v.uid;
57 to->gid = v.gid;
58 to->mode = v.mode;
59 return 0;
60}
61
62void to_compat_ipc64_perm(struct compat_ipc64_perm *to, struct ipc64_perm *from)
63{
64 to->key = from->key;
65 to->uid = from->uid;
66 to->gid = from->gid;
67 to->cuid = from->cuid;
68 to->cgid = from->cgid;
69 to->mode = from->mode;
70 to->seq = from->seq;
71}
72
73void to_compat_ipc_perm(struct compat_ipc_perm *to, struct ipc64_perm *from)
74{
75 to->key = from->key;
76 SET_UID(to->uid, from->uid);
77 SET_GID(to->gid, from->gid);
78 SET_UID(to->cuid, from->cuid);
79 SET_GID(to->cgid, from->cgid);
80 to->mode = from->mode;
81 to->seq = from->seq;
82}
83