2 * arch/s390/kernel/ptrace.c
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
9 * Based on PowerPC version
10 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
12 * Derived from "arch/m68k/kernel/ptrace.c"
13 * Copyright (C) 1994 by Hamish Macdonald
14 * Taken from linux/kernel/ptrace.c and modified for M680x0.
15 * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds
17 * Modified by Cort Dougan (cort@cs.nmt.edu)
20 * This file is subject to the terms and conditions of the GNU General
21 * Public License. See the file README.legal in the main directory of
22 * this archive for more details.
25 #include <linux/kernel.h>
26 #include <linux/sched.h>
28 #include <linux/smp.h>
29 #include <linux/smp_lock.h>
30 #include <linux/errno.h>
31 #include <linux/ptrace.h>
32 #include <linux/user.h>
33 #include <linux/security.h>
34 #include <linux/audit.h>
36 #include <asm/segment.h>
38 #include <asm/pgtable.h>
39 #include <asm/pgalloc.h>
40 #include <asm/system.h>
41 #include <asm/uaccess.h>
43 #ifdef CONFIG_S390_SUPPORT
44 #include "compat_ptrace.h"
48 FixPerRegisters(struct task_struct
*task
)
53 regs
= __KSTK_PTREGS(task
);
54 per_info
= (per_struct
*) &task
->thread
.per_info
;
55 per_info
->control_regs
.bits
.em_instruction_fetch
=
56 per_info
->single_step
| per_info
->instruction_fetch
;
58 if (per_info
->single_step
) {
59 per_info
->control_regs
.bits
.starting_addr
= 0;
60 #ifdef CONFIG_S390_SUPPORT
61 if (test_thread_flag(TIF_31BIT
))
62 per_info
->control_regs
.bits
.ending_addr
= 0x7fffffffUL
;
65 per_info
->control_regs
.bits
.ending_addr
= PSW_ADDR_INSN
;
67 per_info
->control_regs
.bits
.starting_addr
=
68 per_info
->starting_addr
;
69 per_info
->control_regs
.bits
.ending_addr
=
70 per_info
->ending_addr
;
73 * if any of the control reg tracing bits are on
74 * we switch on per in the psw
76 if (per_info
->control_regs
.words
.cr
[0] & PER_EM_MASK
)
77 regs
->psw
.mask
|= PSW_MASK_PER
;
79 regs
->psw
.mask
&= ~PSW_MASK_PER
;
81 if (per_info
->control_regs
.bits
.em_storage_alteration
)
82 per_info
->control_regs
.bits
.storage_alt_space_ctl
= 1;
84 per_info
->control_regs
.bits
.storage_alt_space_ctl
= 0;
88 set_single_step(struct task_struct
*task
)
90 task
->thread
.per_info
.single_step
= 1;
91 FixPerRegisters(task
);
95 clear_single_step(struct task_struct
*task
)
97 task
->thread
.per_info
.single_step
= 0;
98 FixPerRegisters(task
);
102 * Called by kernel/ptrace.c when detaching..
104 * Make sure single step bits etc are not set.
107 ptrace_disable(struct task_struct
*child
)
109 /* make sure the single step bit is not set. */
110 clear_single_step(child
);
113 #ifndef CONFIG_ARCH_S390X
114 # define __ADDR_MASK 3
116 # define __ADDR_MASK 7
120 * Read the word at offset addr from the user area of a process. The
121 * trouble here is that the information is littered over different
122 * locations. The process registers are found on the kernel stack,
123 * the floating point stuff and the trace settings are stored in
124 * the task structure. In addition the different structures in
125 * struct user contain pad bytes that should be read as zeroes.
129 peek_user(struct task_struct
*child
, addr_t addr
, addr_t data
)
131 struct user
*dummy
= NULL
;
135 * Stupid gdb peeks/pokes the access registers in 64 bit with
136 * an alignment of 4. Programmers from hell...
138 if ((addr
& 3) || addr
> sizeof(struct user
) - __ADDR_MASK
)
141 if (addr
< (addr_t
) &dummy
->regs
.acrs
) {
143 * psw and gprs are stored on the stack
145 tmp
= *(addr_t
*)((addr_t
) &__KSTK_PTREGS(child
)->psw
+ addr
);
146 if (addr
== (addr_t
) &dummy
->regs
.psw
.mask
)
147 /* Remove per bit from user psw. */
148 tmp
&= ~PSW_MASK_PER
;
150 } else if (addr
< (addr_t
) &dummy
->regs
.orig_gpr2
) {
152 * access registers are stored in the thread structure
154 offset
= addr
- (addr_t
) &dummy
->regs
.acrs
;
155 tmp
= *(addr_t
*)((addr_t
) &child
->thread
.acrs
+ offset
);
157 } else if (addr
== (addr_t
) &dummy
->regs
.orig_gpr2
) {
159 * orig_gpr2 is stored on the kernel stack
161 tmp
= (addr_t
) __KSTK_PTREGS(child
)->orig_gpr2
;
163 } else if (addr
< (addr_t
) (&dummy
->regs
.fp_regs
+ 1)) {
165 * floating point regs. are stored in the thread structure
167 offset
= addr
- (addr_t
) &dummy
->regs
.fp_regs
;
168 tmp
= *(addr_t
*)((addr_t
) &child
->thread
.fp_regs
+ offset
);
170 } else if (addr
< (addr_t
) (&dummy
->regs
.per_info
+ 1)) {
172 * per_info is found in the thread structure
174 offset
= addr
- (addr_t
) &dummy
->regs
.per_info
;
175 tmp
= *(addr_t
*)((addr_t
) &child
->thread
.per_info
+ offset
);
180 return put_user(tmp
, (addr_t __user
*) data
);
184 * Write a word to the user area of a process at location addr. This
185 * operation does have an additional problem compared to peek_user.
186 * Stores to the program status word and on the floating point
187 * control register needs to get checked for validity.
190 poke_user(struct task_struct
*child
, addr_t addr
, addr_t data
)
192 struct user
*dummy
= NULL
;
196 * Stupid gdb peeks/pokes the access registers in 64 bit with
197 * an alignment of 4. Programmers from hell indeed...
199 if ((addr
& 3) || addr
> sizeof(struct user
) - __ADDR_MASK
)
202 if (addr
< (addr_t
) &dummy
->regs
.acrs
) {
204 * psw and gprs are stored on the stack
206 if (addr
== (addr_t
) &dummy
->regs
.psw
.mask
&&
207 #ifdef CONFIG_S390_SUPPORT
208 data
!= PSW_MASK_MERGE(PSW_USER32_BITS
, data
) &&
210 data
!= PSW_MASK_MERGE(PSW_USER_BITS
, data
))
211 /* Invalid psw mask. */
213 #ifndef CONFIG_ARCH_S390X
214 if (addr
== (addr_t
) &dummy
->regs
.psw
.addr
)
215 /* I'd like to reject addresses without the
216 high order bit but older gdb's rely on it */
217 data
|= PSW_ADDR_AMODE
;
219 *(addr_t
*)((addr_t
) &__KSTK_PTREGS(child
)->psw
+ addr
) = data
;
221 } else if (addr
< (addr_t
) (&dummy
->regs
.orig_gpr2
)) {
223 * access registers are stored in the thread structure
225 offset
= addr
- (addr_t
) &dummy
->regs
.acrs
;
226 *(addr_t
*)((addr_t
) &child
->thread
.acrs
+ offset
) = data
;
228 } else if (addr
== (addr_t
) &dummy
->regs
.orig_gpr2
) {
230 * orig_gpr2 is stored on the kernel stack
232 __KSTK_PTREGS(child
)->orig_gpr2
= data
;
234 } else if (addr
< (addr_t
) (&dummy
->regs
.fp_regs
+ 1)) {
236 * floating point regs. are stored in the thread structure
238 if (addr
== (addr_t
) &dummy
->regs
.fp_regs
.fpc
&&
239 (data
& ~FPC_VALID_MASK
) != 0)
241 offset
= addr
- (addr_t
) &dummy
->regs
.fp_regs
;
242 *(addr_t
*)((addr_t
) &child
->thread
.fp_regs
+ offset
) = data
;
244 } else if (addr
< (addr_t
) (&dummy
->regs
.per_info
+ 1)) {
246 * per_info is found in the thread structure
248 offset
= addr
- (addr_t
) &dummy
->regs
.per_info
;
249 *(addr_t
*)((addr_t
) &child
->thread
.per_info
+ offset
) = data
;
253 FixPerRegisters(child
);
258 do_ptrace_normal(struct task_struct
*child
, long request
, long addr
, long data
)
265 case PTRACE_PEEKTEXT
:
266 case PTRACE_PEEKDATA
:
267 /* Remove high order bit from address (only for 31 bit). */
268 addr
&= PSW_ADDR_INSN
;
269 /* read word at location addr. */
270 copied
= access_process_vm(child
, addr
, &tmp
, sizeof(tmp
), 0);
271 if (copied
!= sizeof(tmp
))
273 return put_user(tmp
, (unsigned long __user
*) data
);
276 /* read the word at location addr in the USER area. */
277 return peek_user(child
, addr
, data
);
279 case PTRACE_POKETEXT
:
280 case PTRACE_POKEDATA
:
281 /* Remove high order bit from address (only for 31 bit). */
282 addr
&= PSW_ADDR_INSN
;
283 /* write the word at location addr. */
284 copied
= access_process_vm(child
, addr
, &data
, sizeof(data
),1);
285 if (copied
!= sizeof(data
))
290 /* write the word at location addr in the USER area */
291 return poke_user(child
, addr
, data
);
293 case PTRACE_PEEKUSR_AREA
:
294 case PTRACE_POKEUSR_AREA
:
295 if (copy_from_user(&parea
, (void __user
*) addr
,
298 addr
= parea
.kernel_addr
;
299 data
= parea
.process_addr
;
301 while (copied
< parea
.len
) {
302 if (request
== PTRACE_PEEKUSR_AREA
)
303 ret
= peek_user(child
, addr
, data
);
306 if (get_user (tmp
, (addr_t __user
*) data
))
308 ret
= poke_user(child
, addr
, tmp
);
312 addr
+= sizeof(unsigned long);
313 data
+= sizeof(unsigned long);
314 copied
+= sizeof(unsigned long);
318 return ptrace_request(child
, request
, addr
, data
);
321 #ifdef CONFIG_S390_SUPPORT
323 * Now the fun part starts... a 31 bit program running in the
324 * 31 bit emulation tracing another program. PTRACE_PEEKTEXT,
325 * PTRACE_PEEKDATA, PTRACE_POKETEXT and PTRACE_POKEDATA are easy
326 * to handle, the difference to the 64 bit versions of the requests
327 * is that the access is done in multiples of 4 byte instead of
328 * 8 bytes (sizeof(unsigned long) on 31/64 bit).
329 * The ugly part are PTRACE_PEEKUSR, PTRACE_PEEKUSR_AREA,
330 * PTRACE_POKEUSR and PTRACE_POKEUSR_AREA. If the traced program
331 * is a 31 bit program too, the content of struct user can be
332 * emulated. A 31 bit program peeking into the struct user of
333 * a 64 bit program is a no-no.
337 * Same as peek_user but for a 31 bit program.
340 peek_user_emu31(struct task_struct
*child
, addr_t addr
, addr_t data
)
342 struct user32
*dummy32
= NULL
;
343 per_struct32
*dummy_per32
= NULL
;
347 if (!test_thread_flag(TIF_31BIT
) ||
348 (addr
& 3) || addr
> sizeof(struct user
) - 3)
351 if (addr
< (addr_t
) &dummy32
->regs
.acrs
) {
353 * psw and gprs are stored on the stack
355 if (addr
== (addr_t
) &dummy32
->regs
.psw
.mask
) {
356 /* Fake a 31 bit psw mask. */
357 tmp
= (__u32
)(__KSTK_PTREGS(child
)->psw
.mask
>> 32);
358 tmp
= PSW32_MASK_MERGE(PSW32_USER_BITS
, tmp
);
359 } else if (addr
== (addr_t
) &dummy32
->regs
.psw
.addr
) {
360 /* Fake a 31 bit psw address. */
361 tmp
= (__u32
) __KSTK_PTREGS(child
)->psw
.addr
|
365 tmp
= *(__u32
*)((addr_t
) &__KSTK_PTREGS(child
)->psw
+
368 } else if (addr
< (addr_t
) (&dummy32
->regs
.orig_gpr2
)) {
370 * access registers are stored in the thread structure
372 offset
= addr
- (addr_t
) &dummy32
->regs
.acrs
;
373 tmp
= *(__u32
*)((addr_t
) &child
->thread
.acrs
+ offset
);
375 } else if (addr
== (addr_t
) (&dummy32
->regs
.orig_gpr2
)) {
377 * orig_gpr2 is stored on the kernel stack
379 tmp
= *(__u32
*)((addr_t
) &__KSTK_PTREGS(child
)->orig_gpr2
+ 4);
381 } else if (addr
< (addr_t
) (&dummy32
->regs
.fp_regs
+ 1)) {
383 * floating point regs. are stored in the thread structure
385 offset
= addr
- (addr_t
) &dummy32
->regs
.fp_regs
;
386 tmp
= *(__u32
*)((addr_t
) &child
->thread
.fp_regs
+ offset
);
388 } else if (addr
< (addr_t
) (&dummy32
->regs
.per_info
+ 1)) {
390 * per_info is found in the thread structure
392 offset
= addr
- (addr_t
) &dummy32
->regs
.per_info
;
393 /* This is magic. See per_struct and per_struct32. */
394 if ((offset
>= (addr_t
) &dummy_per32
->control_regs
&&
395 offset
< (addr_t
) (&dummy_per32
->control_regs
+ 1)) ||
396 (offset
>= (addr_t
) &dummy_per32
->starting_addr
&&
397 offset
<= (addr_t
) &dummy_per32
->ending_addr
) ||
398 offset
== (addr_t
) &dummy_per32
->lowcore
.words
.address
)
399 offset
= offset
*2 + 4;
402 tmp
= *(__u32
*)((addr_t
) &child
->thread
.per_info
+ offset
);
407 return put_user(tmp
, (__u32 __user
*) data
);
411 * Same as poke_user but for a 31 bit program.
414 poke_user_emu31(struct task_struct
*child
, addr_t addr
, addr_t data
)
416 struct user32
*dummy32
= NULL
;
417 per_struct32
*dummy_per32
= NULL
;
421 if (!test_thread_flag(TIF_31BIT
) ||
422 (addr
& 3) || addr
> sizeof(struct user32
) - 3)
427 if (addr
< (addr_t
) &dummy32
->regs
.acrs
) {
429 * psw, gprs, acrs and orig_gpr2 are stored on the stack
431 if (addr
== (addr_t
) &dummy32
->regs
.psw
.mask
) {
432 /* Build a 64 bit psw mask from 31 bit mask. */
433 if (tmp
!= PSW32_MASK_MERGE(PSW32_USER_BITS
, tmp
))
434 /* Invalid psw mask. */
436 __KSTK_PTREGS(child
)->psw
.mask
=
437 PSW_MASK_MERGE(PSW_USER32_BITS
, (__u64
) tmp
<< 32);
438 } else if (addr
== (addr_t
) &dummy32
->regs
.psw
.addr
) {
439 /* Build a 64 bit psw address from 31 bit address. */
440 __KSTK_PTREGS(child
)->psw
.addr
=
441 (__u64
) tmp
& PSW32_ADDR_INSN
;
444 *(__u32
*)((addr_t
) &__KSTK_PTREGS(child
)->psw
447 } else if (addr
< (addr_t
) (&dummy32
->regs
.orig_gpr2
)) {
449 * access registers are stored in the thread structure
451 offset
= addr
- (addr_t
) &dummy32
->regs
.acrs
;
452 *(__u32
*)((addr_t
) &child
->thread
.acrs
+ offset
) = tmp
;
454 } else if (addr
== (addr_t
) (&dummy32
->regs
.orig_gpr2
)) {
456 * orig_gpr2 is stored on the kernel stack
458 *(__u32
*)((addr_t
) &__KSTK_PTREGS(child
)->orig_gpr2
+ 4) = tmp
;
460 } else if (addr
< (addr_t
) (&dummy32
->regs
.fp_regs
+ 1)) {
462 * floating point regs. are stored in the thread structure
464 if (addr
== (addr_t
) &dummy32
->regs
.fp_regs
.fpc
&&
465 (tmp
& ~FPC_VALID_MASK
) != 0)
466 /* Invalid floating point control. */
468 offset
= addr
- (addr_t
) &dummy32
->regs
.fp_regs
;
469 *(__u32
*)((addr_t
) &child
->thread
.fp_regs
+ offset
) = tmp
;
471 } else if (addr
< (addr_t
) (&dummy32
->regs
.per_info
+ 1)) {
473 * per_info is found in the thread structure.
475 offset
= addr
- (addr_t
) &dummy32
->regs
.per_info
;
477 * This is magic. See per_struct and per_struct32.
478 * By incident the offsets in per_struct are exactly
479 * twice the offsets in per_struct32 for all fields.
480 * The 8 byte fields need special handling though,
481 * because the second half (bytes 4-7) is needed and
482 * not the first half.
484 if ((offset
>= (addr_t
) &dummy_per32
->control_regs
&&
485 offset
< (addr_t
) (&dummy_per32
->control_regs
+ 1)) ||
486 (offset
>= (addr_t
) &dummy_per32
->starting_addr
&&
487 offset
<= (addr_t
) &dummy_per32
->ending_addr
) ||
488 offset
== (addr_t
) &dummy_per32
->lowcore
.words
.address
)
489 offset
= offset
*2 + 4;
492 *(__u32
*)((addr_t
) &child
->thread
.per_info
+ offset
) = tmp
;
496 FixPerRegisters(child
);
501 do_ptrace_emu31(struct task_struct
*child
, long request
, long addr
, long data
)
503 unsigned int tmp
; /* 4 bytes !! */
504 ptrace_area_emu31 parea
;
508 case PTRACE_PEEKTEXT
:
509 case PTRACE_PEEKDATA
:
510 /* read word at location addr. */
511 copied
= access_process_vm(child
, addr
, &tmp
, sizeof(tmp
), 0);
512 if (copied
!= sizeof(tmp
))
514 return put_user(tmp
, (unsigned int __user
*) data
);
517 /* read the word at location addr in the USER area. */
518 return peek_user_emu31(child
, addr
, data
);
520 case PTRACE_POKETEXT
:
521 case PTRACE_POKEDATA
:
522 /* write the word at location addr. */
524 copied
= access_process_vm(child
, addr
, &tmp
, sizeof(tmp
), 1);
525 if (copied
!= sizeof(tmp
))
530 /* write the word at location addr in the USER area */
531 return poke_user_emu31(child
, addr
, data
);
533 case PTRACE_PEEKUSR_AREA
:
534 case PTRACE_POKEUSR_AREA
:
535 if (copy_from_user(&parea
, (void __user
*) addr
,
538 addr
= parea
.kernel_addr
;
539 data
= parea
.process_addr
;
541 while (copied
< parea
.len
) {
542 if (request
== PTRACE_PEEKUSR_AREA
)
543 ret
= peek_user_emu31(child
, addr
, data
);
546 if (get_user (tmp
, (__u32 __user
*) data
))
548 ret
= poke_user_emu31(child
, addr
, tmp
);
552 addr
+= sizeof(unsigned int);
553 data
+= sizeof(unsigned int);
554 copied
+= sizeof(unsigned int);
557 case PTRACE_GETEVENTMSG
:
558 return put_user((__u32
) child
->ptrace_message
,
559 (unsigned int __user
*) data
);
560 case PTRACE_GETSIGINFO
:
561 if (child
->last_siginfo
== NULL
)
563 return copy_siginfo_to_user32((compat_siginfo_t __user
*) data
,
564 child
->last_siginfo
);
565 case PTRACE_SETSIGINFO
:
566 if (child
->last_siginfo
== NULL
)
568 return copy_siginfo_from_user32(child
->last_siginfo
,
569 (compat_siginfo_t __user
*) data
);
571 return ptrace_request(child
, request
, addr
, data
);
575 #define PT32_IEEE_IP 0x13c
578 do_ptrace(struct task_struct
*child
, long request
, long addr
, long data
)
582 if (request
== PTRACE_ATTACH
)
583 return ptrace_attach(child
);
586 * Special cases to get/store the ieee instructions pointer.
588 if (child
== current
) {
589 if (request
== PTRACE_PEEKUSR
&& addr
== PT_IEEE_IP
)
590 return peek_user(child
, addr
, data
);
591 if (request
== PTRACE_POKEUSR
&& addr
== PT_IEEE_IP
)
592 return poke_user(child
, addr
, data
);
593 #ifdef CONFIG_S390_SUPPORT
594 if (request
== PTRACE_PEEKUSR
&&
595 addr
== PT32_IEEE_IP
&& test_thread_flag(TIF_31BIT
))
596 return peek_user_emu31(child
, addr
, data
);
597 if (request
== PTRACE_POKEUSR
&&
598 addr
== PT32_IEEE_IP
&& test_thread_flag(TIF_31BIT
))
599 return poke_user_emu31(child
, addr
, data
);
603 ret
= ptrace_check_attach(child
, request
== PTRACE_KILL
);
609 /* continue and stop at next (return from) syscall */
611 /* restart after signal. */
612 if ((unsigned long) data
>= _NSIG
)
614 if (request
== PTRACE_SYSCALL
)
615 set_tsk_thread_flag(child
, TIF_SYSCALL_TRACE
);
617 clear_tsk_thread_flag(child
, TIF_SYSCALL_TRACE
);
618 child
->exit_code
= data
;
619 /* make sure the single step bit is not set. */
620 clear_single_step(child
);
621 wake_up_process(child
);
626 * make the child exit. Best I can do is send it a sigkill.
627 * perhaps it should be put in the status that it wants to
630 if (child
->exit_state
== EXIT_ZOMBIE
) /* already dead */
632 child
->exit_code
= SIGKILL
;
633 /* make sure the single step bit is not set. */
634 clear_single_step(child
);
635 wake_up_process(child
);
638 case PTRACE_SINGLESTEP
:
639 /* set the trap flag. */
640 if ((unsigned long) data
>= _NSIG
)
642 clear_tsk_thread_flag(child
, TIF_SYSCALL_TRACE
);
643 child
->exit_code
= data
;
645 set_tsk_thread_flag(child
, TIF_SINGLE_STEP
);
647 set_single_step(child
);
648 /* give it a chance to run. */
649 wake_up_process(child
);
653 /* detach a process that was attached. */
654 return ptrace_detach(child
, data
);
657 /* Do requests that differ for 31/64 bit */
659 #ifdef CONFIG_S390_SUPPORT
660 if (test_thread_flag(TIF_31BIT
))
661 return do_ptrace_emu31(child
, request
, addr
, data
);
663 return do_ptrace_normal(child
, request
, addr
, data
);
670 sys_ptrace(long request
, long pid
, long addr
, long data
)
672 struct task_struct
*child
;
677 if (request
== PTRACE_TRACEME
) {
678 /* are we already being traced? */
680 if (current
->ptrace
& PT_PTRACED
)
682 ret
= security_ptrace(current
->parent
, current
);
685 /* set the ptrace bit in the process flags. */
686 current
->ptrace
|= PT_PTRACED
;
691 if (pid
== 1) /* you may not mess with init */
695 read_lock(&tasklist_lock
);
696 child
= find_task_by_pid(pid
);
698 get_task_struct(child
);
699 read_unlock(&tasklist_lock
);
703 ret
= do_ptrace(child
, request
, addr
, data
);
705 put_task_struct(child
);
712 syscall_trace(struct pt_regs
*regs
, int entryexit
)
714 if (unlikely(current
->audit_context
)) {
716 audit_syscall_entry(current
, regs
->gprs
[2],
717 regs
->orig_gpr2
, regs
->gprs
[3],
718 regs
->gprs
[4], regs
->gprs
[5]);
720 audit_syscall_exit(current
, regs
->gprs
[2]);
722 if (!test_thread_flag(TIF_SYSCALL_TRACE
))
724 if (!(current
->ptrace
& PT_PTRACED
))
726 ptrace_notify(SIGTRAP
| ((current
->ptrace
& PT_TRACESYSGOOD
)
730 * this isn't the same as continuing with a signal, but it will do
731 * for normal use. strace only continues with a signal if the
732 * stopping signal is not SIGTRAP. -brl
734 if (current
->exit_code
) {
735 send_sig(current
->exit_code
, current
, 1);
736 current
->exit_code
= 0;