0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include <linux/compat.h>
0025 #include <linux/errno.h>
0026 #include <linux/highuid.h>
0027 #include <linux/init.h>
0028 #include <linux/msg.h>
0029 #include <linux/shm.h>
0030 #include <linux/syscalls.h>
0031 #include <linux/ptrace.h>
0032
0033 #include <linux/mutex.h>
0034 #include <linux/uaccess.h>
0035
0036 #include "util.h"
0037
0038 int get_compat_ipc64_perm(struct ipc64_perm *to,
0039 struct compat_ipc64_perm __user *from)
0040 {
0041 struct compat_ipc64_perm v;
0042 if (copy_from_user(&v, from, sizeof(v)))
0043 return -EFAULT;
0044 to->uid = v.uid;
0045 to->gid = v.gid;
0046 to->mode = v.mode;
0047 return 0;
0048 }
0049
0050 int get_compat_ipc_perm(struct ipc64_perm *to,
0051 struct compat_ipc_perm __user *from)
0052 {
0053 struct compat_ipc_perm v;
0054 if (copy_from_user(&v, from, sizeof(v)))
0055 return -EFAULT;
0056 to->uid = v.uid;
0057 to->gid = v.gid;
0058 to->mode = v.mode;
0059 return 0;
0060 }
0061
0062 void to_compat_ipc64_perm(struct compat_ipc64_perm *to, struct ipc64_perm *from)
0063 {
0064 to->key = from->key;
0065 to->uid = from->uid;
0066 to->gid = from->gid;
0067 to->cuid = from->cuid;
0068 to->cgid = from->cgid;
0069 to->mode = from->mode;
0070 to->seq = from->seq;
0071 }
0072
0073 void to_compat_ipc_perm(struct compat_ipc_perm *to, struct ipc64_perm *from)
0074 {
0075 to->key = from->key;
0076 SET_UID(to->uid, from->uid);
0077 SET_GID(to->gid, from->gid);
0078 SET_UID(to->cuid, from->cuid);
0079 SET_GID(to->cgid, from->cgid);
0080 to->mode = from->mode;
0081 to->seq = from->seq;
0082 }