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

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

Version: ~ [ linux-5.15-rc1 ] ~ [ linux-5.14.5 ] ~ [ linux-5.13.18 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.66 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.147 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.206 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.246 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.282 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.283 ] ~ [ 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 /*  $Id: signal.c,v 1.110 2002/02/08 03:57:14 davem Exp $
  2  *  linux/arch/sparc/kernel/signal.c
  3  *
  4  *  Copyright (C) 1991, 1992  Linus Torvalds
  5  *  Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  6  *  Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
  7  *  Copyright (C) 1997 Eddie C. Dost   (ecd@skynet.be)
  8  */
  9 
 10 #include <linux/config.h>
 11 #include <linux/sched.h>
 12 #include <linux/kernel.h>
 13 #include <linux/signal.h>
 14 #include <linux/errno.h>
 15 #include <linux/wait.h>
 16 #include <linux/ptrace.h>
 17 #include <linux/unistd.h>
 18 #include <linux/mm.h>
 19 #include <linux/tty.h>
 20 #include <linux/smp.h>
 21 #include <linux/smp_lock.h>
 22 #include <linux/binfmts.h>      /* do_coredum */
 23 
 24 #include <asm/uaccess.h>
 25 #include <asm/bitops.h>
 26 #include <asm/ptrace.h>
 27 #include <asm/svr4.h>
 28 #include <asm/pgalloc.h>
 29 #include <asm/pgtable.h>
 30 #include <asm/cacheflush.h>     /* flush_sig_insns */
 31 
 32 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 33 
 34 extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
 35                    void *fpqueue, unsigned long *fpqdepth);
 36 extern void fpload(unsigned long *fpregs, unsigned long *fsr);
 37 
 38 asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
 39                          unsigned long orig_o0, int restart_syscall);
 40 
 41 /* Signal frames: the original one (compatible with SunOS):
 42  *
 43  * Set up a signal frame... Make the stack look the way SunOS
 44  * expects it to look which is basically:
 45  *
 46  * ---------------------------------- <-- %sp at signal time
 47  * Struct sigcontext
 48  * Signal address
 49  * Ptr to sigcontext area above
 50  * Signal code
 51  * The signal number itself
 52  * One register window
 53  * ---------------------------------- <-- New %sp
 54  */
 55 struct signal_sframe {
 56         struct reg_window       sig_window;
 57         int                     sig_num;
 58         int                     sig_code;
 59         struct sigcontext __user *sig_scptr;
 60         int                     sig_address;
 61         struct sigcontext       sig_context;
 62         unsigned int            extramask[_NSIG_WORDS - 1];
 63 };
 64 
 65 /* 
 66  * And the new one, intended to be used for Linux applications only
 67  * (we have enough in there to work with clone).
 68  * All the interesting bits are in the info field.
 69  */
 70 
 71 struct new_signal_frame {
 72         struct sparc_stackf     ss;
 73         __siginfo_t             info;
 74         __siginfo_fpu_t __user  *fpu_save;
 75         unsigned long           insns[2] __attribute__ ((aligned (8)));
 76         unsigned int            extramask[_NSIG_WORDS - 1];
 77         unsigned int            extra_size; /* Should be 0 */
 78         __siginfo_fpu_t         fpu_state;
 79 };
 80 
 81 struct rt_signal_frame {
 82         struct sparc_stackf     ss;
 83         siginfo_t               info;
 84         struct pt_regs          regs;
 85         sigset_t                mask;
 86         __siginfo_fpu_t __user  *fpu_save;
 87         unsigned int            insns[2];
 88         stack_t                 stack;
 89         unsigned int            extra_size; /* Should be 0 */
 90         __siginfo_fpu_t         fpu_state;
 91 };
 92 
 93 /* Align macros */
 94 #define SF_ALIGNEDSZ  (((sizeof(struct signal_sframe) + 7) & (~7)))
 95 #define NF_ALIGNEDSZ  (((sizeof(struct new_signal_frame) + 7) & (~7)))
 96 #define RT_ALIGNEDSZ  (((sizeof(struct rt_signal_frame) + 7) & (~7)))
 97 
 98 /*
 99  * atomically swap in the new signal mask, and wait for a signal.
100  * This is really tricky on the Sparc, watch out...
101  */
102 asmlinkage void _sigpause_common(old_sigset_t set, struct pt_regs *regs)
103 {
104         sigset_t saveset;
105 
106         set &= _BLOCKABLE;
107         spin_lock_irq(&current->sighand->siglock);
108         saveset = current->blocked;
109         siginitset(&current->blocked, set);
110         recalc_sigpending();
111         spin_unlock_irq(&current->sighand->siglock);
112 
113         regs->pc = regs->npc;
114         regs->npc += 4;
115 
116         /* Condition codes and return value where set here for sigpause,
117          * and so got used by setup_frame, which again causes sigreturn()
118          * to return -EINTR.
119          */
120         while (1) {
121                 current->state = TASK_INTERRUPTIBLE;
122                 schedule();
123                 /*
124                  * Return -EINTR and set condition code here,
125                  * so the interrupted system call actually returns
126                  * these.
127                  */
128                 regs->psr |= PSR_C;
129                 regs->u_regs[UREG_I0] = EINTR;
130                 if (do_signal(&saveset, regs, 0, 0))
131                         return;
132         }
133 }
134 
135 asmlinkage void do_sigpause(unsigned int set, struct pt_regs *regs)
136 {
137         _sigpause_common(set, regs);
138 }
139 
140 asmlinkage void do_sigsuspend (struct pt_regs *regs)
141 {
142         _sigpause_common(regs->u_regs[UREG_I0], regs);
143 }
144 
145 asmlinkage void do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize,
146                                  struct pt_regs *regs)
147 {
148         sigset_t oldset, set;
149 
150         /* XXX: Don't preclude handling different sized sigset_t's.  */
151         if (sigsetsize != sizeof(sigset_t)) {
152                 regs->psr |= PSR_C;
153                 regs->u_regs[UREG_I0] = EINVAL;
154                 return;
155         }
156 
157         if (copy_from_user(&set, uset, sizeof(set))) {
158                 regs->psr |= PSR_C;
159                 regs->u_regs[UREG_I0] = EFAULT;
160                 return;
161         }
162 
163         sigdelsetmask(&set, ~_BLOCKABLE);
164         spin_lock_irq(&current->sighand->siglock);
165         oldset = current->blocked;
166         current->blocked = set;
167         recalc_sigpending();
168         spin_unlock_irq(&current->sighand->siglock);
169 
170         regs->pc = regs->npc;
171         regs->npc += 4;
172 
173         /* Condition codes and return value where set here for sigpause,
174          * and so got used by setup_frame, which again causes sigreturn()
175          * to return -EINTR.
176          */
177         while (1) {
178                 current->state = TASK_INTERRUPTIBLE;
179                 schedule();
180                 /*
181                  * Return -EINTR and set condition code here,
182                  * so the interrupted system call actually returns
183                  * these.
184                  */
185                 regs->psr |= PSR_C;
186                 regs->u_regs[UREG_I0] = EINTR;
187                 if (do_signal(&oldset, regs, 0, 0))
188                         return;
189         }
190 }
191 
192 static inline int
193 restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
194 {
195         int err;
196 #ifdef CONFIG_SMP
197         if (test_tsk_thread_flag(current, TIF_USEDFPU))
198                 regs->psr &= ~PSR_EF;
199 #else
200         if (current == last_task_used_math) {
201                 last_task_used_math = 0;
202                 regs->psr &= ~PSR_EF;
203         }
204 #endif
205         current->used_math = 1;
206         clear_tsk_thread_flag(current, TIF_USEDFPU);
207 
208         if (verify_area(VERIFY_READ, fpu, sizeof(*fpu)))
209                 return -EFAULT;
210 
211         err = __copy_from_user(&current->thread.float_regs[0], &fpu->si_float_regs[0],
212                                (sizeof(unsigned long) * 32));
213         err |= __get_user(current->thread.fsr, &fpu->si_fsr);
214         err |= __get_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
215         if (current->thread.fpqdepth != 0)
216                 err |= __copy_from_user(&current->thread.fpqueue[0],
217                                         &fpu->si_fpqueue[0],
218                                         ((sizeof(unsigned long) +
219                                         (sizeof(unsigned long *)))*16));
220         return err;
221 }
222 
223 static inline void do_new_sigreturn (struct pt_regs *regs)
224 {
225         struct new_signal_frame __user *sf;
226         unsigned long up_psr, pc, npc;
227         sigset_t set;
228         __siginfo_fpu_t __user *fpu_save;
229         int err;
230 
231         sf = (struct new_signal_frame __user *) regs->u_regs[UREG_FP];
232 
233         /* 1. Make sure we are not getting garbage from the user */
234         if (verify_area(VERIFY_READ, sf, sizeof(*sf)))
235                 goto segv_and_exit;
236 
237         if (((uint) sf) & 3)
238                 goto segv_and_exit;
239 
240         err = __get_user(pc,  &sf->info.si_regs.pc);
241         err |= __get_user(npc, &sf->info.si_regs.npc);
242 
243         if ((pc | npc) & 3)
244                 goto segv_and_exit;
245 
246         /* 2. Restore the state */
247         up_psr = regs->psr;
248         err |= __copy_from_user(regs, &sf->info.si_regs, sizeof(struct pt_regs));
249 
250         /* User can only change condition codes and FPU enabling in %psr. */
251         regs->psr = (up_psr & ~(PSR_ICC | PSR_EF))
252                   | (regs->psr & (PSR_ICC | PSR_EF));
253 
254         err |= __get_user(fpu_save, &sf->fpu_save);
255 
256         if (fpu_save)
257                 err |= restore_fpu_state(regs, fpu_save);
258 
259         /* This is pretty much atomic, no amount locking would prevent
260          * the races which exist anyways.
261          */
262         err |= __get_user(set.sig[0], &sf->info.si_mask);
263         err |= __copy_from_user(&set.sig[1], &sf->extramask,
264                                 (_NSIG_WORDS-1) * sizeof(unsigned int));
265                            
266         if (err)
267                 goto segv_and_exit;
268 
269         sigdelsetmask(&set, ~_BLOCKABLE);
270         spin_lock_irq(&current->sighand->siglock);
271         current->blocked = set;
272         recalc_sigpending();
273         spin_unlock_irq(&current->sighand->siglock);
274         return;
275 
276 segv_and_exit:
277         do_exit(SIGSEGV);
278 }
279 
280 asmlinkage void do_sigreturn(struct pt_regs *regs)
281 {
282         struct sigcontext __user *scptr;
283         unsigned long pc, npc, psr;
284         sigset_t set;
285         int err;
286 
287         /* Always make any pending restarted system calls return -EINTR */
288         current_thread_info()->restart_block.fn = do_no_restart_syscall;
289 
290         synchronize_user_stack();
291 
292         if (current->thread.new_signal)
293                 return do_new_sigreturn(regs);
294 
295         scptr = (struct sigcontext __user *) regs->u_regs[UREG_I0];
296 
297         /* Check sanity of the user arg. */
298         if (verify_area(VERIFY_READ, scptr, sizeof(struct sigcontext)) ||
299             (((unsigned long) scptr) & 3))
300                 goto segv_and_exit;
301 
302         err = __get_user(pc, &scptr->sigc_pc);
303         err |= __get_user(npc, &scptr->sigc_npc);
304 
305         if ((pc | npc) & 3)
306                 goto segv_and_exit;
307 
308         /* This is pretty much atomic, no amount locking would prevent
309          * the races which exist anyways.
310          */
311         err |= __get_user(set.sig[0], &scptr->sigc_mask);
312         /* Note that scptr + 1 points to extramask */
313         err |= __copy_from_user(&set.sig[1], scptr + 1,
314                                 (_NSIG_WORDS - 1) * sizeof(unsigned int));
315         
316         if (err)
317                 goto segv_and_exit;
318 
319         sigdelsetmask(&set, ~_BLOCKABLE);
320         spin_lock_irq(&current->sighand->siglock);
321         current->blocked = set;
322         recalc_sigpending();
323         spin_unlock_irq(&current->sighand->siglock);
324 
325         regs->pc = pc;
326         regs->npc = npc;
327 
328         err = __get_user(regs->u_regs[UREG_FP], &scptr->sigc_sp);
329         err |= __get_user(regs->u_regs[UREG_I0], &scptr->sigc_o0);
330         err |= __get_user(regs->u_regs[UREG_G1], &scptr->sigc_g1);
331 
332         /* User can only change condition codes in %psr. */
333         err |= __get_user(psr, &scptr->sigc_psr);
334         if (err)
335                 goto segv_and_exit;
336                 
337         regs->psr &= ~(PSR_ICC);
338         regs->psr |= (psr & PSR_ICC);
339         return;
340 
341 segv_and_exit:
342         send_sig(SIGSEGV, current, 1);
343 }
344 
345 asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
346 {
347         struct rt_signal_frame __user *sf;
348         unsigned int psr, pc, npc;
349         __siginfo_fpu_t __user *fpu_save;
350         sigset_t set;
351         stack_t st;
352         int err;
353 
354         synchronize_user_stack();
355         sf = (struct rt_signal_frame __user *) regs->u_regs[UREG_FP];
356         if (verify_area(VERIFY_READ, sf, sizeof(*sf)) ||
357             (((unsigned long) sf) & 0x03))
358                 goto segv;
359 
360         err = __get_user(pc, &sf->regs.pc);
361         err |= __get_user(npc, &sf->regs.npc);
362         err |= ((pc | npc) & 0x03);
363 
364         err |= __get_user(regs->y, &sf->regs.y);
365         err |= __get_user(psr, &sf->regs.psr);
366 
367         err |= __copy_from_user(&regs->u_regs[UREG_G1],
368                                 &sf->regs.u_regs[UREG_G1], 15 * sizeof(u32));
369 
370         regs->psr = (regs->psr & ~PSR_ICC) | (psr & PSR_ICC);
371 
372         err |= __get_user(fpu_save, &sf->fpu_save);
373 
374         if (fpu_save)
375                 err |= restore_fpu_state(regs, fpu_save);
376         err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t));
377         
378         err |= __copy_from_user(&st, &sf->stack, sizeof(stack_t));
379         
380         if (err)
381                 goto segv;
382                 
383         regs->pc = pc;
384         regs->npc = npc;
385         
386         /* It is more difficult to avoid calling this function than to
387          * call it and ignore errors.
388          */
389         do_sigaltstack(&st, NULL, (unsigned long)sf);
390 
391         sigdelsetmask(&set, ~_BLOCKABLE);
392         spin_lock_irq(&current->sighand->siglock);
393         current->blocked = set;
394         recalc_sigpending();
395         spin_unlock_irq(&current->sighand->siglock);
396         return;
397 segv:
398         send_sig(SIGSEGV, current, 1);
399 }
400 
401 /* Checks if the fp is valid */
402 static inline int invalid_frame_pointer(void __user *fp, int fplen)
403 {
404         if ((((unsigned long) fp) & 7) ||
405             !__access_ok((unsigned long)fp, fplen) ||
406             ((sparc_cpu_model == sun4 || sparc_cpu_model == sun4c) &&
407              ((unsigned long) fp < 0xe0000000 && (unsigned long) fp >= 0x20000000)))
408                 return 1;
409         
410         return 0;
411 }
412 
413 static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, unsigned long framesize)
414 {
415         unsigned long sp;
416 
417         sp = regs->u_regs[UREG_FP];
418 
419         /* This is the X/Open sanctioned signal stack switching.  */
420         if (sa->sa_flags & SA_ONSTACK) {
421                 if (!on_sig_stack(sp) && !((current->sas_ss_sp + current->sas_ss_size) & 7))
422                         sp = current->sas_ss_sp + current->sas_ss_size;
423         }
424         return (void __user *)(sp - framesize);
425 }
426 
427 static inline void
428 setup_frame(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *oldset, siginfo_t *info)
429 {
430         struct signal_sframe __user *sframep;
431         struct sigcontext __user *sc;
432         int window = 0, err;
433         unsigned long pc = regs->pc;
434         unsigned long npc = regs->npc;
435         void *sig_address;
436         int sig_code;
437 
438         synchronize_user_stack();
439         sframep = (struct signal_sframe __user *)
440                 get_sigframe(sa, regs, SF_ALIGNEDSZ);
441         if (invalid_frame_pointer(sframep, sizeof(*sframep))){
442                 /* Don't change signal code and address, so that
443                  * post mortem debuggers can have a look.
444                  */
445                 goto sigill_and_return;
446         }
447 
448         sc = &sframep->sig_context;
449 
450         /* We've already made sure frame pointer isn't in kernel space... */
451         err  = __put_user((sas_ss_flags(regs->u_regs[UREG_FP]) == SS_ONSTACK),
452                          &sc->sigc_onstack);
453         err |= __put_user(oldset->sig[0], &sc->sigc_mask);
454         err |= __copy_to_user(sframep->extramask, &oldset->sig[1],
455                               (_NSIG_WORDS - 1) * sizeof(unsigned int));
456         err |= __put_user(regs->u_regs[UREG_FP], &sc->sigc_sp);
457         err |= __put_user(pc, &sc->sigc_pc);
458         err |= __put_user(npc, &sc->sigc_npc);
459         err |= __put_user(regs->psr, &sc->sigc_psr);
460         err |= __put_user(regs->u_regs[UREG_G1], &sc->sigc_g1);
461         err |= __put_user(regs->u_regs[UREG_I0], &sc->sigc_o0);
462         err |= __put_user(current->thread.w_saved, &sc->sigc_oswins);
463         if (current->thread.w_saved)
464                 for (window = 0; window < current->thread.w_saved; window++) {
465                         put_user((char *)current->thread.rwbuf_stkptrs[window],
466                                  &sc->sigc_spbuf[window]);
467                         err |= __copy_to_user(&sc->sigc_wbuf[window],
468                                               &current->thread.reg_window[window],
469                                               sizeof(struct reg_window));
470                 }
471         else
472                 err |= __copy_to_user(sframep, (char *) regs->u_regs[UREG_FP],
473                                       sizeof(struct reg_window));
474 
475         current->thread.w_saved = 0; /* So process is allowed to execute. */
476 
477         err |= __put_user(signr, &sframep->sig_num);
478         sig_address = NULL;
479         sig_code = 0;
480         if (SI_FROMKERNEL (info) && (info->si_code & __SI_MASK) == __SI_FAULT) {
481                 sig_address = info->si_addr;
482                 switch (signr) {
483                 case SIGSEGV:
484                         switch (info->si_code) {
485                         case SEGV_MAPERR: sig_code = SUBSIG_NOMAPPING; break;
486                         default: sig_code = SUBSIG_PROTECTION; break;
487                         }
488                         break;
489                 case SIGILL:
490                         switch (info->si_code) {
491                         case ILL_ILLOPC: sig_code = SUBSIG_ILLINST; break;
492                         case ILL_PRVOPC: sig_code = SUBSIG_PRIVINST; break;
493                         case ILL_ILLTRP: sig_code = SUBSIG_BADTRAP(info->si_trapno); break;
494                         default: sig_code = SUBSIG_STACK; break;
495                         }
496                         break;
497                 case SIGFPE:
498                         switch (info->si_code) {
499                         case FPE_INTDIV: sig_code = SUBSIG_IDIVZERO; break;
500                         case FPE_INTOVF: sig_code = SUBSIG_FPINTOVFL; break;
501                         case FPE_FLTDIV: sig_code = SUBSIG_FPDIVZERO; break;
502                         case FPE_FLTOVF: sig_code = SUBSIG_FPOVFLOW; break;
503                         case FPE_FLTUND: sig_code = SUBSIG_FPUNFLOW; break;
504                         case FPE_FLTRES: sig_code = SUBSIG_FPINEXACT; break;
505                         case FPE_FLTINV: sig_code = SUBSIG_FPOPERROR; break;
506                         default: sig_code = SUBSIG_FPERROR; break;
507                         }
508                         break;
509                 case SIGBUS:
510                         switch (info->si_code) {
511                         case BUS_ADRALN: sig_code = SUBSIG_ALIGNMENT; break;
512                         case BUS_ADRERR: sig_code = SUBSIG_MISCERROR; break;
513                         default: sig_code = SUBSIG_BUSTIMEOUT; break;
514                         }
515                         break;
516                 case SIGEMT:
517                         switch (info->si_code) {
518                         case EMT_TAGOVF: sig_code = SUBSIG_TAG; break;
519                         }
520                         break;
521                 case SIGSYS:
522                         if (info->si_code == (__SI_FAULT|0x100)) {
523                                 /* See sys_sunos.c */
524                                 sig_code = info->si_trapno;
525                                 break;
526                         }
527                 default:
528                         sig_address = NULL;
529                 }
530         }
531         err |= __put_user((long)sig_address, &sframep->sig_address);
532         err |= __put_user(sig_code, &sframep->sig_code);
533         err |= __put_user(sc, &sframep->sig_scptr);
534         if (err)
535                 goto sigsegv;
536 
537         regs->u_regs[UREG_FP] = (unsigned long) sframep;
538         regs->pc = (unsigned long) sa->sa_handler;
539         regs->npc = (regs->pc + 4);
540         return;
541 
542 sigill_and_return:
543         do_exit(SIGILL);
544 sigsegv:
545         do_exit(SIGSEGV);
546 }
547 
548 
549 static inline int
550 save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
551 {
552         int err = 0;
553 #ifdef CONFIG_SMP
554         if (test_tsk_thread_flag(current, TIF_USEDFPU)) {
555                 put_psr(get_psr() | PSR_EF);
556                 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
557                        &current->thread.fpqueue[0], &current->thread.fpqdepth);
558                 regs->psr &= ~(PSR_EF);
559                 clear_tsk_thread_flag(current, TIF_USEDFPU);
560         }
561 #else
562         if (current == last_task_used_math) {
563                 put_psr(get_psr() | PSR_EF);
564                 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
565                        &current->thread.fpqueue[0], &current->thread.fpqdepth);
566                 last_task_used_math = 0;
567                 regs->psr &= ~(PSR_EF);
568         }
569 #endif
570         err |= __copy_to_user(&fpu->si_float_regs[0],
571                               &current->thread.float_regs[0],
572                               (sizeof(unsigned long) * 32));
573         err |= __put_user(current->thread.fsr, &fpu->si_fsr);
574         err |= __put_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
575         if (current->thread.fpqdepth != 0)
576                 err |= __copy_to_user(&fpu->si_fpqueue[0],
577                                       &current->thread.fpqueue[0],
578                                       ((sizeof(unsigned long) +
579                                       (sizeof(unsigned long *)))*16));
580         current->used_math = 0;
581         return err;
582 }
583 
584 static inline void
585 new_setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
586                 int signo, sigset_t *oldset)
587 {
588         struct new_signal_frame __user *sf;
589         int sigframe_size, err;
590 
591         /* 1. Make sure everything is clean */
592         synchronize_user_stack();
593 
594         sigframe_size = NF_ALIGNEDSZ;
595         if (!current->used_math)
596                 sigframe_size -= sizeof(__siginfo_fpu_t);
597 
598         sf = (struct new_signal_frame __user *)
599                 get_sigframe(&ka->sa, regs, sigframe_size);
600 
601         if (invalid_frame_pointer(sf, sigframe_size))
602                 goto sigill_and_return;
603 
604         if (current->thread.w_saved != 0)
605                 goto sigill_and_return;
606 
607         /* 2. Save the current process state */
608         err = __copy_to_user(&sf->info.si_regs, regs, sizeof(struct pt_regs));
609         
610         err |= __put_user(0, &sf->extra_size);
611 
612         if (current->used_math) {
613                 err |= save_fpu_state(regs, &sf->fpu_state);
614                 err |= __put_user(&sf->fpu_state, &sf->fpu_save);
615         } else {
616                 err |= __put_user(0, &sf->fpu_save);
617         }
618 
619         err |= __put_user(oldset->sig[0], &sf->info.si_mask);
620         err |= __copy_to_user(sf->extramask, &oldset->sig[1],
621                               (_NSIG_WORDS - 1) * sizeof(unsigned int));
622         err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
623                               sizeof(struct reg_window));
624         if (err)
625                 goto sigsegv;
626         
627         /* 3. signal handler back-trampoline and parameters */
628         regs->u_regs[UREG_FP] = (unsigned long) sf;
629         regs->u_regs[UREG_I0] = signo;
630         regs->u_regs[UREG_I1] = (unsigned long) &sf->info;
631 
632         /* 4. signal handler */
633         regs->pc = (unsigned long) ka->sa.sa_handler;
634         regs->npc = (regs->pc + 4);
635 
636         /* 5. return to kernel instructions */
637         if (ka->ka_restorer)
638                 regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer;
639         else {
640                 regs->u_regs[UREG_I7] = (unsigned long)(&(sf->insns[0]) - 2);
641 
642                 /* mov __NR_sigreturn, %g1 */
643                 err |= __put_user(0x821020d8, &sf->insns[0]);
644 
645                 /* t 0x10 */
646                 err |= __put_user(0x91d02010, &sf->insns[1]);
647                 if (err)
648                         goto sigsegv;
649 
650                 /* Flush instruction space. */
651                 flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0]));
652         }
653         return;
654 
655 sigill_and_return:
656         do_exit(SIGILL);
657 sigsegv:
658         do_exit(SIGSEGV);
659 }
660 
661 static inline void
662 new_setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
663                    int signo, sigset_t *oldset, siginfo_t *info)
664 {
665         struct rt_signal_frame __user *sf;
666         int sigframe_size;
667         unsigned int psr;
668         int err;
669 
670         synchronize_user_stack();
671         sigframe_size = RT_ALIGNEDSZ;
672         if (!current->used_math)
673                 sigframe_size -= sizeof(__siginfo_fpu_t);
674         sf = (struct rt_signal_frame __user *)
675                 get_sigframe(&ka->sa, regs, sigframe_size);
676         if (invalid_frame_pointer(sf, sigframe_size))
677                 goto sigill;
678         if (current->thread.w_saved != 0)
679                 goto sigill;
680 
681         err  = __put_user(regs->pc, &sf->regs.pc);
682         err |= __put_user(regs->npc, &sf->regs.npc);
683         err |= __put_user(regs->y, &sf->regs.y);
684         psr = regs->psr;
685         if (current->used_math)
686                 psr |= PSR_EF;
687         err |= __put_user(psr, &sf->regs.psr);
688         err |= __copy_to_user(&sf->regs.u_regs, regs->u_regs, sizeof(regs->u_regs));
689         err |= __put_user(0, &sf->extra_size);
690 
691         if (psr & PSR_EF) {
692                 err |= save_fpu_state(regs, &sf->fpu_state);
693                 err |= __put_user(&sf->fpu_state, &sf->fpu_save);
694         } else {
695                 err |= __put_user(0, &sf->fpu_save);
696         }
697         err |= __copy_to_user(&sf->mask, &oldset->sig[0], sizeof(sigset_t));
698         
699         /* Setup sigaltstack */
700         err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp);
701         err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags);
702         err |= __put_user(current->sas_ss_size, &sf->stack.ss_size);
703         
704         err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
705                               sizeof(struct reg_window));       
706 
707         err |= copy_siginfo_to_user(&sf->info, info);
708 
709         if (err)
710                 goto sigsegv;
711 
712         regs->u_regs[UREG_FP] = (unsigned long) sf;
713         regs->u_regs[UREG_I0] = signo;
714         regs->u_regs[UREG_I1] = (unsigned long) &sf->info;
715 
716         regs->pc = (unsigned long) ka->sa.sa_handler;
717         regs->npc = (regs->pc + 4);
718 
719         if (ka->ka_restorer)
720                 regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer;
721         else {
722                 regs->u_regs[UREG_I7] = (unsigned long)(&(sf->insns[0]) - 2);
723 
724                 /* mov __NR_sigreturn, %g1 */
725                 err |= __put_user(0x821020d8, &sf->insns[0]);
726 
727                 /* t 0x10 */
728                 err |= __put_user(0x91d02010, &sf->insns[1]);
729                 if (err)
730                         goto sigsegv;
731 
732                 /* Flush instruction space. */
733                 flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0]));
734         }
735         return;
736 
737 sigill:
738         do_exit(SIGILL);
739 sigsegv:
740         do_exit(SIGSEGV);
741 }
742 
743 /* Setup a Solaris stack frame */
744 static inline void
745 setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc,
746                  struct pt_regs *regs, int signr, sigset_t *oldset)
747 {
748         svr4_signal_frame_t __user *sfp;
749         svr4_gregset_t  __user *gr;
750         svr4_siginfo_t  __user *si;
751         svr4_mcontext_t __user *mc;
752         svr4_gwindows_t __user *gw;
753         svr4_ucontext_t __user *uc;
754         svr4_sigset_t   setv;
755         int window = 0, err;
756 
757         synchronize_user_stack();
758         sfp = (svr4_signal_frame_t __user *)
759                 get_sigframe(sa, regs, SVR4_SF_ALIGNED + sizeof(struct reg_window));
760 
761         if (invalid_frame_pointer(sfp, sizeof(*sfp)))
762                 goto sigill_and_return;
763 
764         /* Start with a clean frame pointer and fill it */
765         err = __clear_user(sfp, sizeof(*sfp));
766 
767         /* Setup convenience variables */
768         si = &sfp->si;
769         uc = &sfp->uc;
770         gw = &sfp->gw;
771         mc = &uc->mcontext;
772         gr = &mc->greg;
773         
774         /* FIXME: where am I supposed to put this?
775          * sc->sigc_onstack = old_status;
776          * anyways, it does not look like it is used for anything at all.
777          */
778         setv.sigbits[0] = oldset->sig[0];
779         setv.sigbits[1] = oldset->sig[1];
780         if (_NSIG_WORDS >= 4) {
781                 setv.sigbits[2] = oldset->sig[2];
782                 setv.sigbits[3] = oldset->sig[3];
783                 err |= __copy_to_user(&uc->sigmask, &setv, sizeof(svr4_sigset_t));
784         } else
785                 err |= __copy_to_user(&uc->sigmask, &setv,
786                                       2 * sizeof(unsigned int));
787 
788         /* Store registers */
789         err |= __put_user(regs->pc, &((*gr)[SVR4_PC]));
790         err |= __put_user(regs->npc, &((*gr)[SVR4_NPC]));
791         err |= __put_user(regs->psr, &((*gr)[SVR4_PSR]));
792         err |= __put_user(regs->y, &((*gr)[SVR4_Y]));
793         
794         /* Copy g[1..7] and o[0..7] registers */
795         err |= __copy_to_user(&(*gr)[SVR4_G1], &regs->u_regs[UREG_G1],
796                               sizeof(long) * 7);
797         err |= __copy_to_user(&(*gr)[SVR4_O0], &regs->u_regs[UREG_I0],
798                               sizeof(long) * 8);
799 
800         /* Setup sigaltstack */
801         err |= __put_user(current->sas_ss_sp, &uc->stack.sp);
802         err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &uc->stack.flags);
803         err |= __put_user(current->sas_ss_size, &uc->stack.size);
804 
805         /* Save the currently window file: */
806 
807         /* 1. Link sfp->uc->gwins to our windows */
808         err |= __put_user(gw, &mc->gwin);
809             
810         /* 2. Number of windows to restore at setcontext(): */
811         err |= __put_user(current->thread.w_saved, &gw->count);
812 
813         /* 3. Save each valid window
814          *    Currently, it makes a copy of the windows from the kernel copy.
815          *    David's code for SunOS, makes the copy but keeps the pointer to
816          *    the kernel.  My version makes the pointer point to a userland 
817          *    copy of those.  Mhm, I wonder if I shouldn't just ignore those
818          *    on setcontext and use those that are on the kernel, the signal
819          *    handler should not be modyfing those, mhm.
820          *
821          *    These windows are just used in case synchronize_user_stack failed
822          *    to flush the user windows.
823          */
824         for (window = 0; window < current->thread.w_saved; window++) {
825                 err |= __put_user((int *) &(gw->win[window]), &gw->winptr[window]);
826                 err |= __copy_to_user(&gw->win[window],
827                                       &current->thread.reg_window[window],
828                                       sizeof(svr4_rwindow_t));
829                 err |= __put_user(0, gw->winptr[window]);
830         }
831 
832         /* 4. We just pay attention to the gw->count field on setcontext */
833         current->thread.w_saved = 0; /* So process is allowed to execute. */
834 
835         /* Setup the signal information.  Solaris expects a bunch of
836          * information to be passed to the signal handler, we don't provide
837          * that much currently, should use siginfo.
838          */
839         err |= __put_user(signr, &si->siginfo.signo);
840         err |= __put_user(SVR4_SINOINFO, &si->siginfo.code);
841         if (err)
842                 goto sigsegv;
843 
844         regs->u_regs[UREG_FP] = (unsigned long) sfp;
845         regs->pc = (unsigned long) sa->sa_handler;
846         regs->npc = (regs->pc + 4);
847 
848         /* Arguments passed to signal handler */
849         if (regs->u_regs[14]){
850                 struct reg_window *rw = (struct reg_window __user *)
851                         regs->u_regs[14];
852 
853                 err |= __put_user(signr, &rw->ins[0]);
854                 err |= __put_user(si, &rw->ins[1]);
855                 err |= __put_user(uc, &rw->ins[2]);
856                 err |= __put_user(sfp, &rw->ins[6]);    /* frame pointer */
857                 if (err)
858                         goto sigsegv;
859 
860                 regs->u_regs[UREG_I0] = signr;
861                 regs->u_regs[UREG_I1] = (uint) si;
862                 regs->u_regs[UREG_I2] = (uint) uc;
863         }
864         return;
865 
866 sigill_and_return:
867         do_exit(SIGILL);
868 sigsegv:
869         do_exit(SIGSEGV);
870 }
871 
872 asmlinkage int svr4_getcontext(svr4_ucontext_t __user *uc, struct pt_regs *regs)
873 {
874         svr4_gregset_t  __user *gr;
875         svr4_mcontext_t __user *mc;
876         svr4_sigset_t   setv;
877         int err = 0;
878 
879         synchronize_user_stack();
880 
881         if (current->thread.w_saved)
882                 goto sigsegv_and_return;
883 
884         err = clear_user(uc, sizeof(*uc));
885         if (err)
886                 return -EFAULT;
887 
888         /* Setup convenience variables */
889         mc = &uc->mcontext;
890         gr = &mc->greg;
891 
892         setv.sigbits[0] = current->blocked.sig[0];
893         setv.sigbits[1] = current->blocked.sig[1];
894         if (_NSIG_WORDS >= 4) {
895                 setv.sigbits[2] = current->blocked.sig[2];
896                 setv.sigbits[3] = current->blocked.sig[3];
897                 err |= __copy_to_user(&uc->sigmask, &setv, sizeof(svr4_sigset_t));
898         } else
899                 err |= __copy_to_user(&uc->sigmask, &setv,
900                                       2 * sizeof(unsigned int));
901 
902         /* Store registers */
903         err |= __put_user(regs->pc, &uc->mcontext.greg[SVR4_PC]);
904         err |= __put_user(regs->npc, &uc->mcontext.greg[SVR4_NPC]);
905         err |= __put_user(regs->psr, &uc->mcontext.greg[SVR4_PSR]);
906         err |= __put_user(regs->y, &uc->mcontext.greg[SVR4_Y]);
907         
908         /* Copy g[1..7] and o[0..7] registers */
909         err |= __copy_to_user(&(*gr)[SVR4_G1], &regs->u_regs[UREG_G1],
910                               sizeof(uint) * 7);
911         err |= __copy_to_user(&(*gr)[SVR4_O0], &regs->u_regs[UREG_I0],
912                               sizeof(uint) * 8);
913 
914         /* Setup sigaltstack */
915         err |= __put_user(current->sas_ss_sp, &uc->stack.sp);
916         err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &uc->stack.flags);
917         err |= __put_user(current->sas_ss_size, &uc->stack.size);
918 
919         /* The register file is not saved
920          * we have already stuffed all of it with sync_user_stack
921          */
922         return (err ? -EFAULT : 0);
923 
924 sigsegv_and_return:
925         do_exit(SIGSEGV);
926 }
927 
928 /* Set the context for a svr4 application, this is Solaris way to sigreturn */
929 asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs)
930 {
931         struct thread_struct *tp = &current->thread;
932         svr4_gregset_t  __user *gr;
933         unsigned long pc, npc, psr;
934         sigset_t set;
935         svr4_sigset_t setv;
936         int err;
937         stack_t st;
938         
939         /* Fixme: restore windows, or is this already taken care of in
940          * svr4_setup_frame when sync_user_windows is done?
941          */
942         flush_user_windows();
943         
944         if (tp->w_saved)
945                 goto sigsegv_and_return;
946 
947         if (((uint) c) & 3)
948                 goto sigsegv_and_return;
949 
950         if (!__access_ok((unsigned long)c, sizeof(*c)))
951                 goto sigsegv_and_return;
952 
953         /* Check for valid PC and nPC */
954         gr = &c->mcontext.greg;
955         err = __get_user(pc, &((*gr)[SVR4_PC]));
956         err |= __get_user(npc, &((*gr)[SVR4_NPC]));
957 
958         if ((pc | npc) & 3)
959                 goto sigsegv_and_return;
960 
961         /* Retrieve information from passed ucontext */
962         /* note that nPC is ored a 1, this is used to inform entry.S */
963         /* that we don't want it to mess with our PC and nPC */
964 
965         /* This is pretty much atomic, no amount locking would prevent
966          * the races which exist anyways.
967          */
968         err |= __copy_from_user(&setv, &c->sigmask, sizeof(svr4_sigset_t));
969         
970         err |= __get_user(st.ss_sp, &c->stack.sp);
971         err |= __get_user(st.ss_flags, &c->stack.flags);
972         err |= __get_user(st.ss_size, &c->stack.size);
973         
974         if (err)
975                 goto sigsegv_and_return;
976                 
977         /* It is more difficult to avoid calling this function than to
978            call it and ignore errors.  */
979         do_sigaltstack(&st, NULL, regs->u_regs[UREG_I6]);
980         
981         set.sig[0] = setv.sigbits[0];
982         set.sig[1] = setv.sigbits[1];
983         if (_NSIG_WORDS >= 4) {
984                 set.sig[2] = setv.sigbits[2];
985                 set.sig[3] = setv.sigbits[3];
986         }
987         sigdelsetmask(&set, ~_BLOCKABLE);
988         spin_lock_irq(&current->sighand->siglock);
989         current->blocked = set;
990         recalc_sigpending();
991         spin_unlock_irq(&current->sighand->siglock);
992         regs->pc = pc;
993         regs->npc = npc | 1;
994         err |= __get_user(regs->y, &((*gr)[SVR4_Y]));
995         err |= __get_user(psr, &((*gr)[SVR4_PSR]));
996         regs->psr &= ~(PSR_ICC);
997         regs->psr |= (psr & PSR_ICC);
998 
999         /* Restore g[1..7] and o[0..7] registers */
1000         err |= __copy_from_user(&regs->u_regs[UREG_G1], &(*gr)[SVR4_G1],
1001                               sizeof(long) * 7);
1002         err |= __copy_from_user(&regs->u_regs[UREG_I0], &(*gr)[SVR4_O0],
1003                               sizeof(long) * 8);
1004         return (err ? -EFAULT : 0);
1005 
1006 sigsegv_and_return:
1007         do_exit(SIGSEGV);
1008 }
1009 
1010 static inline void
1011 handle_signal(unsigned long signr, struct k_sigaction *ka,
1012               siginfo_t *info, sigset_t *oldset, struct pt_regs *regs,
1013               int svr4_signal)
1014 {
1015         if (svr4_signal)
1016                 setup_svr4_frame(&ka->sa, regs->pc, regs->npc, regs, signr, oldset);
1017         else {
1018                 if (ka->sa.sa_flags & SA_SIGINFO)
1019                         new_setup_rt_frame(ka, regs, signr, oldset, info);
1020                 else if (current->thread.new_signal)
1021                         new_setup_frame(ka, regs, signr, oldset);
1022                 else
1023                         setup_frame(&ka->sa, regs, signr, oldset, info);
1024         }
1025         if (ka->sa.sa_flags & SA_ONESHOT)
1026                 ka->sa.sa_handler = SIG_DFL;
1027         if (!(ka->sa.sa_flags & SA_NOMASK)) {
1028                 spin_lock_irq(&current->sighand->siglock);
1029                 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
1030                 sigaddset(&current->blocked, signr);
1031                 recalc_sigpending();
1032                 spin_unlock_irq(&current->sighand->siglock);
1033         }
1034 }
1035 
1036 static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
1037                                    struct sigaction *sa)
1038 {
1039         switch(regs->u_regs[UREG_I0]) {
1040         case ERESTART_RESTARTBLOCK:
1041         case ERESTARTNOHAND:
1042         no_system_call_restart:
1043                 regs->u_regs[UREG_I0] = EINTR;
1044                 regs->psr |= PSR_C;
1045                 break;
1046         case ERESTARTSYS:
1047                 if (!(sa->sa_flags & SA_RESTART))
1048                         goto no_system_call_restart;
1049                 /* fallthrough */
1050         case ERESTARTNOINTR:
1051                 regs->u_regs[UREG_I0] = orig_i0;
1052                 regs->pc -= 4;
1053                 regs->npc -= 4;
1054         }
1055 }
1056 
1057 /* Note that 'init' is a special process: it doesn't get signals it doesn't
1058  * want to handle. Thus you cannot kill init even with a SIGKILL even by
1059  * mistake.
1060  */
1061 asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
1062                          unsigned long orig_i0, int restart_syscall)
1063 {
1064         siginfo_t info;
1065         struct sparc_deliver_cookie cookie;
1066         int signr;
1067 
1068         /*
1069          * XXX Disable svr4 signal handling until solaris emulation works.
1070          * It is buggy - Anton
1071          */
1072 #define SVR4_SIGNAL_BROKEN 1
1073 #ifdef SVR4_SIGNAL_BROKEN
1074         int svr4_signal = 0;
1075 #else
1076         int svr4_signal = current->personality == PER_SVR4;
1077 #endif
1078 
1079         cookie.restart_syscall = restart_syscall;
1080         cookie.orig_i0 = orig_i0;
1081 
1082         if (!oldset)
1083                 oldset = &current->blocked;
1084 
1085         signr = get_signal_to_deliver(&info, regs, &cookie);
1086         if (signr > 0) {
1087                 struct k_sigaction *ka;
1088                 
1089                 ka = &current->sighand->action[signr-1];
1090 
1091                 if (cookie.restart_syscall)
1092                         syscall_restart(cookie.orig_i0, regs, &ka->sa);
1093                 handle_signal(signr, ka, &info, oldset, regs, svr4_signal);
1094                 return 1;
1095         }
1096         if (cookie.restart_syscall &&
1097             (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
1098              regs->u_regs[UREG_I0] == ERESTARTSYS ||
1099              regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
1100                 /* replay the system call when we are done */
1101                 regs->u_regs[UREG_I0] = cookie.orig_i0;
1102                 regs->pc -= 4;
1103                 regs->npc -= 4;
1104         }
1105         if (cookie.restart_syscall &&
1106             regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) {
1107                 regs->u_regs[UREG_G1] = __NR_restart_syscall;
1108                 regs->pc -= 4;
1109                 regs->npc -= 4;
1110         }
1111         return 0;
1112 }
1113 
1114 asmlinkage int
1115 do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr,
1116                 unsigned long sp)
1117 {
1118         int ret = -EFAULT;
1119 
1120         /* First see if old state is wanted. */
1121         if (ossptr) {
1122                 if (put_user(current->sas_ss_sp + current->sas_ss_size,
1123                              &ossptr->the_stack) ||
1124                     __put_user(on_sig_stack(sp), &ossptr->cur_status))
1125                         goto out;
1126         }
1127 
1128         /* Now see if we want to update the new state. */
1129         if (ssptr) {
1130                 void *ss_sp;
1131 
1132                 if (get_user((long)ss_sp, &ssptr->the_stack))
1133                         goto out;
1134                 /* If the current stack was set with sigaltstack, don't
1135                    swap stacks while we are on it.  */
1136                 ret = -EPERM;
1137                 if (current->sas_ss_sp && on_sig_stack(sp))
1138                         goto out;
1139 
1140                 /* Since we don't know the extent of the stack, and we don't
1141                    track onstack-ness, but rather calculate it, we must
1142                    presume a size.  Ho hum this interface is lossy.  */
1143                 current->sas_ss_sp = (unsigned long)ss_sp - SIGSTKSZ;
1144                 current->sas_ss_size = SIGSTKSZ;
1145         }
1146         ret = 0;
1147 out:
1148         return ret;
1149 }
1150 

~ [ 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