From: James Morris <jmorris@namei.org>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org, sds@tycho.nsa.gov,
selinux@tycho.nsa.gov, alan@redhat.com, chrisw@redhat.com,
hpa@zytor.com, akpm@linux-foundation.org
Subject: Re: [PATCH 2/3] mmap: round mmap hint address above mmap_min_addr
Date: Sat, 17 Nov 2007 08:42:26 +1100 (EST) [thread overview]
Message-ID: <Xine.LNX.4.64.0711170841200.22208@us.intercode.com.au> (raw)
In-Reply-To: <1195246486.2924.87.camel@localhost.localdomain>
On Fri, 16 Nov 2007, Eric Paris wrote:
> +#ifdef CONFIG_SECURITY
> + /*
> + * If a hint addr is less than mmap_min_addr change addr to be as
> + * low as possible but still greater than mmap_min_addr
> + */
> + if (!(flags & MAP_FIXED) && ((void *)addr != NULL) &&
> + (addr < mmap_min_addr))
> + addr = PAGE_ALIGN(mmap_min_addr);
> +#endif
Please make this a static inline which is optimized away with
!CONFIG_SECURITY.
> +
> error = arch_mmap_check(addr, len, flags);
> if (error)
> return error;
> diff --git a/mm/nommu.c b/mm/nommu.c
> index 35622c5..ea4d20a 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -829,6 +829,16 @@ unsigned long do_mmap_pgoff(struct file *file,
> void *result;
> int ret;
>
> +#ifdef CONFIG_SECURITY
> + /*
> + * If a hint addr is less than mmap_min_addr change addr to be as
> + * low as possible, but still greater than mmap_min_addr
> + */
> + if (!(flags & MAP_FIXED) && ((void *)addr != NULL) &&
> + (addr < mmap_min_addr))
> + addr = PAGE_ALIGN(mmap_min_addr);
> +#endif
> +
> /* decide whether we should attempt the mapping, and if so what sort of
> * mapping */
> ret = validate_mmap_request(file, addr, len, prot, flags, pgoff,
>
>
--
James Morris
<jmorris@namei.org>
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
WARNING: multiple messages have this Message-ID (diff)
From: James Morris <jmorris@namei.org>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org, sds@tycho.nsa.gov,
selinux@tycho.nsa.gov, alan@redhat.com, chrisw@redhat.com,
hpa@zytor.com, akpm@linux-foundation.org
Subject: Re: [PATCH 2/3] mmap: round mmap hint address above mmap_min_addr
Date: Sat, 17 Nov 2007 08:42:26 +1100 (EST) [thread overview]
Message-ID: <Xine.LNX.4.64.0711170841200.22208@us.intercode.com.au> (raw)
In-Reply-To: <1195246486.2924.87.camel@localhost.localdomain>
On Fri, 16 Nov 2007, Eric Paris wrote:
> +#ifdef CONFIG_SECURITY
> + /*
> + * If a hint addr is less than mmap_min_addr change addr to be as
> + * low as possible but still greater than mmap_min_addr
> + */
> + if (!(flags & MAP_FIXED) && ((void *)addr != NULL) &&
> + (addr < mmap_min_addr))
> + addr = PAGE_ALIGN(mmap_min_addr);
> +#endif
Please make this a static inline which is optimized away with
!CONFIG_SECURITY.
> +
> error = arch_mmap_check(addr, len, flags);
> if (error)
> return error;
> diff --git a/mm/nommu.c b/mm/nommu.c
> index 35622c5..ea4d20a 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -829,6 +829,16 @@ unsigned long do_mmap_pgoff(struct file *file,
> void *result;
> int ret;
>
> +#ifdef CONFIG_SECURITY
> + /*
> + * If a hint addr is less than mmap_min_addr change addr to be as
> + * low as possible, but still greater than mmap_min_addr
> + */
> + if (!(flags & MAP_FIXED) && ((void *)addr != NULL) &&
> + (addr < mmap_min_addr))
> + addr = PAGE_ALIGN(mmap_min_addr);
> +#endif
> +
> /* decide whether we should attempt the mapping, and if so what sort of
> * mapping */
> ret = validate_mmap_request(file, addr, len, prot, flags, pgoff,
>
>
--
James Morris
<jmorris@namei.org>
next prev parent reply other threads:[~2007-11-16 21:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-16 20:54 [PATCH 2/3] mmap: round mmap hint address above mmap_min_addr Eric Paris
2007-11-16 20:54 ` Eric Paris
2007-11-16 21:42 ` James Morris [this message]
2007-11-16 21:42 ` James Morris
2007-11-16 21:49 ` Eric Paris
2007-11-16 21:49 ` Eric Paris
2007-11-16 21:55 ` James Morris
2007-11-16 21:55 ` James Morris
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=Xine.LNX.4.64.0711170841200.22208@us.intercode.com.au \
--to=jmorris@namei.org \
--cc=akpm@linux-foundation.org \
--cc=alan@redhat.com \
--cc=chrisw@redhat.com \
--cc=eparis@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/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.