diff options
-rw-r--r-- | arch/s390/kernel/compat_signal.c | 102 | ||||
-rw-r--r-- | arch/s390/kernel/compat_wrapper.S | 137 | ||||
-rw-r--r-- | arch/s390/kernel/entry.S | 51 | ||||
-rw-r--r-- | arch/s390/kernel/entry64.S | 75 | ||||
-rw-r--r-- | arch/s390/kernel/signal.c | 146 | ||||
-rw-r--r-- | arch/s390/kernel/syscalls.S | 22 | ||||
-rw-r--r-- | include/asm-s390/thread_info.h | 6 | ||||
-rw-r--r-- | include/asm-s390/unistd.h | 24 |
8 files changed, 297 insertions, 266 deletions
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index fa2b3bc22f20..ef706694a0c1 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c | |||
@@ -1,8 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/s390/kernel/signal32.c | 2 | * arch/s390/kernel/compat_signal.c |
3 | * | 3 | * |
4 | * S390 version | 4 | * Copyright (C) IBM Corp. 2000,2006 |
5 | * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
6 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | 5 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) |
7 | * Gerhard Tonn (ton@de.ibm.com) | 6 | * Gerhard Tonn (ton@de.ibm.com) |
8 | * | 7 | * |
@@ -52,8 +51,6 @@ typedef struct | |||
52 | struct ucontext32 uc; | 51 | struct ucontext32 uc; |
53 | } rt_sigframe32; | 52 | } rt_sigframe32; |
54 | 53 | ||
55 | asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); | ||
56 | |||
57 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) | 54 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) |
58 | { | 55 | { |
59 | int err; | 56 | int err; |
@@ -161,66 +158,6 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) | |||
161 | return err; | 158 | return err; |
162 | } | 159 | } |
163 | 160 | ||
164 | /* | ||
165 | * Atomically swap in the new signal mask, and wait for a signal. | ||
166 | */ | ||
167 | asmlinkage int | ||
168 | sys32_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t mask) | ||
169 | { | ||
170 | sigset_t saveset; | ||
171 | |||
172 | mask &= _BLOCKABLE; | ||
173 | spin_lock_irq(¤t->sighand->siglock); | ||
174 | saveset = current->blocked; | ||
175 | siginitset(¤t->blocked, mask); | ||
176 | recalc_sigpending(); | ||
177 | spin_unlock_irq(¤t->sighand->siglock); | ||
178 | regs->gprs[2] = -EINTR; | ||
179 | |||
180 | while (1) { | ||
181 | set_current_state(TASK_INTERRUPTIBLE); | ||
182 | schedule(); | ||
183 | if (do_signal(regs, &saveset)) | ||
184 | return -EINTR; | ||
185 | } | ||
186 | } | ||
187 | |||
188 | asmlinkage int | ||
189 | sys32_rt_sigsuspend(struct pt_regs * regs, compat_sigset_t __user *unewset, | ||
190 | size_t sigsetsize) | ||
191 | { | ||
192 | sigset_t saveset, newset; | ||
193 | compat_sigset_t set32; | ||
194 | |||
195 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
196 | if (sigsetsize != sizeof(sigset_t)) | ||
197 | return -EINVAL; | ||
198 | |||
199 | if (copy_from_user(&set32, unewset, sizeof(set32))) | ||
200 | return -EFAULT; | ||
201 | switch (_NSIG_WORDS) { | ||
202 | case 4: newset.sig[3] = set32.sig[6] + (((long)set32.sig[7]) << 32); | ||
203 | case 3: newset.sig[2] = set32.sig[4] + (((long)set32.sig[5]) << 32); | ||
204 | case 2: newset.sig[1] = set32.sig[2] + (((long)set32.sig[3]) << 32); | ||
205 | case 1: newset.sig[0] = set32.sig[0] + (((long)set32.sig[1]) << 32); | ||
206 | } | ||
207 | sigdelsetmask(&newset, ~_BLOCKABLE); | ||
208 | |||
209 | spin_lock_irq(¤t->sighand->siglock); | ||
210 | saveset = current->blocked; | ||
211 | current->blocked = newset; | ||
212 | recalc_sigpending(); | ||
213 | spin_unlock_irq(¤t->sighand->siglock); | ||
214 | regs->gprs[2] = -EINTR; | ||
215 | |||
216 | while (1) { | ||
217 | set_current_state(TASK_INTERRUPTIBLE); | ||
218 | schedule(); | ||
219 | if (do_signal(regs, &saveset)) | ||
220 | return -EINTR; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | asmlinkage long | 161 | asmlinkage long |
225 | sys32_sigaction(int sig, const struct old_sigaction32 __user *act, | 162 | sys32_sigaction(int sig, const struct old_sigaction32 __user *act, |
226 | struct old_sigaction32 __user *oact) | 163 | struct old_sigaction32 __user *oact) |
@@ -520,7 +457,7 @@ static inline int map_signal(int sig) | |||
520 | return sig; | 457 | return sig; |
521 | } | 458 | } |
522 | 459 | ||
523 | static void setup_frame32(int sig, struct k_sigaction *ka, | 460 | static int setup_frame32(int sig, struct k_sigaction *ka, |
524 | sigset_t *set, struct pt_regs * regs) | 461 | sigset_t *set, struct pt_regs * regs) |
525 | { | 462 | { |
526 | sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32)); | 463 | sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32)); |
@@ -565,13 +502,14 @@ static void setup_frame32(int sig, struct k_sigaction *ka, | |||
565 | /* Place signal number on stack to allow backtrace from handler. */ | 502 | /* Place signal number on stack to allow backtrace from handler. */ |
566 | if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) | 503 | if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) |
567 | goto give_sigsegv; | 504 | goto give_sigsegv; |
568 | return; | 505 | return 0; |
569 | 506 | ||
570 | give_sigsegv: | 507 | give_sigsegv: |
571 | force_sigsegv(sig, current); | 508 | force_sigsegv(sig, current); |
509 | return -EFAULT; | ||
572 | } | 510 | } |
573 | 511 | ||
574 | static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, | 512 | static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, |
575 | sigset_t *set, struct pt_regs * regs) | 513 | sigset_t *set, struct pt_regs * regs) |
576 | { | 514 | { |
577 | int err = 0; | 515 | int err = 0; |
@@ -615,31 +553,37 @@ static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
615 | regs->gprs[2] = map_signal(sig); | 553 | regs->gprs[2] = map_signal(sig); |
616 | regs->gprs[3] = (__u64) &frame->info; | 554 | regs->gprs[3] = (__u64) &frame->info; |
617 | regs->gprs[4] = (__u64) &frame->uc; | 555 | regs->gprs[4] = (__u64) &frame->uc; |
618 | return; | 556 | return 0; |
619 | 557 | ||
620 | give_sigsegv: | 558 | give_sigsegv: |
621 | force_sigsegv(sig, current); | 559 | force_sigsegv(sig, current); |
560 | return -EFAULT; | ||
622 | } | 561 | } |
623 | 562 | ||
624 | /* | 563 | /* |
625 | * OK, we're invoking a handler | 564 | * OK, we're invoking a handler |
626 | */ | 565 | */ |
627 | 566 | ||
628 | void | 567 | int |
629 | handle_signal32(unsigned long sig, struct k_sigaction *ka, | 568 | handle_signal32(unsigned long sig, struct k_sigaction *ka, |
630 | siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) | 569 | siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) |
631 | { | 570 | { |
571 | int ret; | ||
572 | |||
632 | /* Set up the stack frame */ | 573 | /* Set up the stack frame */ |
633 | if (ka->sa.sa_flags & SA_SIGINFO) | 574 | if (ka->sa.sa_flags & SA_SIGINFO) |
634 | setup_rt_frame32(sig, ka, info, oldset, regs); | 575 | ret = setup_rt_frame32(sig, ka, info, oldset, regs); |
635 | else | 576 | else |
636 | setup_frame32(sig, ka, oldset, regs); | 577 | ret = setup_frame32(sig, ka, oldset, regs); |
637 | 578 | ||
638 | spin_lock_irq(¤t->sighand->siglock); | 579 | if (ret == 0) { |
639 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 580 | spin_lock_irq(¤t->sighand->siglock); |
640 | if (!(ka->sa.sa_flags & SA_NODEFER)) | 581 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); |
641 | sigaddset(¤t->blocked,sig); | 582 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
642 | recalc_sigpending(); | 583 | sigaddset(¤t->blocked,sig); |
643 | spin_unlock_irq(¤t->sighand->siglock); | 584 | recalc_sigpending(); |
585 | spin_unlock_irq(¤t->sighand->siglock); | ||
586 | } | ||
587 | return ret; | ||
644 | } | 588 | } |
645 | 589 | ||
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index cfde1905d07d..6e27ac68ec3f 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1,9 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * arch/s390/kernel/sys_wrapper31.S | 2 | * arch/s390/kernel/compat_wrapper.S |
3 | * wrapper for 31 bit compatible system calls. | 3 | * wrapper for 31 bit compatible system calls. |
4 | * | 4 | * |
5 | * S390 version | 5 | * Copyright (C) IBM Corp. 2000,2006 |
6 | * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
7 | * Author(s): Gerhard Tonn (ton@de.ibm.com), | 6 | * Author(s): Gerhard Tonn (ton@de.ibm.com), |
8 | * Thomas Spatzier (tspat@de.ibm.com) | 7 | * Thomas Spatzier (tspat@de.ibm.com) |
9 | */ | 8 | */ |
@@ -288,7 +287,12 @@ sys32_setregid16_wrapper: | |||
288 | llgfr %r3,%r3 # __kernel_old_gid_emu31_t | 287 | llgfr %r3,%r3 # __kernel_old_gid_emu31_t |
289 | jg sys32_setregid16 # branch to system call | 288 | jg sys32_setregid16 # branch to system call |
290 | 289 | ||
291 | #sys32_sigsuspend_wrapper # done in sigsuspend_glue | 290 | .globl sys_sigsuspend_wrapper |
291 | sys_sigsuspend_wrapper: | ||
292 | lgfr %r2,%r2 # int | ||
293 | lgfr %r3,%r3 # int | ||
294 | llgfr %r4,%r4 # old_sigset_t | ||
295 | jg sys_sigsuspend | ||
292 | 296 | ||
293 | .globl compat_sys_sigpending_wrapper | 297 | .globl compat_sys_sigpending_wrapper |
294 | compat_sys_sigpending_wrapper: | 298 | compat_sys_sigpending_wrapper: |
@@ -855,7 +859,11 @@ sys32_rt_sigqueueinfo_wrapper: | |||
855 | llgtr %r4,%r4 # siginfo_emu31_t * | 859 | llgtr %r4,%r4 # siginfo_emu31_t * |
856 | jg sys32_rt_sigqueueinfo # branch to system call | 860 | jg sys32_rt_sigqueueinfo # branch to system call |
857 | 861 | ||
858 | #sys32_rt_sigsuspend_wrapper # done in rt_sigsuspend_glue | 862 | .globl compat_sys_rt_sigsuspend_wrapper |
863 | compat_sys_rt_sigsuspend_wrapper: | ||
864 | llgtr %r2,%r2 # compat_sigset_t * | ||
865 | llgfr %r3,%r3 # compat_size_t | ||
866 | jg compat_sys_rt_sigsuspend | ||
859 | 867 | ||
860 | .globl sys32_pread64_wrapper | 868 | .globl sys32_pread64_wrapper |
861 | sys32_pread64_wrapper: | 869 | sys32_pread64_wrapper: |
@@ -1475,3 +1483,122 @@ sys_inotify_rm_watch_wrapper: | |||
1475 | lgfr %r2,%r2 # int | 1483 | lgfr %r2,%r2 # int |
1476 | llgfr %r3,%r3 # u32 | 1484 | llgfr %r3,%r3 # u32 |
1477 | jg sys_inotify_rm_watch | 1485 | jg sys_inotify_rm_watch |
1486 | |||
1487 | .globl compat_sys_openat_wrapper | ||
1488 | compat_sys_openat_wrapper: | ||
1489 | lgfr %r2,%r2 # int | ||
1490 | llgtr %r3,%r3 # const char * | ||
1491 | lgfr %r4,%r4 # int | ||
1492 | lgfr %r5,%r5 # int | ||
1493 | jg compat_sys_openat | ||
1494 | |||
1495 | .globl sys_mkdirat_wrapper | ||
1496 | sys_mkdirat_wrapper: | ||
1497 | lgfr %r2,%r2 # int | ||
1498 | llgtr %r3,%r3 # const char * | ||
1499 | lgfr %r4,%r4 # int | ||
1500 | jg sys_mkdirat | ||
1501 | |||
1502 | .globl sys_mknodat_wrapper | ||
1503 | sys_mknodat_wrapper: | ||
1504 | lgfr %r2,%r2 # int | ||
1505 | llgtr %r3,%r3 # const char * | ||
1506 | lgfr %r4,%r4 # int | ||
1507 | llgfr %r5,%r5 # unsigned int | ||
1508 | jg sys_mknodat | ||
1509 | |||
1510 | .globl sys_fchownat_wrapper | ||
1511 | sys_fchownat_wrapper: | ||
1512 | lgfr %r2,%r2 # int | ||
1513 | llgtr %r3,%r3 # const char * | ||
1514 | llgfr %r4,%r4 # uid_t | ||
1515 | llgfr %r5,%r5 # gid_t | ||
1516 | lgfr %r6,%r6 # int | ||
1517 | jg sys_fchownat | ||
1518 | |||
1519 | .globl compat_sys_futimesat_wrapper | ||
1520 | compat_sys_futimesat_wrapper: | ||
1521 | lgfr %r2,%r2 # int | ||
1522 | llgtr %r3,%r3 # char * | ||
1523 | llgtr %r4,%r4 # struct timeval * | ||
1524 | jg compat_sys_futimesat | ||
1525 | |||
1526 | .globl compat_sys_newfstatat_wrapper | ||
1527 | compat_sys_newfstatat_wrapper: | ||
1528 | lgfr %r2,%r2 # int | ||
1529 | llgtr %r3,%r3 # char * | ||
1530 | llgtr %r4,%r4 # struct stat * | ||
1531 | lgfr %r5,%r5 # int | ||
1532 | jg compat_sys_newfstatat | ||
1533 | |||
1534 | .globl sys_unlinkat_wrapper | ||
1535 | sys_unlinkat_wrapper: | ||
1536 | lgfr %r2,%r2 # int | ||
1537 | llgtr %r3,%r3 # const char * | ||
1538 | lgfr %r4,%r4 # int | ||
1539 | jg sys_unlinkat | ||
1540 | |||
1541 | .globl sys_renameat_wrapper | ||
1542 | sys_renameat_wrapper: | ||
1543 | lgfr %r2,%r2 # int | ||
1544 | llgtr %r3,%r3 # const char * | ||
1545 | lgfr %r4,%r4 # int | ||
1546 | llgtr %r5,%r5 # const char * | ||
1547 | jg sys_renameat | ||
1548 | |||
1549 | .globl sys_linkat_wrapper | ||
1550 | sys_linkat_wrapper: | ||
1551 | lgfr %r2,%r2 # int | ||
1552 | llgtr %r3,%r3 # const char * | ||
1553 | lgfr %r4,%r4 # int | ||
1554 | llgtr %r5,%r5 # const char * | ||
1555 | jg sys_linkat | ||
1556 | |||
1557 | .globl sys_symlinkat_wrapper | ||
1558 | sys_symlinkat_wrapper: | ||
1559 | llgtr %r2,%r2 # const char * | ||
1560 | lgfr %r3,%r3 # int | ||
1561 | llgtr %r4,%r4 # const char * | ||
1562 | jg sys_symlinkat | ||
1563 | |||
1564 | .globl sys_readlinkat_wrapper | ||
1565 | sys_readlinkat_wrapper: | ||
1566 | lgfr %r2,%r2 # int | ||
1567 | llgtr %r3,%r3 # const char * | ||
1568 | llgtr %r4,%r4 # char * | ||
1569 | lgfr %r5,%r5 # int | ||
1570 | jg sys_readlinkat | ||
1571 | |||
1572 | .globl sys_fchmodat_wrapper | ||
1573 | sys_fchmodat_wrapper: | ||
1574 | lgfr %r2,%r2 # int | ||
1575 | llgtr %r3,%r3 # const char * | ||
1576 | llgfr %r4,%r4 # mode_t | ||
1577 | jg sys_fchmodat | ||
1578 | |||
1579 | .globl sys_faccessat_wrapper | ||
1580 | sys_faccessat_wrapper: | ||
1581 | lgfr %r2,%r2 # int | ||
1582 | llgtr %r3,%r3 # const char * | ||
1583 | lgfr %r4,%r4 # int | ||
1584 | jg sys_faccessat | ||
1585 | |||
1586 | .globl compat_sys_pselect6_wrapper | ||
1587 | compat_sys_pselect6_wrapper: | ||
1588 | lgfr %r2,%r2 # int | ||
1589 | llgtr %r3,%r3 # fd_set * | ||
1590 | llgtr %r4,%r4 # fd_set * | ||
1591 | llgtr %r5,%r5 # fd_set * | ||
1592 | llgtr %r6,%r6 # struct timespec * | ||
1593 | llgt %r0,164(%r15) # void * | ||
1594 | stg %r0,160(%r15) | ||
1595 | jg compat_sys_pselect6 | ||
1596 | |||
1597 | .globl compat_sys_ppoll_wrapper | ||
1598 | compat_sys_ppoll_wrapper: | ||
1599 | llgtr %r2,%r2 # struct pollfd * | ||
1600 | llgfr %r3,%r3 # unsigned int | ||
1601 | llgtr %r4,%r4 # struct timespec * | ||
1602 | llgtr %r5,%r5 # const sigset_t * | ||
1603 | llgfr %r6,%r6 # size_t | ||
1604 | jg compat_sys_ppoll | ||
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 27b07730b7b8..b2448487854c 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -2,8 +2,7 @@ | |||
2 | * arch/s390/kernel/entry.S | 2 | * arch/s390/kernel/entry.S |
3 | * S390 low-level entry points. | 3 | * S390 low-level entry points. |
4 | * | 4 | * |
5 | * S390 version | 5 | * Copyright (C) IBM Corp. 1999,2006 |
6 | * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
7 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), | 6 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), |
8 | * Hartmut Penner (hp@de.ibm.com), | 7 | * Hartmut Penner (hp@de.ibm.com), |
9 | * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), | 8 | * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), |
@@ -50,9 +49,10 @@ SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC | |||
50 | SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP | 49 | SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP |
51 | SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE | 50 | SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE |
52 | 51 | ||
53 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING | \ | 52 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \ |
54 | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) | 53 | _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) |
55 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING) | 54 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \ |
55 | _TIF_MCCK_PENDING) | ||
56 | 56 | ||
57 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER | 57 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER |
58 | STACK_SIZE = 1 << STACK_SHIFT | 58 | STACK_SIZE = 1 << STACK_SHIFT |
@@ -251,8 +251,8 @@ sysc_work: | |||
251 | bo BASED(sysc_mcck_pending) | 251 | bo BASED(sysc_mcck_pending) |
252 | tm __TI_flags+3(%r9),_TIF_NEED_RESCHED | 252 | tm __TI_flags+3(%r9),_TIF_NEED_RESCHED |
253 | bo BASED(sysc_reschedule) | 253 | bo BASED(sysc_reschedule) |
254 | tm __TI_flags+3(%r9),_TIF_SIGPENDING | 254 | tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) |
255 | bo BASED(sysc_sigpending) | 255 | bnz BASED(sysc_sigpending) |
256 | tm __TI_flags+3(%r9),_TIF_RESTART_SVC | 256 | tm __TI_flags+3(%r9),_TIF_RESTART_SVC |
257 | bo BASED(sysc_restart) | 257 | bo BASED(sysc_restart) |
258 | tm __TI_flags+3(%r9),_TIF_SINGLE_STEP | 258 | tm __TI_flags+3(%r9),_TIF_SINGLE_STEP |
@@ -276,12 +276,11 @@ sysc_mcck_pending: | |||
276 | br %r1 # TIF bit will be cleared by handler | 276 | br %r1 # TIF bit will be cleared by handler |
277 | 277 | ||
278 | # | 278 | # |
279 | # _TIF_SIGPENDING is set, call do_signal | 279 | # _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal |
280 | # | 280 | # |
281 | sysc_sigpending: | 281 | sysc_sigpending: |
282 | ni __TI_flags+3(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP | 282 | ni __TI_flags+3(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP |
283 | la %r2,SP_PTREGS(%r15) # load pt_regs | 283 | la %r2,SP_PTREGS(%r15) # load pt_regs |
284 | sr %r3,%r3 # clear *oldset | ||
285 | l %r1,BASED(.Ldo_signal) | 284 | l %r1,BASED(.Ldo_signal) |
286 | basr %r14,%r1 # call do_signal | 285 | basr %r14,%r1 # call do_signal |
287 | tm __TI_flags+3(%r9),_TIF_RESTART_SVC | 286 | tm __TI_flags+3(%r9),_TIF_RESTART_SVC |
@@ -397,30 +396,6 @@ sys_rt_sigreturn_glue: | |||
397 | l %r1,BASED(.Lrt_sigreturn) | 396 | l %r1,BASED(.Lrt_sigreturn) |
398 | br %r1 # branch to sys_sigreturn | 397 | br %r1 # branch to sys_sigreturn |
399 | 398 | ||
400 | # | ||
401 | # sigsuspend and rt_sigsuspend need pt_regs as an additional | ||
402 | # parameter and they have to skip the store of %r2 into the | ||
403 | # user register %r2 because the return value was set in | ||
404 | # sigsuspend and rt_sigsuspend already and must not be overwritten! | ||
405 | # | ||
406 | |||
407 | sys_sigsuspend_glue: | ||
408 | lr %r5,%r4 # move mask back | ||
409 | lr %r4,%r3 # move history1 parameter | ||
410 | lr %r3,%r2 # move history0 parameter | ||
411 | la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter | ||
412 | l %r1,BASED(.Lsigsuspend) | ||
413 | la %r14,4(%r14) # skip store of return value | ||
414 | br %r1 # branch to sys_sigsuspend | ||
415 | |||
416 | sys_rt_sigsuspend_glue: | ||
417 | lr %r4,%r3 # move sigsetsize parameter | ||
418 | lr %r3,%r2 # move unewset parameter | ||
419 | la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter | ||
420 | l %r1,BASED(.Lrt_sigsuspend) | ||
421 | la %r14,4(%r14) # skip store of return value | ||
422 | br %r1 # branch to sys_rt_sigsuspend | ||
423 | |||
424 | sys_sigaltstack_glue: | 399 | sys_sigaltstack_glue: |
425 | la %r4,SP_PTREGS(%r15) # load pt_regs as parameter | 400 | la %r4,SP_PTREGS(%r15) # load pt_regs as parameter |
426 | l %r1,BASED(.Lsigaltstack) | 401 | l %r1,BASED(.Lsigaltstack) |
@@ -604,15 +579,16 @@ io_work: | |||
604 | lr %r15,%r1 | 579 | lr %r15,%r1 |
605 | # | 580 | # |
606 | # One of the work bits is on. Find out which one. | 581 | # One of the work bits is on. Find out which one. |
607 | # Checked are: _TIF_SIGPENDING, _TIF_NEED_RESCHED and _TIF_MCCK_PENDING | 582 | # Checked are: _TIF_SIGPENDING, _TIF_RESTORE_SIGMASK, _TIF_NEED_RESCHED |
583 | # and _TIF_MCCK_PENDING | ||
608 | # | 584 | # |
609 | io_work_loop: | 585 | io_work_loop: |
610 | tm __TI_flags+3(%r9),_TIF_MCCK_PENDING | 586 | tm __TI_flags+3(%r9),_TIF_MCCK_PENDING |
611 | bo BASED(io_mcck_pending) | 587 | bo BASED(io_mcck_pending) |
612 | tm __TI_flags+3(%r9),_TIF_NEED_RESCHED | 588 | tm __TI_flags+3(%r9),_TIF_NEED_RESCHED |
613 | bo BASED(io_reschedule) | 589 | bo BASED(io_reschedule) |
614 | tm __TI_flags+3(%r9),_TIF_SIGPENDING | 590 | tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) |
615 | bo BASED(io_sigpending) | 591 | bnz BASED(io_sigpending) |
616 | b BASED(io_leave) | 592 | b BASED(io_leave) |
617 | 593 | ||
618 | # | 594 | # |
@@ -636,12 +612,11 @@ io_reschedule: | |||
636 | b BASED(io_work_loop) | 612 | b BASED(io_work_loop) |
637 | 613 | ||
638 | # | 614 | # |
639 | # _TIF_SIGPENDING is set, call do_signal | 615 | # _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal |
640 | # | 616 | # |
641 | io_sigpending: | 617 | io_sigpending: |
642 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts | 618 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts |
643 | la %r2,SP_PTREGS(%r15) # load pt_regs | 619 | la %r2,SP_PTREGS(%r15) # load pt_regs |
644 | sr %r3,%r3 # clear *oldset | ||
645 | l %r1,BASED(.Ldo_signal) | 620 | l %r1,BASED(.Ldo_signal) |
646 | basr %r14,%r1 # call do_signal | 621 | basr %r14,%r1 # call do_signal |
647 | stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts | 622 | stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts |
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index 369ab4413ec7..2ac095bc0e25 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -1,9 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * arch/s390/kernel/entry.S | 2 | * arch/s390/kernel/entry64.S |
3 | * S390 low-level entry points. | 3 | * S390 low-level entry points. |
4 | * | 4 | * |
5 | * S390 version | 5 | * Copyright (C) IBM Corp. 1999,2006 |
6 | * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
7 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), | 6 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), |
8 | * Hartmut Penner (hp@de.ibm.com), | 7 | * Hartmut Penner (hp@de.ibm.com), |
9 | * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), | 8 | * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), |
@@ -53,9 +52,10 @@ SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE | |||
53 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER | 52 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER |
54 | STACK_SIZE = 1 << STACK_SHIFT | 53 | STACK_SIZE = 1 << STACK_SHIFT |
55 | 54 | ||
56 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING | \ | 55 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \ |
57 | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) | 56 | _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) |
58 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING) | 57 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \ |
58 | _TIF_MCCK_PENDING) | ||
59 | 59 | ||
60 | #define BASED(name) name-system_call(%r13) | 60 | #define BASED(name) name-system_call(%r13) |
61 | 61 | ||
@@ -249,8 +249,8 @@ sysc_work: | |||
249 | jo sysc_mcck_pending | 249 | jo sysc_mcck_pending |
250 | tm __TI_flags+7(%r9),_TIF_NEED_RESCHED | 250 | tm __TI_flags+7(%r9),_TIF_NEED_RESCHED |
251 | jo sysc_reschedule | 251 | jo sysc_reschedule |
252 | tm __TI_flags+7(%r9),_TIF_SIGPENDING | 252 | tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) |
253 | jo sysc_sigpending | 253 | jnz sysc_sigpending |
254 | tm __TI_flags+7(%r9),_TIF_RESTART_SVC | 254 | tm __TI_flags+7(%r9),_TIF_RESTART_SVC |
255 | jo sysc_restart | 255 | jo sysc_restart |
256 | tm __TI_flags+7(%r9),_TIF_SINGLE_STEP | 256 | tm __TI_flags+7(%r9),_TIF_SINGLE_STEP |
@@ -272,12 +272,11 @@ sysc_mcck_pending: | |||
272 | jg s390_handle_mcck # TIF bit will be cleared by handler | 272 | jg s390_handle_mcck # TIF bit will be cleared by handler |
273 | 273 | ||
274 | # | 274 | # |
275 | # _TIF_SIGPENDING is set, call do_signal | 275 | # _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal |
276 | # | 276 | # |
277 | sysc_sigpending: | 277 | sysc_sigpending: |
278 | ni __TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP | 278 | ni __TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP |
279 | la %r2,SP_PTREGS(%r15) # load pt_regs | 279 | la %r2,SP_PTREGS(%r15) # load pt_regs |
280 | sgr %r3,%r3 # clear *oldset | ||
281 | brasl %r14,do_signal # call do_signal | 280 | brasl %r14,do_signal # call do_signal |
282 | tm __TI_flags+7(%r9),_TIF_RESTART_SVC | 281 | tm __TI_flags+7(%r9),_TIF_RESTART_SVC |
283 | jo sysc_restart | 282 | jo sysc_restart |
@@ -414,52 +413,6 @@ sys32_rt_sigreturn_glue: | |||
414 | jg sys32_rt_sigreturn # branch to sys32_sigreturn | 413 | jg sys32_rt_sigreturn # branch to sys32_sigreturn |
415 | #endif | 414 | #endif |
416 | 415 | ||
417 | # | ||
418 | # sigsuspend and rt_sigsuspend need pt_regs as an additional | ||
419 | # parameter and they have to skip the store of %r2 into the | ||
420 | # user register %r2 because the return value was set in | ||
421 | # sigsuspend and rt_sigsuspend already and must not be overwritten! | ||
422 | # | ||
423 | |||
424 | sys_sigsuspend_glue: | ||
425 | lgr %r5,%r4 # move mask back | ||
426 | lgr %r4,%r3 # move history1 parameter | ||
427 | lgr %r3,%r2 # move history0 parameter | ||
428 | la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter | ||
429 | la %r14,6(%r14) # skip store of return value | ||
430 | jg sys_sigsuspend # branch to sys_sigsuspend | ||
431 | |||
432 | #ifdef CONFIG_COMPAT | ||
433 | sys32_sigsuspend_glue: | ||
434 | llgfr %r4,%r4 # unsigned long | ||
435 | lgr %r5,%r4 # move mask back | ||
436 | lgfr %r3,%r3 # int | ||
437 | lgr %r4,%r3 # move history1 parameter | ||
438 | lgfr %r2,%r2 # int | ||
439 | lgr %r3,%r2 # move history0 parameter | ||
440 | la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter | ||
441 | la %r14,6(%r14) # skip store of return value | ||
442 | jg sys32_sigsuspend # branch to sys32_sigsuspend | ||
443 | #endif | ||
444 | |||
445 | sys_rt_sigsuspend_glue: | ||
446 | lgr %r4,%r3 # move sigsetsize parameter | ||
447 | lgr %r3,%r2 # move unewset parameter | ||
448 | la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter | ||
449 | la %r14,6(%r14) # skip store of return value | ||
450 | jg sys_rt_sigsuspend # branch to sys_rt_sigsuspend | ||
451 | |||
452 | #ifdef CONFIG_COMPAT | ||
453 | sys32_rt_sigsuspend_glue: | ||
454 | llgfr %r3,%r3 # size_t | ||
455 | lgr %r4,%r3 # move sigsetsize parameter | ||
456 | llgtr %r2,%r2 # sigset_emu31_t * | ||
457 | lgr %r3,%r2 # move unewset parameter | ||
458 | la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter | ||
459 | la %r14,6(%r14) # skip store of return value | ||
460 | jg sys32_rt_sigsuspend # branch to sys32_rt_sigsuspend | ||
461 | #endif | ||
462 | |||
463 | sys_sigaltstack_glue: | 416 | sys_sigaltstack_glue: |
464 | la %r4,SP_PTREGS(%r15) # load pt_regs as parameter | 417 | la %r4,SP_PTREGS(%r15) # load pt_regs as parameter |
465 | jg sys_sigaltstack # branch to sys_sigreturn | 418 | jg sys_sigaltstack # branch to sys_sigreturn |
@@ -646,15 +599,16 @@ io_work: | |||
646 | lgr %r15,%r1 | 599 | lgr %r15,%r1 |
647 | # | 600 | # |
648 | # One of the work bits is on. Find out which one. | 601 | # One of the work bits is on. Find out which one. |
649 | # Checked are: _TIF_SIGPENDING, _TIF_NEED_RESCHED and _TIF_MCCK_PENDING | 602 | # Checked are: _TIF_SIGPENDING, _TIF_RESTORE_SIGPENDING, _TIF_NEED_RESCHED |
603 | # and _TIF_MCCK_PENDING | ||
650 | # | 604 | # |
651 | io_work_loop: | 605 | io_work_loop: |
652 | tm __TI_flags+7(%r9),_TIF_MCCK_PENDING | 606 | tm __TI_flags+7(%r9),_TIF_MCCK_PENDING |
653 | jo io_mcck_pending | 607 | jo io_mcck_pending |
654 | tm __TI_flags+7(%r9),_TIF_NEED_RESCHED | 608 | tm __TI_flags+7(%r9),_TIF_NEED_RESCHED |
655 | jo io_reschedule | 609 | jo io_reschedule |
656 | tm __TI_flags+7(%r9),_TIF_SIGPENDING | 610 | tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) |
657 | jo io_sigpending | 611 | jnz io_sigpending |
658 | j io_leave | 612 | j io_leave |
659 | 613 | ||
660 | # | 614 | # |
@@ -676,12 +630,11 @@ io_reschedule: | |||
676 | j io_work_loop | 630 | j io_work_loop |
677 | 631 | ||
678 | # | 632 | # |
679 | # _TIF_SIGPENDING is set, call do_signal | 633 | # _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal |
680 | # | 634 | # |
681 | io_sigpending: | 635 | io_sigpending: |
682 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts | 636 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts |
683 | la %r2,SP_PTREGS(%r15) # load pt_regs | 637 | la %r2,SP_PTREGS(%r15) # load pt_regs |
684 | slgr %r3,%r3 # clear *oldset | ||
685 | brasl %r14,do_signal # call do_signal | 638 | brasl %r14,do_signal # call do_signal |
686 | stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts | 639 | stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts |
687 | j io_work_loop | 640 | j io_work_loop |
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 6ae4a77270b5..ae1927e48cfb 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -1,8 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/s390/kernel/signal.c | 2 | * arch/s390/kernel/signal.c |
3 | * | 3 | * |
4 | * S390 version | 4 | * Copyright (C) IBM Corp. 1999,2006 |
5 | * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
6 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | 5 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) |
7 | * | 6 | * |
8 | * Based on Intel version | 7 | * Based on Intel version |
@@ -51,60 +50,24 @@ typedef struct | |||
51 | struct ucontext uc; | 50 | struct ucontext uc; |
52 | } rt_sigframe; | 51 | } rt_sigframe; |
53 | 52 | ||
54 | int do_signal(struct pt_regs *regs, sigset_t *oldset); | ||
55 | |||
56 | /* | 53 | /* |
57 | * Atomically swap in the new signal mask, and wait for a signal. | 54 | * Atomically swap in the new signal mask, and wait for a signal. |
58 | */ | 55 | */ |
59 | asmlinkage int | 56 | asmlinkage int |
60 | sys_sigsuspend(struct pt_regs * regs, int history0, int history1, | 57 | sys_sigsuspend(int history0, int history1, old_sigset_t mask) |
61 | old_sigset_t mask) | ||
62 | { | 58 | { |
63 | sigset_t saveset; | ||
64 | |||
65 | mask &= _BLOCKABLE; | 59 | mask &= _BLOCKABLE; |
66 | spin_lock_irq(¤t->sighand->siglock); | 60 | spin_lock_irq(¤t->sighand->siglock); |
67 | saveset = current->blocked; | 61 | current->saved_sigmask = current->blocked; |
68 | siginitset(¤t->blocked, mask); | 62 | siginitset(¤t->blocked, mask); |
69 | recalc_sigpending(); | 63 | recalc_sigpending(); |
70 | spin_unlock_irq(¤t->sighand->siglock); | 64 | spin_unlock_irq(¤t->sighand->siglock); |
71 | regs->gprs[2] = -EINTR; | ||
72 | |||
73 | while (1) { | ||
74 | set_current_state(TASK_INTERRUPTIBLE); | ||
75 | schedule(); | ||
76 | if (do_signal(regs, &saveset)) | ||
77 | return -EINTR; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | asmlinkage long | ||
82 | sys_rt_sigsuspend(struct pt_regs *regs, sigset_t __user *unewset, | ||
83 | size_t sigsetsize) | ||
84 | { | ||
85 | sigset_t saveset, newset; | ||
86 | 65 | ||
87 | /* XXX: Don't preclude handling different sized sigset_t's. */ | 66 | current->state = TASK_INTERRUPTIBLE; |
88 | if (sigsetsize != sizeof(sigset_t)) | 67 | schedule(); |
89 | return -EINVAL; | 68 | set_thread_flag(TIF_RESTORE_SIGMASK); |
90 | 69 | ||
91 | if (copy_from_user(&newset, unewset, sizeof(newset))) | 70 | return -ERESTARTNOHAND; |
92 | return -EFAULT; | ||
93 | sigdelsetmask(&newset, ~_BLOCKABLE); | ||
94 | |||
95 | spin_lock_irq(¤t->sighand->siglock); | ||
96 | saveset = current->blocked; | ||
97 | current->blocked = newset; | ||
98 | recalc_sigpending(); | ||
99 | spin_unlock_irq(¤t->sighand->siglock); | ||
100 | regs->gprs[2] = -EINTR; | ||
101 | |||
102 | while (1) { | ||
103 | set_current_state(TASK_INTERRUPTIBLE); | ||
104 | schedule(); | ||
105 | if (do_signal(regs, &saveset)) | ||
106 | return -EINTR; | ||
107 | } | ||
108 | } | 71 | } |
109 | 72 | ||
110 | asmlinkage long | 73 | asmlinkage long |
@@ -306,8 +269,8 @@ static inline int map_signal(int sig) | |||
306 | return sig; | 269 | return sig; |
307 | } | 270 | } |
308 | 271 | ||
309 | static void setup_frame(int sig, struct k_sigaction *ka, | 272 | static int setup_frame(int sig, struct k_sigaction *ka, |
310 | sigset_t *set, struct pt_regs * regs) | 273 | sigset_t *set, struct pt_regs * regs) |
311 | { | 274 | { |
312 | sigframe __user *frame; | 275 | sigframe __user *frame; |
313 | 276 | ||
@@ -355,13 +318,14 @@ static void setup_frame(int sig, struct k_sigaction *ka, | |||
355 | /* Place signal number on stack to allow backtrace from handler. */ | 318 | /* Place signal number on stack to allow backtrace from handler. */ |
356 | if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) | 319 | if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) |
357 | goto give_sigsegv; | 320 | goto give_sigsegv; |
358 | return; | 321 | return 0; |
359 | 322 | ||
360 | give_sigsegv: | 323 | give_sigsegv: |
361 | force_sigsegv(sig, current); | 324 | force_sigsegv(sig, current); |
325 | return -EFAULT; | ||
362 | } | 326 | } |
363 | 327 | ||
364 | static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 328 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
365 | sigset_t *set, struct pt_regs * regs) | 329 | sigset_t *set, struct pt_regs * regs) |
366 | { | 330 | { |
367 | int err = 0; | 331 | int err = 0; |
@@ -409,32 +373,39 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
409 | regs->gprs[2] = map_signal(sig); | 373 | regs->gprs[2] = map_signal(sig); |
410 | regs->gprs[3] = (unsigned long) &frame->info; | 374 | regs->gprs[3] = (unsigned long) &frame->info; |
411 | regs->gprs[4] = (unsigned long) &frame->uc; | 375 | regs->gprs[4] = (unsigned long) &frame->uc; |
412 | return; | 376 | return 0; |
413 | 377 | ||
414 | give_sigsegv: | 378 | give_sigsegv: |
415 | force_sigsegv(sig, current); | 379 | force_sigsegv(sig, current); |
380 | return -EFAULT; | ||
416 | } | 381 | } |
417 | 382 | ||
418 | /* | 383 | /* |
419 | * OK, we're invoking a handler | 384 | * OK, we're invoking a handler |
420 | */ | 385 | */ |
421 | 386 | ||
422 | static void | 387 | static int |
423 | handle_signal(unsigned long sig, struct k_sigaction *ka, | 388 | handle_signal(unsigned long sig, struct k_sigaction *ka, |
424 | siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) | 389 | siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) |
425 | { | 390 | { |
391 | int ret; | ||
392 | |||
426 | /* Set up the stack frame */ | 393 | /* Set up the stack frame */ |
427 | if (ka->sa.sa_flags & SA_SIGINFO) | 394 | if (ka->sa.sa_flags & SA_SIGINFO) |
428 | setup_rt_frame(sig, ka, info, oldset, regs); | 395 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
429 | else | 396 | else |
430 | setup_frame(sig, ka, oldset, regs); | 397 | ret = setup_frame(sig, ka, oldset, regs); |
398 | |||
399 | if (ret == 0) { | ||
400 | spin_lock_irq(¤t->sighand->siglock); | ||
401 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | ||
402 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
403 | sigaddset(¤t->blocked,sig); | ||
404 | recalc_sigpending(); | ||
405 | spin_unlock_irq(¤t->sighand->siglock); | ||
406 | } | ||
431 | 407 | ||
432 | spin_lock_irq(¤t->sighand->siglock); | 408 | return ret; |
433 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | ||
434 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
435 | sigaddset(¤t->blocked,sig); | ||
436 | recalc_sigpending(); | ||
437 | spin_unlock_irq(¤t->sighand->siglock); | ||
438 | } | 409 | } |
439 | 410 | ||
440 | /* | 411 | /* |
@@ -446,12 +417,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
446 | * the kernel can handle, and then we build all the user-level signal handling | 417 | * the kernel can handle, and then we build all the user-level signal handling |
447 | * stack-frames in one go after that. | 418 | * stack-frames in one go after that. |
448 | */ | 419 | */ |
449 | int do_signal(struct pt_regs *regs, sigset_t *oldset) | 420 | void do_signal(struct pt_regs *regs) |
450 | { | 421 | { |
451 | unsigned long retval = 0, continue_addr = 0, restart_addr = 0; | 422 | unsigned long retval = 0, continue_addr = 0, restart_addr = 0; |
452 | siginfo_t info; | 423 | siginfo_t info; |
453 | int signr; | 424 | int signr; |
454 | struct k_sigaction ka; | 425 | struct k_sigaction ka; |
426 | sigset_t *oldset; | ||
455 | 427 | ||
456 | /* | 428 | /* |
457 | * We want the common case to go fast, which | 429 | * We want the common case to go fast, which |
@@ -460,9 +432,11 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
460 | * if so. | 432 | * if so. |
461 | */ | 433 | */ |
462 | if (!user_mode(regs)) | 434 | if (!user_mode(regs)) |
463 | return 1; | 435 | return; |
464 | 436 | ||
465 | if (!oldset) | 437 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
438 | oldset = ¤t->saved_sigmask; | ||
439 | else | ||
466 | oldset = ¤t->blocked; | 440 | oldset = ¤t->blocked; |
467 | 441 | ||
468 | /* Are we from a system call? */ | 442 | /* Are we from a system call? */ |
@@ -473,12 +447,14 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
473 | 447 | ||
474 | /* Prepare for system call restart. We do this here so that a | 448 | /* Prepare for system call restart. We do this here so that a |
475 | debugger will see the already changed PSW. */ | 449 | debugger will see the already changed PSW. */ |
476 | if (retval == -ERESTARTNOHAND || | 450 | switch (retval) { |
477 | retval == -ERESTARTSYS || | 451 | case -ERESTARTNOHAND: |
478 | retval == -ERESTARTNOINTR) { | 452 | case -ERESTARTSYS: |
453 | case -ERESTARTNOINTR: | ||
479 | regs->gprs[2] = regs->orig_gpr2; | 454 | regs->gprs[2] = regs->orig_gpr2; |
480 | regs->psw.addr = restart_addr; | 455 | regs->psw.addr = restart_addr; |
481 | } else if (retval == -ERESTART_RESTARTBLOCK) { | 456 | break; |
457 | case -ERESTART_RESTARTBLOCK: | ||
482 | regs->gprs[2] = -EINTR; | 458 | regs->gprs[2] = -EINTR; |
483 | } | 459 | } |
484 | } | 460 | } |
@@ -503,17 +479,38 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
503 | /* Whee! Actually deliver the signal. */ | 479 | /* Whee! Actually deliver the signal. */ |
504 | #ifdef CONFIG_COMPAT | 480 | #ifdef CONFIG_COMPAT |
505 | if (test_thread_flag(TIF_31BIT)) { | 481 | if (test_thread_flag(TIF_31BIT)) { |
506 | extern void handle_signal32(unsigned long sig, | 482 | extern int handle_signal32(unsigned long sig, |
507 | struct k_sigaction *ka, | 483 | struct k_sigaction *ka, |
508 | siginfo_t *info, | 484 | siginfo_t *info, |
509 | sigset_t *oldset, | 485 | sigset_t *oldset, |
510 | struct pt_regs *regs); | 486 | struct pt_regs *regs); |
511 | handle_signal32(signr, &ka, &info, oldset, regs); | 487 | if (handle_signal32( |
512 | return 1; | 488 | signr, &ka, &info, oldset, regs) == 0) { |
489 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
490 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
491 | } | ||
492 | return; | ||
513 | } | 493 | } |
514 | #endif | 494 | #endif |
515 | handle_signal(signr, &ka, &info, oldset, regs); | 495 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { |
516 | return 1; | 496 | /* |
497 | * A signal was successfully delivered; the saved | ||
498 | * sigmask will have been stored in the signal frame, | ||
499 | * and will be restored by sigreturn, so we can simply | ||
500 | * clear the TIF_RESTORE_SIGMASK flag. | ||
501 | */ | ||
502 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
503 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
504 | } | ||
505 | return; | ||
506 | } | ||
507 | |||
508 | /* | ||
509 | * If there's no signal to deliver, we just put the saved sigmask back. | ||
510 | */ | ||
511 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | ||
512 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
513 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
517 | } | 514 | } |
518 | 515 | ||
519 | /* Restart a different system call. */ | 516 | /* Restart a different system call. */ |
@@ -522,5 +519,4 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
522 | regs->gprs[2] = __NR_restart_syscall; | 519 | regs->gprs[2] = __NR_restart_syscall; |
523 | set_thread_flag(TIF_RESTART_SVC); | 520 | set_thread_flag(TIF_RESTART_SVC); |
524 | } | 521 | } |
525 | return 0; | ||
526 | } | 522 | } |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 426d7cafdab3..3280345efacd 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -80,7 +80,7 @@ NI_SYSCALL /* old sgetmask syscall*/ | |||
80 | NI_SYSCALL /* old ssetmask syscall*/ | 80 | NI_SYSCALL /* old ssetmask syscall*/ |
81 | SYSCALL(sys_setreuid16,sys_ni_syscall,sys32_setreuid16_wrapper) /* old setreuid16 syscall */ | 81 | SYSCALL(sys_setreuid16,sys_ni_syscall,sys32_setreuid16_wrapper) /* old setreuid16 syscall */ |
82 | SYSCALL(sys_setregid16,sys_ni_syscall,sys32_setregid16_wrapper) /* old setregid16 syscall */ | 82 | SYSCALL(sys_setregid16,sys_ni_syscall,sys32_setregid16_wrapper) /* old setregid16 syscall */ |
83 | SYSCALL(sys_sigsuspend_glue,sys_sigsuspend_glue,sys32_sigsuspend_glue) | 83 | SYSCALL(sys_sigsuspend,sys_sigsuspend,sys_sigsuspend_wrapper) |
84 | SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending_wrapper) | 84 | SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending_wrapper) |
85 | SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper) | 85 | SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper) |
86 | SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */ | 86 | SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */ |
@@ -187,7 +187,7 @@ SYSCALL(sys_rt_sigprocmask,sys_rt_sigprocmask,sys32_rt_sigprocmask_wrapper) /* 1 | |||
187 | SYSCALL(sys_rt_sigpending,sys_rt_sigpending,sys32_rt_sigpending_wrapper) | 187 | SYSCALL(sys_rt_sigpending,sys_rt_sigpending,sys32_rt_sigpending_wrapper) |
188 | SYSCALL(sys_rt_sigtimedwait,sys_rt_sigtimedwait,compat_sys_rt_sigtimedwait_wrapper) | 188 | SYSCALL(sys_rt_sigtimedwait,sys_rt_sigtimedwait,compat_sys_rt_sigtimedwait_wrapper) |
189 | SYSCALL(sys_rt_sigqueueinfo,sys_rt_sigqueueinfo,sys32_rt_sigqueueinfo_wrapper) | 189 | SYSCALL(sys_rt_sigqueueinfo,sys_rt_sigqueueinfo,sys32_rt_sigqueueinfo_wrapper) |
190 | SYSCALL(sys_rt_sigsuspend_glue,sys_rt_sigsuspend_glue,sys32_rt_sigsuspend_glue) | 190 | SYSCALL(sys_rt_sigsuspend,sys_rt_sigsuspend,compat_sys_rt_sigsuspend_wrapper) |
191 | SYSCALL(sys_pread64,sys_pread64,sys32_pread64_wrapper) /* 180 */ | 191 | SYSCALL(sys_pread64,sys_pread64,sys32_pread64_wrapper) /* 180 */ |
192 | SYSCALL(sys_pwrite64,sys_pwrite64,sys32_pwrite64_wrapper) | 192 | SYSCALL(sys_pwrite64,sys_pwrite64,sys32_pwrite64_wrapper) |
193 | SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall */ | 193 | SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall */ |
@@ -293,5 +293,21 @@ SYSCALL(sys_waitid,sys_waitid,compat_sys_waitid_wrapper) | |||
293 | SYSCALL(sys_ioprio_set,sys_ioprio_set,sys_ioprio_set_wrapper) | 293 | SYSCALL(sys_ioprio_set,sys_ioprio_set,sys_ioprio_set_wrapper) |
294 | SYSCALL(sys_ioprio_get,sys_ioprio_get,sys_ioprio_get_wrapper) | 294 | SYSCALL(sys_ioprio_get,sys_ioprio_get,sys_ioprio_get_wrapper) |
295 | SYSCALL(sys_inotify_init,sys_inotify_init,sys_inotify_init) | 295 | SYSCALL(sys_inotify_init,sys_inotify_init,sys_inotify_init) |
296 | SYSCALL(sys_inotify_add_watch,sys_inotify_add_watch,sys_inotify_add_watch_wrapper) | 296 | SYSCALL(sys_inotify_add_watch,sys_inotify_add_watch,sys_inotify_add_watch_wrapper) /* 285 */ |
297 | SYSCALL(sys_inotify_rm_watch,sys_inotify_rm_watch,sys_inotify_rm_watch_wrapper) | 297 | SYSCALL(sys_inotify_rm_watch,sys_inotify_rm_watch,sys_inotify_rm_watch_wrapper) |
298 | NI_SYSCALL /* 287 sys_migrate_pages */ | ||
299 | SYSCALL(sys_openat,sys_openat,compat_sys_openat_wrapper) | ||
300 | SYSCALL(sys_mkdirat,sys_mkdirat,sys_mkdirat_wrapper) | ||
301 | SYSCALL(sys_mknodat,sys_mknodat,sys_mknodat_wrapper) /* 290 */ | ||
302 | SYSCALL(sys_fchownat,sys_fchownat,sys_fchownat_wrapper) | ||
303 | SYSCALL(sys_futimesat,sys_futimesat,compat_sys_futimesat_wrapper) | ||
304 | SYSCALL(sys_newfstatat,sys_newfstatat,compat_sys_newfstatat_wrapper) | ||
305 | SYSCALL(sys_unlinkat,sys_unlinkat,sys_unlinkat_wrapper) | ||
306 | SYSCALL(sys_renameat,sys_renameat,sys_renameat_wrapper) /* 295 */ | ||
307 | SYSCALL(sys_linkat,sys_linkat,sys_linkat_wrapper) | ||
308 | SYSCALL(sys_symlinkat,sys_symlinkat,sys_symlinkat_wrapper) | ||
309 | SYSCALL(sys_readlinkat,sys_readlinkat,sys_readlinkat_wrapper) | ||
310 | SYSCALL(sys_fchmodat,sys_fchmodat,sys_fchmodat_wrapper) | ||
311 | SYSCALL(sys_faccessat,sys_faccessat,sys_faccessat_wrapper) /* 300 */ | ||
312 | SYSCALL(sys_pselect6,sys_pselect6,compat_sys_pselect6_wrapper) | ||
313 | SYSCALL(sys_ppoll,sys_ppoll,compat_sys_ppoll_wrapper) | ||
diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h index f3797a52c4ea..8e0c7ed73d03 100644 --- a/include/asm-s390/thread_info.h +++ b/include/asm-s390/thread_info.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * include/asm-s390/thread_info.h | 2 | * include/asm-s390/thread_info.h |
3 | * | 3 | * |
4 | * S390 version | 4 | * S390 version |
5 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation | 5 | * Copyright (C) IBM Corp. 2002,2006 |
6 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) | 6 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) |
7 | */ | 7 | */ |
8 | 8 | ||
@@ -88,7 +88,7 @@ static inline struct thread_info *current_thread_info(void) | |||
88 | * thread information flags bit numbers | 88 | * thread information flags bit numbers |
89 | */ | 89 | */ |
90 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 90 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
91 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | 91 | #define TIF_RESTORE_SIGMASK 1 /* restore signal mask in do_signal() */ |
92 | #define TIF_SIGPENDING 2 /* signal pending */ | 92 | #define TIF_SIGPENDING 2 /* signal pending */ |
93 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 93 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
94 | #define TIF_RESTART_SVC 4 /* restart svc with new svc number */ | 94 | #define TIF_RESTART_SVC 4 /* restart svc with new svc number */ |
@@ -102,7 +102,7 @@ static inline struct thread_info *current_thread_info(void) | |||
102 | #define TIF_MEMDIE 19 | 102 | #define TIF_MEMDIE 19 |
103 | 103 | ||
104 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 104 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
105 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 105 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) |
106 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 106 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
107 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 107 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
108 | #define _TIF_RESTART_SVC (1<<TIF_RESTART_SVC) | 108 | #define _TIF_RESTART_SVC (1<<TIF_RESTART_SVC) |
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index 2861cdc243ad..29a9f357eb9e 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h | |||
@@ -279,8 +279,24 @@ | |||
279 | #define __NR_inotify_init 284 | 279 | #define __NR_inotify_init 284 |
280 | #define __NR_inotify_add_watch 285 | 280 | #define __NR_inotify_add_watch 285 |
281 | #define __NR_inotify_rm_watch 286 | 281 | #define __NR_inotify_rm_watch 286 |
282 | /* Number 287 is reserved for new sys_migrate_pages */ | ||
283 | #define __NR_openat 288 | ||
284 | #define __NR_mkdirat 289 | ||
285 | #define __NR_mknodat 290 | ||
286 | #define __NR_fchownat 291 | ||
287 | #define __NR_futimesat 292 | ||
288 | #define __NR_newfstatat 293 | ||
289 | #define __NR_unlinkat 294 | ||
290 | #define __NR_renameat 295 | ||
291 | #define __NR_linkat 296 | ||
292 | #define __NR_symlinkat 297 | ||
293 | #define __NR_readlinkat 298 | ||
294 | #define __NR_fchmodat 299 | ||
295 | #define __NR_faccessat 300 | ||
296 | #define __NR_pselect6 301 | ||
297 | #define __NR_ppoll 302 | ||
282 | 298 | ||
283 | #define NR_syscalls 287 | 299 | #define NR_syscalls 303 |
284 | 300 | ||
285 | /* | 301 | /* |
286 | * There are some system calls that are not present on 64 bit, some | 302 | * There are some system calls that are not present on 64 bit, some |
@@ -539,11 +555,15 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ | |||
539 | #define __ARCH_WANT_SYS_SIGPENDING | 555 | #define __ARCH_WANT_SYS_SIGPENDING |
540 | #define __ARCH_WANT_SYS_SIGPROCMASK | 556 | #define __ARCH_WANT_SYS_SIGPROCMASK |
541 | #define __ARCH_WANT_SYS_RT_SIGACTION | 557 | #define __ARCH_WANT_SYS_RT_SIGACTION |
558 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
542 | # ifndef CONFIG_64BIT | 559 | # ifndef CONFIG_64BIT |
543 | # define __ARCH_WANT_STAT64 | 560 | # define __ARCH_WANT_STAT64 |
544 | # define __ARCH_WANT_SYS_TIME | 561 | # define __ARCH_WANT_SYS_TIME |
545 | # endif | 562 | # endif |
546 | # define __ARCH_WANT_COMPAT_SYS_TIME | 563 | # ifdef CONFIG_COMPAT |
564 | # define __ARCH_WANT_COMPAT_SYS_TIME | ||
565 | # define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND | ||
566 | # endif | ||
547 | #endif | 567 | #endif |
548 | 568 | ||
549 | #ifdef __KERNEL_SYSCALLS__ | 569 | #ifdef __KERNEL_SYSCALLS__ |