| .. | .. |
|---|
| 17 | 17 | #include <linux/shm.h> |
|---|
| 18 | 18 | #include <linux/uaccess.h> |
|---|
| 19 | 19 | |
|---|
| 20 | | -SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, |
|---|
| 21 | | - unsigned long, third, void __user *, ptr, long, fifth) |
|---|
| 20 | +int ksys_ipc(unsigned int call, int first, unsigned long second, |
|---|
| 21 | + unsigned long third, void __user * ptr, long fifth) |
|---|
| 22 | 22 | { |
|---|
| 23 | 23 | int version, ret; |
|---|
| 24 | 24 | |
|---|
| .. | .. |
|---|
| 30 | 30 | return ksys_semtimedop(first, (struct sembuf __user *)ptr, |
|---|
| 31 | 31 | second, NULL); |
|---|
| 32 | 32 | case SEMTIMEDOP: |
|---|
| 33 | | - if (IS_ENABLED(CONFIG_64BIT) || !IS_ENABLED(CONFIG_64BIT_TIME)) |
|---|
| 33 | + if (IS_ENABLED(CONFIG_64BIT)) |
|---|
| 34 | 34 | return ksys_semtimedop(first, ptr, second, |
|---|
| 35 | 35 | (const struct __kernel_timespec __user *)fifth); |
|---|
| 36 | 36 | else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)) |
|---|
| 37 | 37 | return compat_ksys_semtimedop(first, ptr, second, |
|---|
| 38 | | - (const struct compat_timespec __user *)fifth); |
|---|
| 38 | + (const struct old_timespec32 __user *)fifth); |
|---|
| 39 | 39 | else |
|---|
| 40 | 40 | return -ENOSYS; |
|---|
| 41 | 41 | |
|---|
| .. | .. |
|---|
| 47 | 47 | return -EINVAL; |
|---|
| 48 | 48 | if (get_user(arg, (unsigned long __user *) ptr)) |
|---|
| 49 | 49 | return -EFAULT; |
|---|
| 50 | | - return ksys_semctl(first, second, third, arg); |
|---|
| 50 | + return ksys_old_semctl(first, second, third, arg); |
|---|
| 51 | 51 | } |
|---|
| 52 | 52 | |
|---|
| 53 | 53 | case MSGSND: |
|---|
| .. | .. |
|---|
| 75 | 75 | case MSGGET: |
|---|
| 76 | 76 | return ksys_msgget((key_t) first, second); |
|---|
| 77 | 77 | case MSGCTL: |
|---|
| 78 | | - return ksys_msgctl(first, second, |
|---|
| 78 | + return ksys_old_msgctl(first, second, |
|---|
| 79 | 79 | (struct msqid_ds __user *)ptr); |
|---|
| 80 | 80 | |
|---|
| 81 | 81 | case SHMAT: |
|---|
| .. | .. |
|---|
| 100 | 100 | case SHMGET: |
|---|
| 101 | 101 | return ksys_shmget(first, second, third); |
|---|
| 102 | 102 | case SHMCTL: |
|---|
| 103 | | - return ksys_shmctl(first, second, |
|---|
| 103 | + return ksys_old_shmctl(first, second, |
|---|
| 104 | 104 | (struct shmid_ds __user *) ptr); |
|---|
| 105 | 105 | default: |
|---|
| 106 | 106 | return -ENOSYS; |
|---|
| 107 | 107 | } |
|---|
| 108 | +} |
|---|
| 109 | + |
|---|
| 110 | +SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, |
|---|
| 111 | + unsigned long, third, void __user *, ptr, long, fifth) |
|---|
| 112 | +{ |
|---|
| 113 | + return ksys_ipc(call, first, second, third, ptr, fifth); |
|---|
| 108 | 114 | } |
|---|
| 109 | 115 | #endif |
|---|
| 110 | 116 | |
|---|
| .. | .. |
|---|
| 121 | 127 | }; |
|---|
| 122 | 128 | |
|---|
| 123 | 129 | #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC |
|---|
| 124 | | -COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second, |
|---|
| 125 | | - u32, third, compat_uptr_t, ptr, u32, fifth) |
|---|
| 130 | +int compat_ksys_ipc(u32 call, int first, int second, |
|---|
| 131 | + u32 third, compat_uptr_t ptr, u32 fifth) |
|---|
| 126 | 132 | { |
|---|
| 127 | 133 | int version; |
|---|
| 128 | 134 | u32 pad; |
|---|
| .. | .. |
|---|
| 146 | 152 | return -EINVAL; |
|---|
| 147 | 153 | if (get_user(pad, (u32 __user *) compat_ptr(ptr))) |
|---|
| 148 | 154 | return -EFAULT; |
|---|
| 149 | | - return compat_ksys_semctl(first, second, third, pad); |
|---|
| 155 | + return compat_ksys_old_semctl(first, second, third, pad); |
|---|
| 150 | 156 | |
|---|
| 151 | 157 | case MSGSND: |
|---|
| 152 | 158 | return compat_ksys_msgsnd(first, ptr, second, third); |
|---|
| .. | .. |
|---|
| 171 | 177 | case MSGGET: |
|---|
| 172 | 178 | return ksys_msgget(first, second); |
|---|
| 173 | 179 | case MSGCTL: |
|---|
| 174 | | - return compat_ksys_msgctl(first, second, compat_ptr(ptr)); |
|---|
| 180 | + return compat_ksys_old_msgctl(first, second, compat_ptr(ptr)); |
|---|
| 175 | 181 | |
|---|
| 176 | 182 | case SHMAT: { |
|---|
| 177 | 183 | int err; |
|---|
| .. | .. |
|---|
| 190 | 196 | case SHMGET: |
|---|
| 191 | 197 | return ksys_shmget(first, (unsigned int)second, third); |
|---|
| 192 | 198 | case SHMCTL: |
|---|
| 193 | | - return compat_ksys_shmctl(first, second, compat_ptr(ptr)); |
|---|
| 199 | + return compat_ksys_old_shmctl(first, second, compat_ptr(ptr)); |
|---|
| 194 | 200 | } |
|---|
| 195 | 201 | |
|---|
| 196 | 202 | return -ENOSYS; |
|---|
| 197 | 203 | } |
|---|
| 204 | + |
|---|
| 205 | +COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second, |
|---|
| 206 | + u32, third, compat_uptr_t, ptr, u32, fifth) |
|---|
| 207 | +{ |
|---|
| 208 | + return compat_ksys_ipc(call, first, second, third, ptr, fifth); |
|---|
| 209 | +} |
|---|
| 198 | 210 | #endif |
|---|
| 199 | 211 | #endif |
|---|