linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: "Michael Kerrisk (man-pages)"
	<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	dave-gkUM19QKKo4@public.gmane.org
Cc: Dave Hansen <dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH] [RFCv3] add manpages for Memory Protection Keys
Date: Fri, 3 Jun 2016 13:26:08 -0700	[thread overview]
Message-ID: <5751E7E0.5070001@intel.com> (raw)
In-Reply-To: <2c4a4bff-7907-9c2d-389a-5bf987a14ad6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 06/03/2016 12:35 PM, Michael Kerrisk (man-pages) wrote:
>> > So, I have a suggestion. How about tightening the constraint here, so
>> > that only one of these flags is allowed for now. (EINVAL if both
>> > are specified.) That constraint could always be relaxed later , if
>> > desired, and adding it now may allow some wriggle room later in terms
>> > of modifying the API or allowing for different architectural choices.
> Another reason to give an error for this case: if the user does
> this, they were probably confused. An error let's them know
> they did something nonsensical...

The real benefit of doing it this way is that it allows applications to
add or remove write or access permissions independently of what the
previous permissions were.

For instance, I would expect code to be structured with pairs of
enable/disable operations, like:

int read_something(void)
{
	int ret;
	pkey_access_enable(pkey);
	ret = *some_pkey_memory; // Is this readable or writable?
	pkey_access_disable(pkey);
	return ret;
}

If we do what you suggest, we need to have the program keep extra state
about whether the 'some_pkey_memory' should be write-disabled once
access-enabled.  If we leave it as-is, we get the benefit of the
PKRU[].WD disable bit to do this for us.

In other words, if an application does a pkey_write_disable(), the app
can reasonably expect that *no* writes will be allowed until the app
does a pkey_write_enable().
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2016-06-03 20:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1464826600-17110-1-git-send-email-dave.hansen@intel.com>
     [not found] ` <1464826600-17110-1-git-send-email-dave.hansen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-06-03  0:25   ` [PATCH] [RFCv3] add manpages for Memory Protection Keys Michael Kerrisk (man-pages)
     [not found]     ` <647d23bf-a163-deee-d0ec-f961ecfb0b90-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-03 14:53       ` Dave Hansen
     [not found]         ` <57519A04.5020700-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-06-03 19:25           ` Michael Kerrisk (man-pages)
     [not found]             ` <d5ce21ad-ec2c-5a56-dde2-7cbd62dd2c49-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-03 19:35               ` Michael Kerrisk (man-pages)
     [not found]                 ` <2c4a4bff-7907-9c2d-389a-5bf987a14ad6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-03 20:26                   ` Dave Hansen [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=5751E7E0.5070001@intel.com \
    --to=dave.hansen-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dave-gkUM19QKKo4@public.gmane.org \
    --cc=dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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).