linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Hellwig <hch@lst.de>, Linux MM <linux-mm@kvack.org>,
	Jan Kara <jack@suse.cz>, Arnd Bergmann <arnd@arndb.de>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	Linux API <linux-api@vger.kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/2] mm: introduce MAP_VALIDATE, a mechanism for for safely defining new mmap flags
Date: Thu, 31 Aug 2017 18:40:08 -0700	[thread overview]
Message-ID: <CAA9_cmdn3BVjkMTLhcdPqaNcnuPHLjmrG9k4vmpb7bSM8SxpJw@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFwsfUj1f41w8hqt9LN3-ajmJ=2AB1Nb6ZzwHgE1OKxGOw@mail.gmail.com>

On Thu, Aug 31, 2017 at 6:27 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Thu, Aug 31, 2017 at 6:01 PM, Dan Williams <dan.j.williams@intel.com> wrote:
>>
>> Ugh, nommu defeats the MAP_SHARED_VALIDATE proposal from Linus.
>>
>>         if ((flags & MAP_TYPE) != MAP_PRIVATE &&
>>             (flags & MAP_TYPE) != MAP_SHARED)
>>                 return -EINVAL;
>>
>> ...parisc strikes again.
>
> Why? That's no different from the case statement for the mmu case,
> just written differently.
>
> You *want* existing kernels to fail, since they don't test the bits
> you want to test.
>
> So you just want to rewrite these all as
>
>     switch (flags & MAP_TYPE) {
>     case MAP_SHARED_VALIDATE:
>         .. validate the other bits...
>         /* fallhtough */
>     case MAP_SHARED:
>         .. do the shared case ..
>     case MAP_PRIVATE:
>         .. do the private case ..
>     default:
>         return -EINVAL;
>     }
>
> and you're all good.
>
> I'm not seeing the problem.

Right, I went cross-eyed for a second. There is no problem.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-09-01  1:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 23:08 [PATCH 0/2] MAP_VALIDATE and mmap flags validation Dan Williams
2017-08-30 23:08 ` [PATCH 1/2] vfs: add flags parameter to ->mmap() in 'struct file_operations' Dan Williams
2017-08-31 10:02   ` Christoph Hellwig
2017-09-01  0:54     ` Dan Williams
2017-08-30 23:08 ` [PATCH 2/2] mm: introduce MAP_VALIDATE, a mechanism for for safely defining new mmap flags Dan Williams
2017-08-31 10:03   ` Christoph Hellwig
2017-09-01  1:01     ` Dan Williams
2017-09-01  1:27       ` Linus Torvalds
2017-09-01  1:40         ` Dan Williams [this message]
2017-09-01  7:34         ` Christoph Hellwig
2017-08-31 16:49   ` Linus Torvalds
2017-08-31 21:31     ` Dan Williams

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=CAA9_cmdn3BVjkMTLhcdPqaNcnuPHLjmrG9k4vmpb7bSM8SxpJw@mail.gmail.com \
    --to=dan.j.williams@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=luto@kernel.org \
    --cc=torvalds@linux-foundation.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