basic questions to strace

Lentes, Bernd bernd.lentes at helmholtz-muenchen.de
Fri Oct 7 13:16:40 UTC 2016


Hi,

i'm a system administrator, not a developer. I use strace sometimes for debugging problems, and i like it very much. Nice tool.
I have some principal questions and hope this is the right place to ask. If not please inform me and maybe give me a hint
where a more aprropriate place would be.

>From what i understand until now is that processes normally don't invoke system calls directly, they contact libraries which do it for them.

Starting a process give me this error in the log:
traps: nsrexecd[12162] general protection ip:7f085e4cb960 sp:7f085a4e9278 error:0 in libpthread-2.23.so[7f085e4b9000+18000]
It seems that the kernel is stopping the process because of ... what with a signal.

I observed the process /usr/sbin/nsrexecd with strace. 
Here seems to be the problem:

open("/dev/null", O_RDWR)               = 3
close(3)                                = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fac73d019d0) = 13025
rt_sigaction(SIGTERM, {0x4275e0, [HUP INT USR1 USR2 PIPE ALRM TERM CHLD XCPU XFSZ], SA_RESTORER, 0x7fac72ce83d0}, NULL, 8) = 0
rt_sigaction(SIGCHLD, {0x4275e0, [HUP INT USR1 USR2 PIPE ALRM TERM CHLD XCPU XFSZ], SA_RESTORER, 0x7fac72ce83d0}, NULL, 8) = 0
select(0, NULL, NULL, NULL, {300, 0})   = ? ERESTARTNOHAND (To be restarted if no handler)
--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=13025, si_uid=0} ---
rt_sigreturn({mask=[]})                 = -1 EINTR (Interrupted system call)
exit_group(0)                           = ?
+++ exited with 0 +++

clone is a syscall for creating a child process, right ?

man 2 clone says:

       /* Prototype for the glibc wrapper function */

       #include <sched.h>

       int clone(int (*fn)(void *), void *child_stack,
                 int flags, void *arg, ...
                 /* pid_t *ptid, struct user_desc *tls, pid_t *ctid */ );

       /* Prototype for the raw system call */

       long clone(unsigned long flags, void *child_stack,
                 void *ptid, void *ctid,
                 struct pt_regs *regs);


What i don't understand:
The syscall is called with three arguments, right ? But the wrapper function expects ... how many arguments ? What means ... ? Does it expect 7 arguments ?
And the syscall itself has 5 arguments, but it is called just with three. Does that work ? Which ones are the these which are used ? The first three ?
The last three ?

What means the return code 13025 ? I didn't find anything about it in the net. Is there s.th. where i can get further information ?
I installed the kernel sources and searched for a file like clone.h or clone.c, but didn't find anything.

Thanks for any help.


Bernd

-- 
Bernd Lentes 

Systemadministration 
institute of developmental genetics 
Gebäude 35.34 - Raum 208 
HelmholtzZentrum München 
bernd.lentes at helmholtz-muenchen.de 
phone: +49 (0)89 3187 1241 
fax: +49 (0)89 3187 2294 

Erst wenn man sich auf etwas festlegt kann man Unrecht haben 
Scott Adams
 

Helmholtz Zentrum Muenchen
Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH)
Ingolstaedter Landstr. 1
85764 Neuherberg
www.helmholtz-muenchen.de
Aufsichtsratsvorsitzende: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrer: Prof. Dr. Guenther Wess, Dr. Alfons Enhsen
Registergericht: Amtsgericht Muenchen HRB 6466
USt-IdNr: DE 129521671





More information about the Strace-devel mailing list