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