~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/i386/kernel/signal.c

Version: ~ [ linux-5.14-rc3 ] ~ [ linux-5.13.5 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.53 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.135 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.198 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.240 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.276 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.276 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  linux/arch/i386/kernel/signal.c
  3  *
  4  *  Copyright (C) 1991, 1992  Linus Torvalds
  5  *
  6  *  1997-11-28  Modified for POSIX.1b signals by Richard Henderson
  7  *  2000-06-20  Pentium III FXSR, SSE support by Gareth Hughes
  8  */
  9 
 10 #include <linux/sched.h>
 11 #include <linux/mm.h>
 12 #include <linux/smp.h>
 13 #include <linux/smp_lock.h>
 14 #include <linux/kernel.h>
 15 #include <linux/signal.h>
 16 #include <linux/errno.h>
 17 #include <linux/wait.h>
 18 #include <linux/unistd.h>
 19 #include <linux/stddef.h>
 20 #include <linux/personality.h>
 21 #include <linux/suspend.h>
 22 #include <linux/elf.h>
 23 #include <asm/ucontext.h>
 24 #include <asm/uaccess.h>
 25 #include <asm/i387.h>
 26 #include "sigframe.h"
 27 
 28 #define DEBUG_SIG 0
 29 
 30 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 31 
 32 /*
 33  * Atomically swap in the new signal mask, and wait for a signal.
 34  */
 35 asmlinkage int
 36 sys_sigsuspend(int history0, int history1, old_sigset_t mask)
 37 {
 38         struct pt_regs * regs = (struct pt_regs *) &history0;
 39         sigset_t saveset;
 40 
 41         mask &= _BLOCKABLE;
 42         spin_lock_irq(&current->sighand->siglock);
 43         saveset = current->blocked;
 44         siginitset(&current->blocked, mask);
 45         recalc_sigpending();
 46         spin_unlock_irq(&current->sighand->siglock);
 47 
 48         regs->eax = -EINTR;
 49         while (1) {
 50                 current->state = TASK_INTERRUPTIBLE;
 51                 schedule();
 52                 if (do_signal(regs, &saveset))
 53                         return -EINTR;
 54         }
 55 }
 56 
 57 asmlinkage int
 58 sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize)
 59 {
 60         struct pt_regs * regs = (struct pt_regs *) &unewset;
 61         sigset_t saveset, newset;
 62 
 63         /* XXX: Don't preclude handling different sized sigset_t's.  */
 64         if (sigsetsize != sizeof(sigset_t))
 65                 return -EINVAL;
 66 
 67         if (copy_from_user(&newset, unewset, sizeof(newset)))
 68                 return -EFAULT;
 69         sigdelsetmask(&newset, ~_BLOCKABLE);
 70 
 71         spin_lock_irq(&current->sighand->siglock);
 72         saveset = current->blocked;
 73         current->blocked = newset;
 74         recalc_sigpending();
 75         spin_unlock_irq(&current->sighand->siglock);
 76 
 77         regs->eax = -EINTR;
 78         while (1) {
 79                 current->state = TASK_INTERRUPTIBLE;
 80                 schedule();
 81                 if (do_signal(regs, &saveset))
 82                         return -EINTR;
 83         }
 84 }
 85 
 86 asmlinkage int 
 87 sys_sigaction(int sig, const struct old_sigaction __user *act,
 88               struct old_sigaction __user *oact)
 89 {
 90         struct k_sigaction new_ka, old_ka;
 91         int ret;
 92 
 93         if (act) {
 94                 old_sigset_t mask;
 95                 if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
 96                     __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
 97                     __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
 98                         return -EFAULT;
 99                 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
100                 __get_user(mask, &act->sa_mask);
101                 siginitset(&new_ka.sa.sa_mask, mask);
102         }
103 
104         ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
105 
106         if (!ret && oact) {
107                 if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
108                     __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
109                     __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
110                         return -EFAULT;
111                 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
112                 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
113         }
114 
115         return ret;
116 }
117 
118 asmlinkage int
119 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
120 {
121         struct pt_regs *regs = (struct pt_regs *) &uss;
122         return do_sigaltstack(uss, uoss, regs->esp);
123 }
124 
125 
126 /*
127  * Do a signal return; undo the signal stack.
128  */
129 
130 static int
131 restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax)
132 {
133         unsigned int err = 0;
134 
135         /* Always make any pending restarted system calls return -EINTR */
136         current_thread_info()->restart_block.fn = do_no_restart_syscall;
137 
138 #define COPY(x)         err |= __get_user(regs->x, &sc->x)
139 
140 #define COPY_SEG(seg)                                                   \
141         { unsigned short tmp;                                           \
142           err |= __get_user(tmp, &sc->seg);                             \
143           regs->x##seg = tmp; }
144 
145 #define COPY_SEG_STRICT(seg)                                            \
146         { unsigned short tmp;                                           \
147           err |= __get_user(tmp, &sc->seg);                             \
148           regs->x##seg = tmp|3; }
149 
150 #define GET_SEG(seg)                                                    \
151         { unsigned short tmp;                                           \
152           err |= __get_user(tmp, &sc->seg);                             \
153           loadsegment(seg,tmp); }
154 
155         GET_SEG(gs);
156         GET_SEG(fs);
157         COPY_SEG(es);
158         COPY_SEG(ds);
159         COPY(edi);
160         COPY(esi);
161         COPY(ebp);
162         COPY(esp);
163         COPY(ebx);
164         COPY(edx);
165         COPY(ecx);
166         COPY(eip);
167         COPY_SEG_STRICT(cs);
168         COPY_SEG_STRICT(ss);
169         
170         {
171                 unsigned int tmpflags;
172                 err |= __get_user(tmpflags, &sc->eflags);
173                 regs->eflags = (regs->eflags & ~0x40DD5) | (tmpflags & 0x40DD5);
174                 regs->orig_eax = -1;            /* disable syscall checks */
175         }
176 
177         {
178                 struct _fpstate __user * buf;
179                 err |= __get_user(buf, &sc->fpstate);
180                 if (buf) {
181                         if (verify_area(VERIFY_READ, buf, sizeof(*buf)))
182                                 goto badframe;
183                         err |= restore_i387(buf);
184                 }
185         }
186 
187         err |= __get_user(*peax, &sc->eax);
188         return err;
189 
190 badframe:
191         return 1;
192 }
193 
194 asmlinkage int sys_sigreturn(unsigned long __unused)
195 {
196         struct pt_regs *regs = (struct pt_regs *) &__unused;
197         struct sigframe __user *frame = (struct sigframe __user *)(regs->esp - 8);
198         sigset_t set;
199         int eax;
200 
201         if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
202                 goto badframe;
203         if (__get_user(set.sig[0], &frame->sc.oldmask)
204             || (_NSIG_WORDS > 1
205                 && __copy_from_user(&set.sig[1], &frame->extramask,
206                                     sizeof(frame->extramask))))
207                 goto badframe;
208 
209         sigdelsetmask(&set, ~_BLOCKABLE);
210         spin_lock_irq(&current->sighand->siglock);
211         current->blocked = set;
212         recalc_sigpending();
213         spin_unlock_irq(&current->sighand->siglock);
214         
215         if (restore_sigcontext(regs, &frame->sc, &eax))
216                 goto badframe;
217         return eax;
218 
219 badframe:
220         force_sig(SIGSEGV, current);
221         return 0;
222 }       
223 
224 asmlinkage int sys_rt_sigreturn(unsigned long __unused)
225 {
226         struct pt_regs *regs = (struct pt_regs *) &__unused;
227         struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(regs->esp - 4);
228         sigset_t set;
229         stack_t st;
230         int eax;
231 
232         if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
233                 goto badframe;
234         if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
235                 goto badframe;
236 
237         sigdelsetmask(&set, ~_BLOCKABLE);
238         spin_lock_irq(&current->sighand->siglock);
239         current->blocked = set;
240         recalc_sigpending();
241         spin_unlock_irq(&current->sighand->siglock);
242         
243         if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &eax))
244                 goto badframe;
245 
246         if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
247                 goto badframe;
248         /* It is more difficult to avoid calling this function than to
249            call it and ignore errors.  */
250         /*
251          * THIS CANNOT WORK! "&st" is a kernel address, and "do_sigaltstack()"
252          * takes a user address (and verifies that it is a user address). End
253          * result: it does exactly _nothing_.
254          */
255         do_sigaltstack(&st, NULL, regs->esp);
256 
257         return eax;
258 
259 badframe:
260         force_sig(SIGSEGV, current);
261         return 0;
262 }       
263 
264 /*
265  * Set up a signal frame.
266  */
267 
268 static int
269 setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate,
270                  struct pt_regs *regs, unsigned long mask)
271 {
272         int tmp, err = 0;
273 
274         tmp = 0;
275         __asm__("movl %%gs,%0" : "=r"(tmp): ""(tmp));
276         err |= __put_user(tmp, (unsigned int *)&sc->gs);
277         __asm__("movl %%fs,%0" : "=r"(tmp): ""(tmp));
278         err |= __put_user(tmp, (unsigned int *)&sc->fs);
279 
280         err |= __put_user(regs->xes, (unsigned int *)&sc->es);
281         err |= __put_user(regs->xds, (unsigned int *)&sc->ds);
282         err |= __put_user(regs->edi, &sc->edi);
283         err |= __put_user(regs->esi, &sc->esi);
284         err |= __put_user(regs->ebp, &sc->ebp);
285         err |= __put_user(regs->esp, &sc->esp);
286         err |= __put_user(regs->ebx, &sc->ebx);
287         err |= __put_user(regs->edx, &sc->edx);
288         err |= __put_user(regs->ecx, &sc->ecx);
289         err |= __put_user(regs->eax, &sc->eax);
290         err |= __put_user(current->thread.trap_no, &sc->trapno);
291         err |= __put_user(current->thread.error_code, &sc->err);
292         err |= __put_user(regs->eip, &sc->eip);
293         err |= __put_user(regs->xcs, (unsigned int *)&sc->cs);
294         err |= __put_user(regs->eflags, &sc->eflags);
295         err |= __put_user(regs->esp, &sc->esp_at_signal);
296         err |= __put_user(regs->xss, (unsigned int *)&sc->ss);
297 
298         tmp = save_i387(fpstate);
299         if (tmp < 0)
300           err = 1;
301         else
302           err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate);
303 
304         /* non-iBCS2 extensions.. */
305         err |= __put_user(mask, &sc->oldmask);
306         err |= __put_user(current->thread.cr2, &sc->cr2);
307 
308         return err;
309 }
310 
311 /*
312  * Determine which stack to use..
313  */
314 static inline void __user *
315 get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
316 {
317         unsigned long esp;
318 
319         /* Default to using normal stack */
320         esp = regs->esp;
321 
322         /* This is the X/Open sanctioned signal stack switching.  */
323         if (ka->sa.sa_flags & SA_ONSTACK) {
324                 if (sas_ss_flags(esp) == 0)
325                         esp = current->sas_ss_sp + current->sas_ss_size;
326         }
327 
328         /* This is the legacy signal stack switching. */
329         else if ((regs->xss & 0xffff) != __USER_DS &&
330                  !(ka->sa.sa_flags & SA_RESTORER) &&
331                  ka->sa.sa_restorer) {
332                 esp = (unsigned long) ka->sa.sa_restorer;
333         }
334 
335         return (void __user *)((esp - frame_size) & -8ul);
336 }
337 
338 /* These symbols are defined with the addresses in the vsyscall page.
339    See vsyscall-sigreturn.S.  */
340 extern void __kernel_sigreturn, __kernel_rt_sigreturn;
341 
342 static void setup_frame(int sig, struct k_sigaction *ka,
343                         sigset_t *set, struct pt_regs * regs)
344 {
345         void *restorer;
346         struct sigframe __user *frame;
347         int err = 0;
348 
349         frame = get_sigframe(ka, regs, sizeof(*frame));
350 
351         if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
352                 goto give_sigsegv;
353 
354         err |= __put_user((current_thread_info()->exec_domain
355                            && current_thread_info()->exec_domain->signal_invmap
356                            && sig < 32
357                            ? current_thread_info()->exec_domain->signal_invmap[sig]
358                            : sig),
359                           &frame->sig);
360         if (err)
361                 goto give_sigsegv;
362 
363         err |= setup_sigcontext(&frame->sc, &frame->fpstate, regs, set->sig[0]);
364         if (err)
365                 goto give_sigsegv;
366 
367         if (_NSIG_WORDS > 1) {
368                 err |= __copy_to_user(&frame->extramask, &set->sig[1],
369                                       sizeof(frame->extramask));
370         }
371         if (err)
372                 goto give_sigsegv;
373 
374         restorer = &__kernel_sigreturn;
375         if (ka->sa.sa_flags & SA_RESTORER)
376                 restorer = ka->sa.sa_restorer;
377 
378         /* Set up to return from userspace.  */
379         err |= __put_user(restorer, &frame->pretcode);
380          
381         /*
382          * This is popl %eax ; movl $,%eax ; int $0x80
383          *
384          * WE DO NOT USE IT ANY MORE! It's only left here for historical
385          * reasons and because gdb uses it as a signature to notice
386          * signal handler stack frames.
387          */
388         err |= __put_user(0xb858, (short *)(frame->retcode+0));
389         err |= __put_user(__NR_sigreturn, (int *)(frame->retcode+2));
390         err |= __put_user(0x80cd, (short *)(frame->retcode+6));
391 
392         if (err)
393                 goto give_sigsegv;
394 
395         /* Set up registers for signal handler */
396         regs->esp = (unsigned long) frame;
397         regs->eip = (unsigned long) ka->sa.sa_handler;
398 
399         set_fs(USER_DS);
400         regs->xds = __USER_DS;
401         regs->xes = __USER_DS;
402         regs->xss = __USER_DS;
403         regs->xcs = __USER_CS;
404         regs->eflags &= ~TF_MASK;
405 
406 #if DEBUG_SIG
407         printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
408                 current->comm, current->pid, frame, regs->eip, frame->pretcode);
409 #endif
410 
411         return;
412 
413 give_sigsegv:
414         if (sig == SIGSEGV)
415                 ka->sa.sa_handler = SIG_DFL;
416         force_sig(SIGSEGV, current);
417 }
418 
419 static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
420                            sigset_t *set, struct pt_regs * regs)
421 {
422         void *restorer;
423         struct rt_sigframe __user *frame;
424         int err = 0;
425 
426         frame = get_sigframe(ka, regs, sizeof(*frame));
427 
428         if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
429                 goto give_sigsegv;
430 
431         err |= __put_user((current_thread_info()->exec_domain
432                            && current_thread_info()->exec_domain->signal_invmap
433                            && sig < 32
434                            ? current_thread_info()->exec_domain->signal_invmap[sig]
435                            : sig),
436                           &frame->sig);
437         err |= __put_user(&frame->info, &frame->pinfo);
438         err |= __put_user(&frame->uc, &frame->puc);
439         err |= copy_siginfo_to_user(&frame->info, info);
440         if (err)
441                 goto give_sigsegv;
442 
443         /* Create the ucontext.  */
444         err |= __put_user(0, &frame->uc.uc_flags);
445         err |= __put_user(0, &frame->uc.uc_link);
446         err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
447         err |= __put_user(sas_ss_flags(regs->esp),
448                           &frame->uc.uc_stack.ss_flags);
449         err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
450         err |= setup_sigcontext(&frame->uc.uc_mcontext, &frame->fpstate,
451                                 regs, set->sig[0]);
452         err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
453         if (err)
454                 goto give_sigsegv;
455 
456         /* Set up to return from userspace.  */
457         restorer = &__kernel_rt_sigreturn;
458         if (ka->sa.sa_flags & SA_RESTORER)
459                 restorer = ka->sa.sa_restorer;
460         err |= __put_user(restorer, &frame->pretcode);
461          
462         /*
463          * This is movl $,%eax ; int $0x80
464          *
465          * WE DO NOT USE IT ANY MORE! It's only left here for historical
466          * reasons and because gdb uses it as a signature to notice
467          * signal handler stack frames.
468          */
469         err |= __put_user(0xb8, (char *)(frame->retcode+0));
470         err |= __put_user(__NR_rt_sigreturn, (int *)(frame->retcode+1));
471         err |= __put_user(0x80cd, (short *)(frame->retcode+5));
472 
473         if (err)
474                 goto give_sigsegv;
475 
476         /* Set up registers for signal handler */
477         regs->esp = (unsigned long) frame;
478         regs->eip = (unsigned long) ka->sa.sa_handler;
479 
480         set_fs(USER_DS);
481         regs->xds = __USER_DS;
482         regs->xes = __USER_DS;
483         regs->xss = __USER_DS;
484         regs->xcs = __USER_CS;
485         regs->eflags &= ~TF_MASK;
486 
487 #if DEBUG_SIG
488         printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
489                 current->comm, current->pid, frame, regs->eip, frame->pretcode);
490 #endif
491 
492         return;
493 
494 give_sigsegv:
495         if (sig == SIGSEGV)
496                 ka->sa.sa_handler = SIG_DFL;
497         force_sig(SIGSEGV, current);
498 }
499 
500 /*
501  * OK, we're invoking a handler
502  */     
503 
504 static void
505 handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
506         struct pt_regs * regs)
507 {
508         struct k_sigaction *ka = &current->sighand->action[sig-1];
509 
510         /* Are we from a system call? */
511         if (regs->orig_eax >= 0) {
512                 /* If so, check system call restarting.. */
513                 switch (regs->eax) {
514                         case -ERESTART_RESTARTBLOCK:
515                         case -ERESTARTNOHAND:
516                                 regs->eax = -EINTR;
517                                 break;
518 
519                         case -ERESTARTSYS:
520                                 if (!(ka->sa.sa_flags & SA_RESTART)) {
521                                         regs->eax = -EINTR;
522                                         break;
523                                 }
524                         /* fallthrough */
525                         case -ERESTARTNOINTR:
526                                 regs->eax = regs->orig_eax;
527                                 regs->eip -= 2;
528                 }
529         }
530 
531         /* Set up the stack frame */
532         if (ka->sa.sa_flags & SA_SIGINFO)
533                 setup_rt_frame(sig, ka, info, oldset, regs);
534         else
535                 setup_frame(sig, ka, oldset, regs);
536 
537         if (ka->sa.sa_flags & SA_ONESHOT)
538                 ka->sa.sa_handler = SIG_DFL;
539 
540         if (!(ka->sa.sa_flags & SA_NODEFER)) {
541                 spin_lock_irq(&current->sighand->siglock);
542                 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
543                 sigaddset(&current->blocked,sig);
544                 recalc_sigpending();
545                 spin_unlock_irq(&current->sighand->siglock);
546         }
547 }
548 
549 /*
550  * Note that 'init' is a special process: it doesn't get signals it doesn't
551  * want to handle. Thus you cannot kill init even with a SIGKILL even by
552  * mistake.
553  */
554 int do_signal(struct pt_regs *regs, sigset_t *oldset)
555 {
556         siginfo_t info;
557         int signr;
558 
559         /*
560          * We want the common case to go fast, which
561          * is why we may in certain cases get here from
562          * kernel mode. Just return without doing anything
563          * if so.
564          */
565         if ((regs->xcs & 3) != 3)
566                 return 1;
567 
568         if (current->flags & PF_FREEZE) {
569                 refrigerator(0);
570                 goto no_signal;
571         }
572 
573         if (!oldset)
574                 oldset = &current->blocked;
575 
576         signr = get_signal_to_deliver(&info, regs, NULL);
577         if (signr > 0) {
578                 /* Reenable any watchpoints before delivering the
579                  * signal to user space. The processor register will
580                  * have been cleared if the watchpoint triggered
581                  * inside the kernel.
582                  */
583                 __asm__("movl %0,%%db7" : : "r" (current->thread.debugreg[7]));
584 
585                 /* Whee!  Actually deliver the signal.  */
586                 handle_signal(signr, &info, oldset, regs);
587                 return 1;
588         }
589 
590  no_signal:
591         /* Did we come from a system call? */
592         if (regs->orig_eax >= 0) {
593                 /* Restart the system call - no handlers present */
594                 if (regs->eax == -ERESTARTNOHAND ||
595                     regs->eax == -ERESTARTSYS ||
596                     regs->eax == -ERESTARTNOINTR) {
597                         regs->eax = regs->orig_eax;
598                         regs->eip -= 2;
599                 }
600                 if (regs->eax == -ERESTART_RESTARTBLOCK){
601                         regs->eax = __NR_restart_syscall;
602                         regs->eip -= 2;
603                 }
604         }
605         return 0;
606 }
607 
608 /*
609  * notification of userspace execution resumption
610  * - triggered by current->work.notify_resume
611  */
612 __attribute__((regparm(3)))
613 void do_notify_resume(struct pt_regs *regs, sigset_t *oldset,
614                       __u32 thread_info_flags)
615 {
616         /* Pending single-step? */
617         if (thread_info_flags & _TIF_SINGLESTEP) {
618                 regs->eflags |= TF_MASK;
619                 clear_thread_flag(TIF_SINGLESTEP);
620         }
621         /* deal with pending signal delivery */
622         if (thread_info_flags & _TIF_SIGPENDING)
623                 do_signal(regs,oldset);
624         
625         clear_thread_flag(TIF_IRET);
626 }
627 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp