All of lore.kernel.org
 help / color / mirror / Atom feed
From: panand@redhat.com (Pratyush Anand)
To: linux-arm-kernel@lists.infradead.org
Subject: Query: ARM64: A random failure with hugetlbfs linked mmap() of a stack area
Date: Mon, 27 Mar 2017 18:50:53 +0530	[thread overview]
Message-ID: <dfddf8fa-6e61-9d94-46ef-34bad1c8c632@redhat.com> (raw)
In-Reply-To: <20170327121806.GA12578@leverpostej>

Hi Mark,

Thanks a lot for your explanations!!

On Monday 27 March 2017 05:48 PM, Mark Rutland wrote:
> So far, I have not managed to trigger a single SIGSEGV while running
> under GDB.
>
> However, I have a theory that could explain that. I suspect that my
> toolchain has built the binary with an executable stack, while yours has
> not. Linux automatically sets READ_IMPLIES_EXEC for binaries with
> executable stacks, which IIUC would implicitly make the mmap RWX rather
> than RW.
>
> So in my case, the huge page is executable, and I get a SIGILL when
> trying to execute from it. In your case, the huge page is not
> executable, so you get a SIGSEGV.

Yes, your theory seems  convincing.
I passed PROT_EXEC as well along with PROT_READ|PROT_WRITE to mmap(),and 
then I received SIGILL.

[...]

>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0000ffffadb45a44 in __mmap (addr=<optimized out>, len=536870912,
>> prot=3, flags=17, fd=7, offset=0)
> That address falls within libc-2.17.so, which is clobbered by the mmap.
>
> Do you happen to know how to parse that 'prot=3' in the SEGV report? I'm
> guessing that means RW, !X.

Yes, it seems like that.

https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/mman-linux.h;h=8126ce836947718576f09cd8f874a25b2c1340f7;hb=HEAD

~Pratyush

  reply	other threads:[~2017-03-27 13:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 14:21 Query: ARM64: A random failure with hugetlbfs linked mmap() of a stack area Pratyush Anand
2017-03-24 16:15 ` Mark Rutland
2017-03-24 16:41   ` Pratyush Anand
2017-03-24 17:25     ` Mark Rutland
2017-03-24 18:02       ` Pratyush Anand
2017-03-24 18:16         ` Mark Rutland
2017-03-25 12:14           ` Pratyush Anand
2017-03-27 12:18             ` Mark Rutland
2017-03-27 13:20               ` Pratyush Anand [this message]
2017-03-27 17:45                 ` Mark Rutland

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=dfddf8fa-6e61-9d94-46ef-34bad1c8c632@redhat.com \
    --to=panand@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.