Re: truss issue

From: Alexander Nedotsukov (bland_at_FreeBSD.org)
Date: 12/16/03

  • Next message: gunnar.flygt_at_bredband.net: "Problems with ppp and modem"
    Date: Tue, 16 Dec 2003 12:58:57 +0900
    To: Martin Cracauer <cracauer@cons.org>
    
    

    Martin Cracauer wrote:

    >[CC'ed Bruce]
    >
    >Maxim Konovalov wrote on Mon, Dec 15, 2003 at 03:35:31PM +0300:
    >
    >
    >>Hello,
    >>
    >>On Mon, 16 Jun 2003, 23:40+0900, Alexander Nedotsukov wrote:
    >>
    >>
    >>
    >>>All,
    >>>
    >>>I found current truss behaviour a bit strange. It coredumps always if
    >>>trussed process do without any significant reason for my understanding.
    >>>I also confused with comment for commit originally introduced this
    >>>functionality
    >>>http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/truss/main.c.diff?r1=1.9&r2=1.10.
    >>>I propose patch attached to make truss always return result of trussed
    >>>process and do not kill() itself. What do you think about it?
    >>>
    >>>
    >>As a matter of fact, bin/58970 is a backout of rev.1.10 truss/main.c:
    >>
    >>----------------------------
    >>revision 1.10
    >>date: 1998/08/24 10:17:20; author: cracauer; state: Exp; lines: +9 -1
    >>When exiting on SIGINT, exit with signal status
    >>=============================================================================
    >>
    >>But a code does not match the comment and does something funny:
    >>
    >>@@ -216,6 +217,7 @@
    >> break;
    >> case S_SIG:
    >> fprintf(outfile, "SIGNAL %lu\n", pfs.val);
    >>+ sigexit = pfs.val;
    >> break;
    >> case S_EXIT:
    >> fprintf (outfile, "process exit, rval = %lu\n", pfs.val);
    >>@@ -232,5 +234,11 @@
    >> if (ioctl(Procfd, PIOCCONT, val) == -1)
    >> warn("PIOCCONT");
    >> } while (pfs.why != S_EXIT);
    >>+ if (sigexit) {
    >>+ if (sigexit == SIGQUIT)
    >>+ exit(sigexit);
    >>+ (void) signal(sigexit, SIG_DFL);
    >>+ (void) kill(getpid(), sigexit);
    >>+ }
    >> return 0;
    >> }
    >>
    >>Gentlemen, does anobody know what is going on there?
    >>
    >>
    >
    >If you catch a signal like SIGINT or SIGTERM (as opposed to leaving
    >the original OS handler to handle it), then you need to reissue that
    >same signal to yourself when after your did whatever cleanup you
    >want.
    >
    >The general reason is that the parent of the process needs to be
    >informed that you exited on a signal.
    >
    >The specific reason is that if you don't, then a shellscript will not
    >be interruptable with SIGINT or SIGTERM.
    >
    >I have a lengthly web page about it at
    > http://www.cons.org/cracauer/sigint.html
    >
    >
    Ah. I must be thinking on it. Thanks!
    As an excuse for this noise I made I would say that truss is still not
    ready to be used in batch
    jobs. Besides it's important to properly respond to SIGINT/QUIT it's not
    less vital to
    passthrough child ret codes. Since we always have 0 I wasn't thinking on
    truss as transparent
    wrapper.

    >
    >As for for problem with the coredumps, I assume this is when SIGQUIT
    >is used? The proper way of handling this would be to change truss (and
    >other transparent wrappers) to ulimit the coredump size to zero and
    >then reissue the SIGQUIT signal.
    >
    >
    No it is not. In fact the code you added forces turss exit(3) with
    status 3 on SIGQUIT in child.
    Current implementation does suicide in all but one (SIGQUIT) cases it
    child does not only upon
    SIGTERM or SIGQUIT as you suggested on web page. Count on SIGABRT,
    SIGBUS, SIGILL,
    SIGSEGV etc. and here we get useless truss.core files. That was my point.

    Alexander.

    >But the integrety towards the parent needs to be maintained, you must
    >not exit without a signal exit status or you get runaway scripts.
    >
    >Martin
    >
    >

    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  • Next message: gunnar.flygt_at_bredband.net: "Problems with ppp and modem"

    Relevant Pages

    • Re: Dangers of intercepting SIGINT?
      ... I used signal(SIGINT,my_handler) to intercept SIGINT. ... it must close it's socket and exit. ... The server process prints various ... in a signal are very limited, you should make things in signal handler ...
      (comp.os.linux.development.apps)
    • Re: Dangers of intercepting SIGINT?
      ... I used signal(SIGINT,my_handler) to intercept SIGINT. ... is there something from the default handler I should include in my ... it must close it's socket and exit. ... The server process prints various ...
      (comp.os.linux.development.apps)
    • Re: Cant stop script with ctrl-c
      ... exit upon receiving a SIGINT if the current command was killed ... by that sigint as well. ... So, if "festival" ignores the sigints, it will not exit. ... Festival doesn't seem to ignore the ctrl-c - it will cancel the word ...
      (comp.unix.shell)
    • Re: Cant stop script with ctrl-c
      ... exit upon receiving a SIGINT if the current command was killed ... by that sigint as well. ... So, if "festival" ignores the sigints, it will not exit. ... I don't know why bash is behaving like that. ...
      (comp.unix.shell)
    • Re: csh/sh SIGINT differences
      ... > SIGINT and SIGQUIT ..." ... You are probably mixing up two issues ... - whether SIGINT (that is especially stty intr) is handed over to ...
      (comp.unix.shell)