.. | .. |
---|
28 | 28 | #include <linux/random.h> |
---|
29 | 29 | #include <linux/export.h> |
---|
30 | 30 | #include <linux/context_tracking.h> |
---|
31 | | - |
---|
| 31 | +#include <linux/timex.h> |
---|
32 | 32 | #include <linux/uaccess.h> |
---|
| 33 | + |
---|
33 | 34 | #include <asm/utrap.h> |
---|
34 | 35 | #include <asm/unistd.h> |
---|
35 | 36 | |
---|
.. | .. |
---|
335 | 336 | { |
---|
336 | 337 | long err; |
---|
337 | 338 | |
---|
| 339 | + if (!IS_ENABLED(CONFIG_SYSVIPC)) |
---|
| 340 | + return -ENOSYS; |
---|
| 341 | + |
---|
338 | 342 | /* No need for backward compatibility. We can start fresh... */ |
---|
339 | 343 | if (call <= SEMTIMEDOP) { |
---|
340 | 344 | switch (call) { |
---|
341 | 345 | case SEMOP: |
---|
342 | | - err = sys_semtimedop(first, ptr, |
---|
343 | | - (unsigned int)second, NULL); |
---|
| 346 | + err = ksys_semtimedop(first, ptr, |
---|
| 347 | + (unsigned int)second, NULL); |
---|
344 | 348 | goto out; |
---|
345 | 349 | case SEMTIMEDOP: |
---|
346 | | - err = sys_semtimedop(first, ptr, (unsigned int)second, |
---|
347 | | - (const struct timespec __user *) |
---|
348 | | - (unsigned long) fifth); |
---|
| 350 | + err = ksys_semtimedop(first, ptr, (unsigned int)second, |
---|
| 351 | + (const struct __kernel_timespec __user *) |
---|
| 352 | + (unsigned long) fifth); |
---|
349 | 353 | goto out; |
---|
350 | 354 | case SEMGET: |
---|
351 | | - err = sys_semget(first, (int)second, (int)third); |
---|
| 355 | + err = ksys_semget(first, (int)second, (int)third); |
---|
352 | 356 | goto out; |
---|
353 | 357 | case SEMCTL: { |
---|
354 | | - err = sys_semctl(first, second, |
---|
355 | | - (int)third | IPC_64, |
---|
356 | | - (unsigned long) ptr); |
---|
| 358 | + err = ksys_old_semctl(first, second, |
---|
| 359 | + (int)third | IPC_64, |
---|
| 360 | + (unsigned long) ptr); |
---|
357 | 361 | goto out; |
---|
358 | 362 | } |
---|
359 | 363 | default: |
---|
.. | .. |
---|
364 | 368 | if (call <= MSGCTL) { |
---|
365 | 369 | switch (call) { |
---|
366 | 370 | case MSGSND: |
---|
367 | | - err = sys_msgsnd(first, ptr, (size_t)second, |
---|
| 371 | + err = ksys_msgsnd(first, ptr, (size_t)second, |
---|
368 | 372 | (int)third); |
---|
369 | 373 | goto out; |
---|
370 | 374 | case MSGRCV: |
---|
371 | | - err = sys_msgrcv(first, ptr, (size_t)second, fifth, |
---|
| 375 | + err = ksys_msgrcv(first, ptr, (size_t)second, fifth, |
---|
372 | 376 | (int)third); |
---|
373 | 377 | goto out; |
---|
374 | 378 | case MSGGET: |
---|
375 | | - err = sys_msgget((key_t)first, (int)second); |
---|
| 379 | + err = ksys_msgget((key_t)first, (int)second); |
---|
376 | 380 | goto out; |
---|
377 | 381 | case MSGCTL: |
---|
378 | | - err = sys_msgctl(first, (int)second | IPC_64, ptr); |
---|
| 382 | + err = ksys_old_msgctl(first, (int)second | IPC_64, ptr); |
---|
379 | 383 | goto out; |
---|
380 | 384 | default: |
---|
381 | 385 | err = -ENOSYS; |
---|
.. | .. |
---|
395 | 399 | goto out; |
---|
396 | 400 | } |
---|
397 | 401 | case SHMDT: |
---|
398 | | - err = sys_shmdt(ptr); |
---|
| 402 | + err = ksys_shmdt(ptr); |
---|
399 | 403 | goto out; |
---|
400 | 404 | case SHMGET: |
---|
401 | | - err = sys_shmget(first, (size_t)second, (int)third); |
---|
| 405 | + err = ksys_shmget(first, (size_t)second, (int)third); |
---|
402 | 406 | goto out; |
---|
403 | 407 | case SHMCTL: |
---|
404 | | - err = sys_shmctl(first, (int)second | IPC_64, ptr); |
---|
| 408 | + err = ksys_old_shmctl(first, (int)second | IPC_64, ptr); |
---|
405 | 409 | goto out; |
---|
406 | 410 | default: |
---|
407 | 411 | err = -ENOSYS; |
---|
.. | .. |
---|
510 | 514 | #ifdef DEBUG_SPARC_BREAKPOINT |
---|
511 | 515 | printk ("TRAP: Entering kernel PC=%lx, nPC=%lx\n", regs->tpc, regs->tnpc); |
---|
512 | 516 | #endif |
---|
513 | | - force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->tpc, 0, current); |
---|
| 517 | + force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->tpc, 0); |
---|
514 | 518 | #ifdef DEBUG_SPARC_BREAKPOINT |
---|
515 | 519 | printk ("TRAP: Returning to space: PC=%lx nPC=%lx\n", regs->tpc, regs->tnpc); |
---|
516 | 520 | #endif |
---|
.. | .. |
---|
544 | 548 | return err; |
---|
545 | 549 | } |
---|
546 | 550 | |
---|
| 551 | +SYSCALL_DEFINE1(sparc_adjtimex, struct __kernel_timex __user *, txc_p) |
---|
| 552 | +{ |
---|
| 553 | + struct __kernel_timex txc; |
---|
| 554 | + struct __kernel_old_timeval *tv = (void *)&txc.time; |
---|
| 555 | + int ret; |
---|
| 556 | + |
---|
| 557 | + /* Copy the user data space into the kernel copy |
---|
| 558 | + * structure. But bear in mind that the structures |
---|
| 559 | + * may change |
---|
| 560 | + */ |
---|
| 561 | + if (copy_from_user(&txc, txc_p, sizeof(txc))) |
---|
| 562 | + return -EFAULT; |
---|
| 563 | + |
---|
| 564 | + /* |
---|
| 565 | + * override for sparc64 specific timeval type: tv_usec |
---|
| 566 | + * is 32 bit wide instead of 64-bit in __kernel_timex |
---|
| 567 | + */ |
---|
| 568 | + txc.time.tv_usec = tv->tv_usec; |
---|
| 569 | + ret = do_adjtimex(&txc); |
---|
| 570 | + tv->tv_usec = txc.time.tv_usec; |
---|
| 571 | + |
---|
| 572 | + return copy_to_user(txc_p, &txc, sizeof(txc)) ? -EFAULT : ret; |
---|
| 573 | +} |
---|
| 574 | + |
---|
| 575 | +SYSCALL_DEFINE2(sparc_clock_adjtime, const clockid_t, which_clock, |
---|
| 576 | + struct __kernel_timex __user *, txc_p) |
---|
| 577 | +{ |
---|
| 578 | + struct __kernel_timex txc; |
---|
| 579 | + struct __kernel_old_timeval *tv = (void *)&txc.time; |
---|
| 580 | + int ret; |
---|
| 581 | + |
---|
| 582 | + if (!IS_ENABLED(CONFIG_POSIX_TIMERS)) { |
---|
| 583 | + pr_err_once("process %d (%s) attempted a POSIX timer syscall " |
---|
| 584 | + "while CONFIG_POSIX_TIMERS is not set\n", |
---|
| 585 | + current->pid, current->comm); |
---|
| 586 | + |
---|
| 587 | + return -ENOSYS; |
---|
| 588 | + } |
---|
| 589 | + |
---|
| 590 | + /* Copy the user data space into the kernel copy |
---|
| 591 | + * structure. But bear in mind that the structures |
---|
| 592 | + * may change |
---|
| 593 | + */ |
---|
| 594 | + if (copy_from_user(&txc, txc_p, sizeof(txc))) |
---|
| 595 | + return -EFAULT; |
---|
| 596 | + |
---|
| 597 | + /* |
---|
| 598 | + * override for sparc64 specific timeval type: tv_usec |
---|
| 599 | + * is 32 bit wide instead of 64-bit in __kernel_timex |
---|
| 600 | + */ |
---|
| 601 | + txc.time.tv_usec = tv->tv_usec; |
---|
| 602 | + ret = do_clock_adjtime(which_clock, &txc); |
---|
| 603 | + tv->tv_usec = txc.time.tv_usec; |
---|
| 604 | + |
---|
| 605 | + return copy_to_user(txc_p, &txc, sizeof(txc)) ? -EFAULT : ret; |
---|
| 606 | +} |
---|
| 607 | + |
---|
547 | 608 | SYSCALL_DEFINE5(utrap_install, utrap_entry_t, type, |
---|
548 | 609 | utrap_handler_t, new_p, utrap_handler_t, new_d, |
---|
549 | 610 | utrap_handler_t __user *, old_p, |
---|