All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Waechtler <pwaechtler@mac.com>
To: "EXTERNAL Waechtler Peter (Fa. TCP,
	CM-AI/PJ-CF31)"  <external.Peter.Waechtler@de.bosch.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFD] how to get something like chkspace / kinfo_getvmmap?
Date: Wed, 14 Mar 2012 23:42:24 +0100	[thread overview]
Message-ID: <4F611ED0.3030702@mac.com> (raw)
In-Reply-To: <274124B9C6907D4B8CE985903EAA19E91B2C998E04@SI-MBX06.de.bosch.com>

On 14.03.2012 15:31, EXTERNAL Waechtler Peter (Fa. TCP, CM-AI/PJ-CF31) 
wrote:
> Hi,
>
> for implementing robust exception handlers that print out a backtrace in
> the signal handler, it would be nice to have a syscall to check if a
> memory access would fail.
>
> I know that one can parse /proc/self/maps (like libsigsegv does).
> libunwind employs an addrspace->access_mem() method that does an
> unprotected access because there is no (easy) way on Linux.
>
>
> How about enhancing mincore() with a few bits that tells the caller how
> the protection bits are?
> The main use case is in an embedded system to avoid that the handler
> (already running on an alternate signal stack) faults if the stack pointer
> achieved to point into the guard page - causing backtrace() to fail.
>
> mincore() on FreeBSD provides some more bits, but still the access bits
> are missing.
>
>       MINCORE_INCORE            Page is in core (resident).
>       MINCORE_REFERENCED        Page has been referenced by us.
>       MINCORE_MODIFIED          Page has been modified by us.
>       MINCORE_REFERENCED_OTHER  Page has been referenced.
>       MINCORE_MODIFIED_OTHER    Page has been modified.
>       MINCORE_SUPER             Page is part of a "super" page. (only i386&
>                                 amd64)
>
> add
>
>          MINCORE_PROT_W
>          MINCORE_PROT_R
>          MINCORE_PROT_X

Well, I guess some code will help?

This will also help in recognizing a guard page, for a clear and 
unambiguous:
"stack overflow" in multi-threaded programs.

     Peter


      reply	other threads:[~2012-03-14 23:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 14:31 [RFD] how to get something like chkspace / kinfo_getvmmap? EXTERNAL Waechtler Peter (Fa. TCP, CM-AI/PJ-CF31)
2012-03-14 22:42 ` Peter Waechtler [this message]

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=4F611ED0.3030702@mac.com \
    --to=pwaechtler@mac.com \
    --cc=external.Peter.Waechtler@de.bosch.com \
    --cc=linux-kernel@vger.kernel.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.