How to ignore SIGSEGV signal

Ask a Question related to UNIX Programming, Design and Development.

  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. Similar Questions and Discussions

    1. unknown sigsegv code 0
      These SIGSEGV signal messages have been determined to be sent from debugging code that was not disabled. Note that all Mac users of CS4 applications,...
    2. DBD::PgSPI crashes the database server (SIGSEGV)?
      Hi, I have tried to use "plperlu" to write server functions to encapsulate some common functionality such as "copy an entity"(and all its...
    3. SIGSEGV in memcpy() when starting a n application
      Hello, I am getting SIGSEGV immedaitely in the initialization of my app. by GDB I see that it happens in memcpy() when starting a n application ...
    4. signal
      /* function declarations */ int func1(void*); int func2(void*); .... int funcn(void*); /* table of names and pointers */ struct { ...
    5. Errno 25 ENOTTY then SIGSEGV, socket on accept call? Help.
      Hi All, I have been scouring newsgroups for ages now trying to find a solution to my problem. Have to resort to posting the question: I am writing...
  3. #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

  4. #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

  5. #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

  6. #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 circumstances 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

  7. #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 circumstances 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

  8. #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 circumstances 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

Posting Permissions

  • You may not post new threads
  • You may 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