public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Breno Leitao <brenohl@br•ibm.com>
To: linuxppc-dev@lists•ozlabs.org
Cc: Gustavo Bueno Romero <gromero@br•ibm.com>
Subject: Different SIGSEGV codes (x86 and ppc64le)
Date: Tue, 19 Jan 2016 18:49:25 -0200	[thread overview]
Message-ID: <569EA155.5070602@br.ibm.com> (raw)

During some debugging, we found that during a stack overflow, the SIGSEGV code
returned is different on Power and Intel.

We were able to narrow down the test case to the follow simple code:

  https://github.com/leitao/stack/blob/master/overflow.c

On Power, the SIGSEV si->si_code is 2 (SEGV_ACCERR) , meaning "access error". On
the other way around, the same test on x86 returns si->si_code = 1 (SEGV_MAPERR),
meaning "invalid permission". Any idea why such difference?

Example:

Power
-----
  $  gcc overflow.c
  $  ./a.out
  Got SIGSEGV(2) at address: 0x3fffdd90ffe0


x86
---
  $ gcc overflow.c
  $ ./a.out
  Got SIGSEGV(1) at address: 0x7fff9f089fe8


Thank you!
Breno

             reply	other threads:[~2016-01-19 20:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19 20:49 Breno Leitao [this message]
2016-01-19 21:10 ` Different SIGSEGV codes (x86 and ppc64le) Gustavo Bueno Romero
2016-01-20  5:34 ` Michael Ellerman
2016-01-20 18:21   ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=569EA155.5070602@br.ibm.com \
    --to=brenohl@br$(echo .)ibm.com \
    --cc=gromero@br$(echo .)ibm.com \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox