Professional Web Applications Themes

How to ignore SIGSEGV signal - UNIX Programming

hi there, how to ignore SIGSEGV signal, 'cause i tried to handle or ignore that signal on the code but it keep raised signal. is this one-shot signal? any ideas.? i used siganl or sigaction both of'em cheers....

  1. #1

    Default How to ignore SIGSEGV signal

    hi there,

    how to ignore SIGSEGV signal, 'cause i tried to handle or ignore that
    signal on the code but it keep raised signal. is this one-shot signal?
    any ideas.?

    i used siganl or sigaction both of'em

    cheers.
    jason Guest

  2. #2

    Default Re: How to ignore SIGSEGV signal

    [email]iryna7@yahoo.com[/email] (jason) writes:
    > how to ignore SIGSEGV signal, 'cause i tried to handle or ignore
    > that signal on the code but it keep raised signal. is this one-shot
    > signal? any ideas.?
    Don't ignore that. Once you get SIGSEGV, nothing can be relied on in
    your program. Just let it core dump, and figure out the problem from
    there.

    Joe
    --
    There are 10 kinds of engineers, those who understand binary and those
    who don't.

    joe@invalid.address Guest

  3. #3

    Default Re: How to ignore SIGSEGV signal


    "jason" <iryna7@yahoo.com> wrote in message
    news:7247d407.0307211636.386f8d8e@posting.google.c om...
    > hi there,
    > how to ignore SIGSEGV signal, 'cause i tried to handle or ignore that
    > signal on the code but it keep raised signal. is this one-shot signal?
    > any ideas.?
    > i used siganl or sigaction both of'em
    I'm puzzled why you'd want to ignore a SIGSEGV signal. If you could do
    it, you would have changed nothing, so whatever generated the SIGSEGV would
    just generate another one, which you'd also ignore, ad infinitum.

    If your SIGSEGV handler can eliminate the cause of the SIGSEGV, you can
    continue execution. But with no handler, you'd be in an infinite loop.

    What are you trying to do?

    DS


    David Schwartz Guest

  4. #4

    Default Re: How to ignore SIGSEGV signal

    On 21 Jul 2003 17:36:00 -0700, jason <iryna7@yahoo.com> wrote:
    > hi there,
    >
    > how to ignore SIGSEGV signal, 'cause i tried to handle or ignore that
    > signal on the code but it keep raised signal. is this one-shot signal?
    > any ideas.?
    >
    > i used siganl or sigaction both of'em
    >
    > cheers.
    >
    For this signal and a few others that can be generated by a fault detected
    by hardware, if they are genuinely generated by a fault, as opposed to
    being generated synthetically by, say, kill, a special rule applies: You
    can catch them or ignore them, but one thing you can't do it execute the
    instruction that follows the one that caused the fault. In other words,
    returning from a signal handler or a direct SIG_IGN both result in program
    termination.

    --Marc
    Marc Rochkind Guest

  5. #5

    Default Re: How to ignore SIGSEGV signal

    On Mon, 21 Jul 2003 21:15:43 -0700, "David Schwartz"
    <davids@webmaster.com> wrote:
    >
    >"Marc Rochkind" <rochkind@basepath.com> wrote in message
    >news:oprsoyjezvojfyi9@den.news.speakeasy.net...
    >
    >> For this signal and a few others that can be generated by a fault detected
    >> by hardware, if they are genuinely generated by a fault, as opposed to
    >> being generated synthetically by, say, kill, a special rule applies: You
    >> can catch them or ignore them, but one thing you can't do it execute the
    >> instruction that follows the one that caused the fault. In other words,
    >> returning from a signal handler or a direct SIG_IGN both result in program
    >> termination.
    >
    > Really? Even if you reset the signal handler?
    I think it depends on the implementation. In some cases, if we return
    from the handler, then the signal is again delivered, and so on...
    > My understanding about what's supposed to happen is that when you return
    >from the signal handler, it should resume executing exactly where it
    >stopped, thus generating another segmentation violation. This allows code to
    >'fix' the cirstances that caused the segmentation violation (if it can
    >and wants to) and then resume execution.
    If one wants to continue execution, a more typical approach I
    think would be to longjmp() somewhere else, thus side-stepping
    the faulting instruction.
    > Obviously, that's not going to be portable.
    Not necesarily unportable though - for example, if the SIGSEGV
    is caused by a memory protection violation, we could use mprotect()
    to repair the error and then return (though mprotect() isn't in
    SUSv3's list of async-signal-safe funtions...).

    Cheers,

    Michael
    Michael Kerrisk Guest

  6. #6

    Default Re: How to ignore SIGSEGV signal


    "Michael Kerrisk" <michael.kerrisk@freenet.de> wrote in message
    news:r5kphvok3ucgkmr4l0evcr7j99474kophb@4ax.com...
    > > My understanding about what's supposed to happen is that when you
    return
    > >from the signal handler, it should resume executing exactly where it
    > >stopped, thus generating another segmentation violation. This allows code
    to
    > >'fix' the cirstances that caused the segmentation violation (if it can
    > >and wants to) and then resume execution.
    > If one wants to continue execution, a more typical approach I
    > think would be to longjmp() somewhere else, thus side-stepping
    > the faulting instruction.
    Unless one can repait the 'problem' by calling 'mmap' or 'mprotect' or
    even by modifying the code.
    > > Obviously, that's not going to be portable.
    > Not necesarily unportable though - for example, if the SIGSEGV
    > is caused by a memory protection violation, we could use mprotect()
    > to repair the error and then return (though mprotect() isn't in
    > SUSv3's list of async-signal-safe funtions...).
    You can even, unportably of course, build your own jmp_buf to jump past
    the faulting instruction after doing whatever processing is required.

    One typical application of this is optimizing spinlocks for UP machines
    on x86. In the initial spinlock code, you specifically put an illegal
    instruction where the LOCK prefix would go. In the SIGILL handler, you
    replace the illegal instruction with either a LOCK prefix or a nop,
    depending upon whether you're on a UP or SMP machine.

    DS


    David Schwartz Guest

  7. #7

    Default Re: How to ignore SIGSEGV signal

    On Mon, 21 Jul 2003 21:15:43 -0700, David Schwartz <davids@webmaster.com>
    wrote:
    >
    > "Marc Rochkind" <rochkind@basepath.com> wrote in message
    > news:oprsoyjezvojfyi9@den.news.speakeasy.net...
    >
    >> For this signal and a few others that can be generated by a fault
    >> detected
    >> by hardware, if they are genuinely generated by a fault, as opposed to
    >> being generated synthetically by, say, kill, a special rule applies: You
    >> can catch them or ignore them, but one thing you can't do it execute the
    >> instruction that follows the one that caused the fault. In other words,
    >> returning from a signal handler or a direct SIG_IGN both result in
    >> program
    >> termination.
    >
    > Really? Even if you reset the signal handler?
    >
    > My understanding about what's supposed to happen is that when you return
    > from the signal handler, it should resume executing exactly where it
    > stopped, thus generating another segmentation violation. This allows code
    > to
    > 'fix' the cirstances that caused the segmentation violation (if it can
    > and wants to) and then resume execution.
    >
    > Obviously, that's not going to be portable.
    >
    > DS
    >
    >
    >
    I was overly specific... all the standard says is that the behavior is
    undefined.

    --Marc
    Marc Rochkind Guest

Similar Threads

  1. unknown sigsegv code 0
    By jamie_hurt@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 10
    Last Post: February 7th, 01:11 AM
  2. DBD::PgSPI crashes the database server (SIGSEGV)?
    By Zhamak Dehghani in forum PERL Modules
    Replies: 0
    Last Post: October 26th, 07:08 AM
  3. SIGSEGV in memcpy() when starting a n application
    By Sting in forum UNIX Programming
    Replies: 3
    Last Post: July 27th, 08:50 AM
  4. signal
    By DL in forum UNIX Programming
    Replies: 0
    Last Post: July 11th, 02:05 AM
  5. Errno 25 ENOTTY then SIGSEGV, socket on accept call? Help.
    By Lee Tracey in forum UNIX Programming
    Replies: 3
    Last Post: July 4th, 01:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139