| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * arch/arm/kernel/sys_oabi-compat.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 7 | 8 | * Author: Nicolas Pitre |
|---|
| 8 | 9 | * Created: Oct 7, 2005 |
|---|
| 9 | 10 | * Copyright: MontaVista Software, Inc. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 13 | | - * published by the Free Software Foundation. |
|---|
| 14 | 11 | */ |
|---|
| 15 | 12 | |
|---|
| 16 | 13 | /* |
|---|
| .. | .. |
|---|
| 251 | 248 | __u64 data; |
|---|
| 252 | 249 | } __attribute__ ((packed,aligned(4))); |
|---|
| 253 | 250 | |
|---|
| 251 | +#ifdef CONFIG_EPOLL |
|---|
| 254 | 252 | asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd, |
|---|
| 255 | 253 | struct oabi_epoll_event __user *event) |
|---|
| 256 | 254 | { |
|---|
| 257 | 255 | struct oabi_epoll_event user; |
|---|
| 258 | 256 | struct epoll_event kernel; |
|---|
| 259 | | - mm_segment_t fs; |
|---|
| 260 | | - long ret; |
|---|
| 261 | 257 | |
|---|
| 262 | | - if (op == EPOLL_CTL_DEL) |
|---|
| 263 | | - return sys_epoll_ctl(epfd, op, fd, NULL); |
|---|
| 264 | | - if (copy_from_user(&user, event, sizeof(user))) |
|---|
| 258 | + if (ep_op_has_event(op) && |
|---|
| 259 | + copy_from_user(&user, event, sizeof(user))) |
|---|
| 265 | 260 | return -EFAULT; |
|---|
| 261 | + |
|---|
| 266 | 262 | kernel.events = user.events; |
|---|
| 267 | 263 | kernel.data = user.data; |
|---|
| 268 | | - fs = get_fs(); |
|---|
| 269 | | - set_fs(KERNEL_DS); |
|---|
| 270 | | - ret = sys_epoll_ctl(epfd, op, fd, &kernel); |
|---|
| 271 | | - set_fs(fs); |
|---|
| 272 | | - return ret; |
|---|
| 264 | + |
|---|
| 265 | + return do_epoll_ctl(epfd, op, fd, &kernel, false); |
|---|
| 273 | 266 | } |
|---|
| 274 | 267 | |
|---|
| 275 | 268 | asmlinkage long sys_oabi_epoll_wait(int epfd, |
|---|
| .. | .. |
|---|
| 285 | 278 | maxevents > (INT_MAX/sizeof(*kbuf)) || |
|---|
| 286 | 279 | maxevents > (INT_MAX/sizeof(*events))) |
|---|
| 287 | 280 | return -EINVAL; |
|---|
| 288 | | - if (!access_ok(VERIFY_WRITE, events, sizeof(*events) * maxevents)) |
|---|
| 281 | + if (!access_ok(events, sizeof(*events) * maxevents)) |
|---|
| 289 | 282 | return -EFAULT; |
|---|
| 290 | 283 | kbuf = kmalloc_array(maxevents, sizeof(*kbuf), GFP_KERNEL); |
|---|
| 291 | 284 | if (!kbuf) |
|---|
| .. | .. |
|---|
| 306 | 299 | kfree(kbuf); |
|---|
| 307 | 300 | return err ? -EFAULT : ret; |
|---|
| 308 | 301 | } |
|---|
| 302 | +#else |
|---|
| 303 | +asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd, |
|---|
| 304 | + struct oabi_epoll_event __user *event) |
|---|
| 305 | +{ |
|---|
| 306 | + return -EINVAL; |
|---|
| 307 | +} |
|---|
| 308 | + |
|---|
| 309 | +asmlinkage long sys_oabi_epoll_wait(int epfd, |
|---|
| 310 | + struct oabi_epoll_event __user *events, |
|---|
| 311 | + int maxevents, int timeout) |
|---|
| 312 | +{ |
|---|
| 313 | + return -EINVAL; |
|---|
| 314 | +} |
|---|
| 315 | +#endif |
|---|
| 309 | 316 | |
|---|
| 310 | 317 | struct oabi_sembuf { |
|---|
| 311 | 318 | unsigned short sem_num; |
|---|
| .. | .. |
|---|
| 317 | 324 | asmlinkage long sys_oabi_semtimedop(int semid, |
|---|
| 318 | 325 | struct oabi_sembuf __user *tsops, |
|---|
| 319 | 326 | unsigned nsops, |
|---|
| 320 | | - const struct timespec __user *timeout) |
|---|
| 327 | + const struct old_timespec32 __user *timeout) |
|---|
| 321 | 328 | { |
|---|
| 322 | 329 | struct sembuf *sops; |
|---|
| 323 | | - struct timespec local_timeout; |
|---|
| 330 | + struct old_timespec32 local_timeout; |
|---|
| 324 | 331 | long err; |
|---|
| 325 | 332 | int i; |
|---|
| 326 | 333 | |
|---|
| 327 | 334 | if (nsops < 1 || nsops > SEMOPM) |
|---|
| 328 | 335 | return -EINVAL; |
|---|
| 329 | | - if (!access_ok(VERIFY_READ, tsops, sizeof(*tsops) * nsops)) |
|---|
| 336 | + if (!access_ok(tsops, sizeof(*tsops) * nsops)) |
|---|
| 330 | 337 | return -EFAULT; |
|---|
| 331 | 338 | sops = kmalloc_array(nsops, sizeof(*sops), GFP_KERNEL); |
|---|
| 332 | 339 | if (!sops) |
|---|
| .. | .. |
|---|
| 350 | 357 | } else { |
|---|
| 351 | 358 | mm_segment_t fs = get_fs(); |
|---|
| 352 | 359 | set_fs(KERNEL_DS); |
|---|
| 353 | | - err = sys_semtimedop(semid, sops, nsops, timeout); |
|---|
| 360 | + err = sys_semtimedop_time32(semid, sops, nsops, timeout); |
|---|
| 354 | 361 | set_fs(fs); |
|---|
| 355 | 362 | } |
|---|
| 356 | 363 | kfree(sops); |
|---|
| .. | .. |
|---|
| 375 | 382 | return sys_oabi_semtimedop(first, |
|---|
| 376 | 383 | (struct oabi_sembuf __user *)ptr, |
|---|
| 377 | 384 | second, |
|---|
| 378 | | - (const struct timespec __user *)fifth); |
|---|
| 385 | + (const struct old_timespec32 __user *)fifth); |
|---|
| 379 | 386 | default: |
|---|
| 380 | 387 | return sys_ipc(call, first, second, third, ptr, fifth); |
|---|
| 381 | 388 | } |
|---|