linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "Soni \"They/Them\" L." <fakedme@gmail.com>
Cc: linux-api@vger.kernel.org
Subject: Re: mprotect PROT_SIGNAL
Date: Tue, 16 Jul 2024 17:13:22 +0200	[thread overview]
Message-ID: <87ikx5z7xp.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <f01d236a-e713-4953-be8b-1484201f8190@gmail.com> (Soni L.'s message of "Tue, 9 Jul 2024 13:44:36 -0300")

* Soni L.:

> we'd like an mprotect PROT_SIGNAL flag for a compiler we're making
>
> PROT_SIGNAL - marks the pages as unmapped while running signal handlers
>
> this would be very useful, do you think you could provide it?
>
> (not much more to say about it, it's supposed to do what it says on
> the tin, we want to unmap pages in signal handlers so as to catch bugs
> without causing memory corruption.)

The challenge is going to be to detect abnormal exit from the signal
handler.

You can already get some of this behavior to today with memory
protection keys, on x86-64 at least.  (I consider this a glitch in the
implementation, it makes it less useful.)  Access is revoked
automatically when the hander is invoked.  However, access is not
restored if you jump out of the handler using longjmp or by throwing an
exception.

Thanks,
Florian


  reply	other threads:[~2024-07-16 15:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 16:44 mprotect PROT_SIGNAL Soni "They/Them" L.
2024-07-16 15:13 ` Florian Weimer [this message]
2024-07-16 16:16   ` Soni "They/Them" L.

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=87ikx5z7xp.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=fakedme@gmail.com \
    --cc=linux-api@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).