NOMMU: Make VMAs per MM as for MMU-mode linux
[linux-2.6.git] / arch / frv / kernel / ptrace.c
1 /* ptrace.c: FRV specific parts of process tracing
2  *
3  * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
5  * - Derived from arch/m68k/kernel/ptrace.c
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version
10  * 2 of the License, or (at your option) any later version.
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15 #include <linux/mm.h>
16 #include <linux/smp.h>
17 #include <linux/errno.h>
18 #include <linux/ptrace.h>
19 #include <linux/user.h>
20 #include <linux/security.h>
21 #include <linux/signal.h>
22
23 #include <asm/uaccess.h>
24 #include <asm/page.h>
25 #include <asm/pgtable.h>
26 #include <asm/system.h>
27 #include <asm/processor.h>
28 #include <asm/unistd.h>
29
30 /*
31  * does not yet catch signals sent when the child dies.
32  * in exit.c or in signal.c.
33  */
34
35 /*
36  * Get contents of register REGNO in task TASK.
37  */
38 static inline long get_reg(struct task_struct *task, int regno)
39 {
40         struct user_context *user = task->thread.user;
41
42         if (regno < 0 || regno >= PT__END)
43                 return 0;
44
45         return ((unsigned long *) user)[regno];
46 }
47
48 /*
49  * Write contents of register REGNO in task TASK.
50  */
51 static inline int put_reg(struct task_struct *task, int regno,
52                           unsigned long data)
53 {
54         struct user_context *user = task->thread.user;
55
56         if (regno < 0 || regno >= PT__END)
57                 return -EIO;
58
59         switch (regno) {
60         case PT_GR(0):
61                 return 0;
62         case PT_PSR:
63         case PT__STATUS:
64                 return -EIO;
65         default:
66                 ((unsigned long *) user)[regno] = data;
67                 return 0;
68         }
69 }
70
71 /*
72  * check that an address falls within the bounds of the target process's memory
73  * mappings
74  */
75 static inline int is_user_addr_valid(struct task_struct *child,
76                                      unsigned long start, unsigned long len)
77 {
78 #ifdef CONFIG_MMU
79         if (start >= PAGE_OFFSET || len > PAGE_OFFSET - start)
80                 return -EIO;
81         return 0;
82 #else
83         struct vm_area_struct *vma;
84
85         vma = find_vma(child->mm, start);
86         if (vma && start >= vma->vm_start && start + len <= vma->vm_end)
87                 return 0;
88
89         return -EIO;
90 #endif
91 }
92
93 /*
94  * Called by kernel/ptrace.c when detaching..
95  *
96  * Control h/w single stepping
97  */
98 void ptrace_disable(struct task_struct *child)
99 {
100         child->thread.frame0->__status &= ~REG__STATUS_STEP;
101 }
102
103 void ptrace_enable(struct task_struct *child)
104 {
105         child->thread.frame0->__status |= REG__STATUS_STEP;
106 }
107
108 long arch_ptrace(struct task_struct *child, long request, long addr, long data)
109 {
110         unsigned long tmp;
111         int ret;
112
113         switch (request) {
114                 /* when I and D space are separate, these will need to be fixed. */
115         case PTRACE_PEEKTEXT: /* read word at location addr. */
116         case PTRACE_PEEKDATA:
117                 ret = -EIO;
118                 if (is_user_addr_valid(child, addr, sizeof(tmp)) < 0)
119                         break;
120                 ret = generic_ptrace_peekdata(child, addr, data);
121                 break;
122
123                 /* read the word at location addr in the USER area. */
124         case PTRACE_PEEKUSR: {
125                 tmp = 0;
126                 ret = -EIO;
127                 if ((addr & 3) || addr < 0)
128                         break;
129
130                 ret = 0;
131                 switch (addr >> 2) {
132                 case 0 ... PT__END - 1:
133                         tmp = get_reg(child, addr >> 2);
134                         break;
135
136                 case PT__END + 0:
137                         tmp = child->mm->end_code - child->mm->start_code;
138                         break;
139
140                 case PT__END + 1:
141                         tmp = child->mm->end_data - child->mm->start_data;
142                         break;
143
144                 case PT__END + 2:
145                         tmp = child->mm->start_stack - child->mm->start_brk;
146                         break;
147
148                 case PT__END + 3:
149                         tmp = child->mm->start_code;
150                         break;
151
152                 case PT__END + 4:
153                         tmp = child->mm->start_stack;
154                         break;
155
156                 default:
157                         ret = -EIO;
158                         break;
159                 }
160
161                 if (ret == 0)
162                         ret = put_user(tmp, (unsigned long *) data);
163                 break;
164         }
165
166                 /* when I and D space are separate, this will have to be fixed. */
167         case PTRACE_POKETEXT: /* write the word at location addr. */
168         case PTRACE_POKEDATA:
169                 ret = -EIO;
170                 if (is_user_addr_valid(child, addr, sizeof(tmp)) < 0)
171                         break;
172                 ret = generic_ptrace_pokedata(child, addr, data);
173                 break;
174
175         case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
176                 ret = -EIO;
177                 if ((addr & 3) || addr < 0)
178                         break;
179
180                 ret = 0;
181                 switch (addr >> 2) {
182                 case 0 ... PT__END-1:
183                         ret = put_reg(child, addr >> 2, data);
184                         break;
185
186                 default:
187                         ret = -EIO;
188                         break;
189                 }
190                 break;
191
192         case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
193         case PTRACE_CONT: /* restart after signal. */
194                 ret = -EIO;
195                 if (!valid_signal(data))
196                         break;
197                 if (request == PTRACE_SYSCALL)
198                         set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
199                 else
200                         clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
201                 child->exit_code = data;
202                 ptrace_disable(child);
203                 wake_up_process(child);
204                 ret = 0;
205                 break;
206
207                 /* make the child exit.  Best I can do is send it a sigkill.
208                  * perhaps it should be put in the status that it wants to
209                  * exit.
210                  */
211         case PTRACE_KILL:
212                 ret = 0;
213                 if (child->exit_state == EXIT_ZOMBIE)   /* already dead */
214                         break;
215                 child->exit_code = SIGKILL;
216                 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
217                 ptrace_disable(child);
218                 wake_up_process(child);
219                 break;
220
221         case PTRACE_SINGLESTEP:  /* set the trap flag. */
222                 ret = -EIO;
223                 if (!valid_signal(data))
224                         break;
225                 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
226                 ptrace_enable(child);
227                 child->exit_code = data;
228                 wake_up_process(child);
229                 ret = 0;
230                 break;
231
232         case PTRACE_DETACH:     /* detach a process that was attached. */
233                 ret = ptrace_detach(child, data);
234                 break;
235
236         case PTRACE_GETREGS: { /* Get all integer regs from the child. */
237                 int i;
238                 for (i = 0; i < PT__GPEND; i++) {
239                         tmp = get_reg(child, i);
240                         if (put_user(tmp, (unsigned long *) data)) {
241                                 ret = -EFAULT;
242                                 break;
243                         }
244                         data += sizeof(long);
245                 }
246                 ret = 0;
247                 break;
248         }
249
250         case PTRACE_SETREGS: { /* Set all integer regs in the child. */
251                 int i;
252                 for (i = 0; i < PT__GPEND; i++) {
253                         if (get_user(tmp, (unsigned long *) data)) {
254                                 ret = -EFAULT;
255                                 break;
256                         }
257                         put_reg(child, i, tmp);
258                         data += sizeof(long);
259                 }
260                 ret = 0;
261                 break;
262         }
263
264         case PTRACE_GETFPREGS: { /* Get the child FP/Media state. */
265                 ret = 0;
266                 if (copy_to_user((void *) data,
267                                  &child->thread.user->f,
268                                  sizeof(child->thread.user->f)))
269                         ret = -EFAULT;
270                 break;
271         }
272
273         case PTRACE_SETFPREGS: { /* Set the child FP/Media state. */
274                 ret = 0;
275                 if (copy_from_user(&child->thread.user->f,
276                                    (void *) data,
277                                    sizeof(child->thread.user->f)))
278                         ret = -EFAULT;
279                 break;
280         }
281
282         case PTRACE_GETFDPIC:
283                 tmp = 0;
284                 switch (addr) {
285                 case PTRACE_GETFDPIC_EXEC:
286                         tmp = child->mm->context.exec_fdpic_loadmap;
287                         break;
288                 case PTRACE_GETFDPIC_INTERP:
289                         tmp = child->mm->context.interp_fdpic_loadmap;
290                         break;
291                 default:
292                         break;
293                 }
294
295                 ret = 0;
296                 if (put_user(tmp, (unsigned long *) data)) {
297                         ret = -EFAULT;
298                         break;
299                 }
300                 break;
301
302         default:
303                 ret = -EIO;
304                 break;
305         }
306         return ret;
307 }
308
309 int __nongprelbss kstrace;
310
311 static const struct {
312         const char      *name;
313         unsigned        argmask;
314 } __syscall_name_table[NR_syscalls] = {
315         [0]     = { "restart_syscall"                   },
316         [1]     = { "exit",             0x000001        },
317         [2]     = { "fork",             0xffffff        },
318         [3]     = { "read",             0x000141        },
319         [4]     = { "write",            0x000141        },
320         [5]     = { "open",             0x000235        },
321         [6]     = { "close",            0x000001        },
322         [7]     = { "waitpid",          0x000141        },
323         [8]     = { "creat",            0x000025        },
324         [9]     = { "link",             0x000055        },
325         [10]    = { "unlink",           0x000005        },
326         [11]    = { "execve",           0x000445        },
327         [12]    = { "chdir",            0x000005        },
328         [13]    = { "time",             0x000004        },
329         [14]    = { "mknod",            0x000325        },
330         [15]    = { "chmod",            0x000025        },
331         [16]    = { "lchown",           0x000025        },
332         [17]    = { "break" },
333         [18]    = { "oldstat",          0x000045        },
334         [19]    = { "lseek",            0x000131        },
335         [20]    = { "getpid",           0xffffff        },
336         [21]    = { "mount",            0x043555        },
337         [22]    = { "umount",           0x000005        },
338         [23]    = { "setuid",           0x000001        },
339         [24]    = { "getuid",           0xffffff        },
340         [25]    = { "stime",            0x000004        },
341         [26]    = { "ptrace",           0x004413        },
342         [27]    = { "alarm",            0x000001        },
343         [28]    = { "oldfstat",         0x000041        },
344         [29]    = { "pause",            0xffffff        },
345         [30]    = { "utime",            0x000045        },
346         [31]    = { "stty" },
347         [32]    = { "gtty" },
348         [33]    = { "access",           0x000025        },
349         [34]    = { "nice",             0x000001        },
350         [35]    = { "ftime" },
351         [36]    = { "sync",             0xffffff        },
352         [37]    = { "kill",             0x000011        },
353         [38]    = { "rename",           0x000055        },
354         [39]    = { "mkdir",            0x000025        },
355         [40]    = { "rmdir",            0x000005        },
356         [41]    = { "dup",              0x000001        },
357         [42]    = { "pipe",             0x000004        },
358         [43]    = { "times",            0x000004        },
359         [44]    = { "prof" },
360         [45]    = { "brk",              0x000004        },
361         [46]    = { "setgid",           0x000001        },
362         [47]    = { "getgid",           0xffffff        },
363         [48]    = { "signal",           0x000041        },
364         [49]    = { "geteuid",          0xffffff        },
365         [50]    = { "getegid",          0xffffff        },
366         [51]    = { "acct",             0x000005        },
367         [52]    = { "umount2",          0x000035        },
368         [53]    = { "lock" },
369         [54]    = { "ioctl",            0x000331        },
370         [55]    = { "fcntl",            0x000331        },
371         [56]    = { "mpx" },
372         [57]    = { "setpgid",          0x000011        },
373         [58]    = { "ulimit" },
374         [60]    = { "umask",            0x000002        },
375         [61]    = { "chroot",           0x000005        },
376         [62]    = { "ustat",            0x000043        },
377         [63]    = { "dup2",             0x000011        },
378         [64]    = { "getppid",          0xffffff        },
379         [65]    = { "getpgrp",          0xffffff        },
380         [66]    = { "setsid",           0xffffff        },
381         [67]    = { "sigaction" },
382         [68]    = { "sgetmask" },
383         [69]    = { "ssetmask" },
384         [70]    = { "setreuid" },
385         [71]    = { "setregid" },
386         [72]    = { "sigsuspend" },
387         [73]    = { "sigpending" },
388         [74]    = { "sethostname" },
389         [75]    = { "setrlimit" },
390         [76]    = { "getrlimit" },
391         [77]    = { "getrusage" },
392         [78]    = { "gettimeofday" },
393         [79]    = { "settimeofday" },
394         [80]    = { "getgroups" },
395         [81]    = { "setgroups" },
396         [82]    = { "select" },
397         [83]    = { "symlink" },
398         [84]    = { "oldlstat" },
399         [85]    = { "readlink" },
400         [86]    = { "uselib" },
401         [87]    = { "swapon" },
402         [88]    = { "reboot" },
403         [89]    = { "readdir" },
404         [91]    = { "munmap",           0x000034        },
405         [92]    = { "truncate" },
406         [93]    = { "ftruncate" },
407         [94]    = { "fchmod" },
408         [95]    = { "fchown" },
409         [96]    = { "getpriority" },
410         [97]    = { "setpriority" },
411         [99]    = { "statfs" },
412         [100]   = { "fstatfs" },
413         [102]   = { "socketcall" },
414         [103]   = { "syslog" },
415         [104]   = { "setitimer" },
416         [105]   = { "getitimer" },
417         [106]   = { "stat" },
418         [107]   = { "lstat" },
419         [108]   = { "fstat" },
420         [111]   = { "vhangup" },
421         [114]   = { "wait4" },
422         [115]   = { "swapoff" },
423         [116]   = { "sysinfo" },
424         [117]   = { "ipc" },
425         [118]   = { "fsync" },
426         [119]   = { "sigreturn" },
427         [120]   = { "clone" },
428         [121]   = { "setdomainname" },
429         [122]   = { "uname" },
430         [123]   = { "modify_ldt" },
431         [123]   = { "cacheflush" },
432         [124]   = { "adjtimex" },
433         [125]   = { "mprotect" },
434         [126]   = { "sigprocmask" },
435         [127]   = { "create_module" },
436         [128]   = { "init_module" },
437         [129]   = { "delete_module" },
438         [130]   = { "get_kernel_syms" },
439         [131]   = { "quotactl" },
440         [132]   = { "getpgid" },
441         [133]   = { "fchdir" },
442         [134]   = { "bdflush" },
443         [135]   = { "sysfs" },
444         [136]   = { "personality" },
445         [137]   = { "afs_syscall" },
446         [138]   = { "setfsuid" },
447         [139]   = { "setfsgid" },
448         [140]   = { "_llseek",                  0x014331        },
449         [141]   = { "getdents" },
450         [142]   = { "_newselect",               0x000141        },
451         [143]   = { "flock" },
452         [144]   = { "msync" },
453         [145]   = { "readv" },
454         [146]   = { "writev" },
455         [147]   = { "getsid",                   0x000001        },
456         [148]   = { "fdatasync",                0x000001        },
457         [149]   = { "_sysctl",                  0x000004        },
458         [150]   = { "mlock" },
459         [151]   = { "munlock" },
460         [152]   = { "mlockall" },
461         [153]   = { "munlockall" },
462         [154]   = { "sched_setparam" },
463         [155]   = { "sched_getparam" },
464         [156]   = { "sched_setscheduler" },
465         [157]   = { "sched_getscheduler" },
466         [158]   = { "sched_yield" },
467         [159]   = { "sched_get_priority_max" },
468         [160]   = { "sched_get_priority_min" },
469         [161]   = { "sched_rr_get_interval" },
470         [162]   = { "nanosleep",                0x000044        },
471         [163]   = { "mremap" },
472         [164]   = { "setresuid" },
473         [165]   = { "getresuid" },
474         [166]   = { "vm86" },
475         [167]   = { "query_module" },
476         [168]   = { "poll" },
477         [169]   = { "nfsservctl" },
478         [170]   = { "setresgid" },
479         [171]   = { "getresgid" },
480         [172]   = { "prctl",                    0x333331        },
481         [173]   = { "rt_sigreturn",             0xffffff        },
482         [174]   = { "rt_sigaction",             0x001441        },
483         [175]   = { "rt_sigprocmask",           0x001441        },
484         [176]   = { "rt_sigpending",            0x000014        },
485         [177]   = { "rt_sigtimedwait",          0x001444        },
486         [178]   = { "rt_sigqueueinfo",          0x000411        },
487         [179]   = { "rt_sigsuspend",            0x000014        },
488         [180]   = { "pread",                    0x003341        },
489         [181]   = { "pwrite",                   0x003341        },
490         [182]   = { "chown",                    0x000115        },
491         [183]   = { "getcwd" },
492         [184]   = { "capget" },
493         [185]   = { "capset" },
494         [186]   = { "sigaltstack" },
495         [187]   = { "sendfile" },
496         [188]   = { "getpmsg" },
497         [189]   = { "putpmsg" },
498         [190]   = { "vfork",                    0xffffff        },
499         [191]   = { "ugetrlimit" },
500         [192]   = { "mmap2",                    0x313314        },
501         [193]   = { "truncate64" },
502         [194]   = { "ftruncate64" },
503         [195]   = { "stat64",                   0x000045        },
504         [196]   = { "lstat64",                  0x000045        },
505         [197]   = { "fstat64",                  0x000041        },
506         [198]   = { "lchown32" },
507         [199]   = { "getuid32",                 0xffffff        },
508         [200]   = { "getgid32",                 0xffffff        },
509         [201]   = { "geteuid32",                0xffffff        },
510         [202]   = { "getegid32",                0xffffff        },
511         [203]   = { "setreuid32" },
512         [204]   = { "setregid32" },
513         [205]   = { "getgroups32" },
514         [206]   = { "setgroups32" },
515         [207]   = { "fchown32" },
516         [208]   = { "setresuid32" },
517         [209]   = { "getresuid32" },
518         [210]   = { "setresgid32" },
519         [211]   = { "getresgid32" },
520         [212]   = { "chown32" },
521         [213]   = { "setuid32" },
522         [214]   = { "setgid32" },
523         [215]   = { "setfsuid32" },
524         [216]   = { "setfsgid32" },
525         [217]   = { "pivot_root" },
526         [218]   = { "mincore" },
527         [219]   = { "madvise" },
528         [220]   = { "getdents64" },
529         [221]   = { "fcntl64" },
530         [223]   = { "security" },
531         [224]   = { "gettid" },
532         [225]   = { "readahead" },
533         [226]   = { "setxattr" },
534         [227]   = { "lsetxattr" },
535         [228]   = { "fsetxattr" },
536         [229]   = { "getxattr" },
537         [230]   = { "lgetxattr" },
538         [231]   = { "fgetxattr" },
539         [232]   = { "listxattr" },
540         [233]   = { "llistxattr" },
541         [234]   = { "flistxattr" },
542         [235]   = { "removexattr" },
543         [236]   = { "lremovexattr" },
544         [237]   = { "fremovexattr" },
545         [238]   = { "tkill" },
546         [239]   = { "sendfile64" },
547         [240]   = { "futex" },
548         [241]   = { "sched_setaffinity" },
549         [242]   = { "sched_getaffinity" },
550         [243]   = { "set_thread_area" },
551         [244]   = { "get_thread_area" },
552         [245]   = { "io_setup" },
553         [246]   = { "io_destroy" },
554         [247]   = { "io_getevents" },
555         [248]   = { "io_submit" },
556         [249]   = { "io_cancel" },
557         [250]   = { "fadvise64" },
558         [252]   = { "exit_group",               0x000001        },
559         [253]   = { "lookup_dcookie" },
560         [254]   = { "epoll_create" },
561         [255]   = { "epoll_ctl" },
562         [256]   = { "epoll_wait" },
563         [257]   = { "remap_file_pages" },
564         [258]   = { "set_tid_address" },
565         [259]   = { "timer_create" },
566         [260]   = { "timer_settime" },
567         [261]   = { "timer_gettime" },
568         [262]   = { "timer_getoverrun" },
569         [263]   = { "timer_delete" },
570         [264]   = { "clock_settime" },
571         [265]   = { "clock_gettime" },
572         [266]   = { "clock_getres" },
573         [267]   = { "clock_nanosleep" },
574         [268]   = { "statfs64" },
575         [269]   = { "fstatfs64" },
576         [270]   = { "tgkill" },
577         [271]   = { "utimes" },
578         [272]   = { "fadvise64_64" },
579         [273]   = { "vserver" },
580         [274]   = { "mbind" },
581         [275]   = { "get_mempolicy" },
582         [276]   = { "set_mempolicy" },
583         [277]   = { "mq_open" },
584         [278]   = { "mq_unlink" },
585         [279]   = { "mq_timedsend" },
586         [280]   = { "mq_timedreceive" },
587         [281]   = { "mq_notify" },
588         [282]   = { "mq_getsetattr" },
589         [283]   = { "sys_kexec_load" },
590 };
591
592 asmlinkage void do_syscall_trace(int leaving)
593 {
594 #if 0
595         unsigned long *argp;
596         const char *name;
597         unsigned argmask;
598         char buffer[16];
599
600         if (!kstrace)
601                 return;
602
603         if (!current->mm)
604                 return;
605
606         if (__frame->gr7 == __NR_close)
607                 return;
608
609 #if 0
610         if (__frame->gr7 != __NR_mmap2 &&
611             __frame->gr7 != __NR_vfork &&
612             __frame->gr7 != __NR_execve &&
613             __frame->gr7 != __NR_exit)
614                 return;
615 #endif
616
617         argmask = 0;
618         name = NULL;
619         if (__frame->gr7 < NR_syscalls) {
620                 name = __syscall_name_table[__frame->gr7].name;
621                 argmask = __syscall_name_table[__frame->gr7].argmask;
622         }
623         if (!name) {
624                 sprintf(buffer, "sys_%lx", __frame->gr7);
625                 name = buffer;
626         }
627
628         if (!leaving) {
629                 if (!argmask) {
630                         printk(KERN_CRIT "[%d] %s(%lx,%lx,%lx,%lx,%lx,%lx)\n",
631                                current->pid,
632                                name,
633                                __frame->gr8,
634                                __frame->gr9,
635                                __frame->gr10,
636                                __frame->gr11,
637                                __frame->gr12,
638                                __frame->gr13);
639                 }
640                 else if (argmask == 0xffffff) {
641                         printk(KERN_CRIT "[%d] %s()\n",
642                                current->pid,
643                                name);
644                 }
645                 else {
646                         printk(KERN_CRIT "[%d] %s(",
647                                current->pid,
648                                name);
649
650                         argp = &__frame->gr8;
651
652                         do {
653                                 switch (argmask & 0xf) {
654                                 case 1:
655                                         printk("%ld", (long) *argp);
656                                         break;
657                                 case 2:
658                                         printk("%lo", *argp);
659                                         break;
660                                 case 3:
661                                         printk("%lx", *argp);
662                                         break;
663                                 case 4:
664                                         printk("%p", (void *) *argp);
665                                         break;
666                                 case 5:
667                                         printk("\"%s\"", (char *) *argp);
668                                         break;
669                                 }
670
671                                 argp++;
672                                 argmask >>= 4;
673                                 if (argmask)
674                                         printk(",");
675
676                         } while (argmask);
677
678                         printk(")\n");
679                 }
680         }
681         else {
682                 if ((int)__frame->gr8 > -4096 && (int)__frame->gr8 < 4096)
683                         printk(KERN_CRIT "[%d] %s() = %ld\n", current->pid, name, __frame->gr8);
684                 else
685                         printk(KERN_CRIT "[%d] %s() = %lx\n", current->pid, name, __frame->gr8);
686         }
687         return;
688 #endif
689
690         if (!test_thread_flag(TIF_SYSCALL_TRACE))
691                 return;
692
693         if (!(current->ptrace & PT_PTRACED))
694                 return;
695
696         /* we need to indicate entry or exit to strace */
697         if (leaving)
698                 __frame->__status |= REG__STATUS_SYSC_EXIT;
699         else
700                 __frame->__status |= REG__STATUS_SYSC_ENTRY;
701
702         ptrace_notify(SIGTRAP);
703
704         /*
705          * this isn't the same as continuing with a signal, but it will do
706          * for normal use.  strace only continues with a signal if the
707          * stopping signal is not SIGTRAP.  -brl
708          */
709         if (current->exit_code) {
710                 send_sig(current->exit_code, current, 1);
711                 current->exit_code = 0;
712         }
713 }