linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: zhong jiang <zhongjiang@huawei.com>
Cc: akpm@linux-foundation.org, anshuman.khandual@arm.com,
	mst@redhat.com, linux-mm@kvack.org,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH] mm: redefine the MAP_SHARED_VALIDATE to other value
Date: Mon, 8 Jul 2019 11:20:45 +0200	[thread overview]
Message-ID: <20190708092045.GA20617@dhcp22.suse.cz> (raw)
In-Reply-To: <1562573141-11258-1-git-send-email-zhongjiang@huawei.com>

[Cc Dan]

On Mon 08-07-19 16:05:41, zhong jiang wrote:
> As the mman manual says, mmap should return fails when we assign
> the flags to MAP_SHARED | MAP_PRIVATE.
> 
> But In fact, We run the code successfully and unexpected.

What is the code that you are running and what is the code version.

> It is because MAP_SHARED_VALIDATE is introduced and equal to
> MAP_SHARED | MAP_PRIVATE.

This was a deliberate decision IIRC. Have a look at 1c9725974074 ("mm:
introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap
flags").

> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  include/uapi/linux/mman.h                          | 2 +-
>  tools/include/uapi/asm-generic/mman-common-tools.h | 2 +-
>  tools/include/uapi/linux/mman.h                    | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/uapi/linux/mman.h b/include/uapi/linux/mman.h
> index fc1a64c..1d3098e 100644
> --- a/include/uapi/linux/mman.h
> +++ b/include/uapi/linux/mman.h
> @@ -14,7 +14,7 @@
>  
>  #define MAP_SHARED	0x01		/* Share changes */
>  #define MAP_PRIVATE	0x02		/* Changes are private */
> -#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
> +#define MAP_SHARED_VALIDATE 0x04	/* share + validate extension flags */
>  
>  /*
>   * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
> diff --git a/tools/include/uapi/asm-generic/mman-common-tools.h b/tools/include/uapi/asm-generic/mman-common-tools.h
> index af7d0d3..4fc44d2 100644
> --- a/tools/include/uapi/asm-generic/mman-common-tools.h
> +++ b/tools/include/uapi/asm-generic/mman-common-tools.h
> @@ -18,6 +18,6 @@
>  #ifndef MAP_SHARED
>  #define MAP_SHARED	0x01		/* Share changes */
>  #define MAP_PRIVATE	0x02		/* Changes are private */
> -#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
> +#define MAP_SHARED_VALIDATE 0x04	/* share + validate extension flags */
>  #endif
>  #endif // __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H
> diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
> index fc1a64c..1d3098e 100644
> --- a/tools/include/uapi/linux/mman.h
> +++ b/tools/include/uapi/linux/mman.h
> @@ -14,7 +14,7 @@
>  
>  #define MAP_SHARED	0x01		/* Share changes */
>  #define MAP_PRIVATE	0x02		/* Changes are private */
> -#define MAP_SHARED_VALIDATE 0x03	/* share + validate extension flags */
> +#define MAP_SHARED_VALIDATE 0x04	/* share + validate extension flags */
>  
>  /*
>   * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
> -- 
> 1.7.12.4

-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2019-07-08  9:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08  8:05 zhong jiang
2019-07-08  9:20 ` Michal Hocko [this message]
2019-07-08 13:52   ` zhong jiang
2019-07-08 16:43     ` Michal Hocko
2019-07-09  1:52       ` zhong jiang
2019-07-08 14:43 ` Matthew Wilcox
2019-07-09  1:53   ` zhong jiang

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=20190708092045.GA20617@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-mm@kvack.org \
    --cc=mst@redhat.com \
    --cc=zhongjiang@huawei.com \
    /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