mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: wzt.wzt@gmail.com
Cc: linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, jmorris@namei.org,
	eparis@parisplace.org
Subject: Re: [RFC][PATCH] Security: fix cap_file_mmap() off-by-one error to avoid kernel null pointer exploit
Date: Thu, 15 Apr 2010 08:12:20 -0400	[thread overview]
Message-ID: <1271333540.3042.17.camel@dhcp235-240.rdu.redhat.com> (raw)
In-Reply-To: <20100415055132.GA3921@localhost.localdomain>

On Thu, 2010-04-15 at 13:51 +0800, wzt.wzt@gmail.com wrote:

NAK

The fix to the comment is fine, but you missed the point ENTIRELY.  The
WHOLE point of being able to set dac_mmap_min_addr == 0 is so you can
disable the protection.  There exist tools (wine and dosemu) which NEED
to map the 0 page.  Thus dac_mmap_min_addr == 0 means the protection is
disabled.  If you don't want to disable the protection, don't disable
it!

-Eric


> ---
>  security/commoncap.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/security/commoncap.c b/security/commoncap.c
> index 6166973..cc6b458 100644
> --- a/security/commoncap.c
> +++ b/security/commoncap.c
> @@ -931,7 +931,7 @@ int cap_vm_enough_memory(struct mm_struct *mm, long pages)
>   * @addr: address attempting to be mapped
>   * @addr_only: unused
>   *
> - * If the process is attempting to map memory below mmap_min_addr they need
> + * If the process is attempting to map memory below dac_mmap_min_addr they need
>   * CAP_SYS_RAWIO.  The other parameters to this function are unused by the
>   * capability security module.  Returns 0 if this mapping should be allowed
>   * -EPERM if not.

A patch with only this change would be fine.

> @@ -942,7 +942,7 @@ int cap_file_mmap(struct file *file, unsigned long reqprot,
>  {
>  	int ret = 0;
>  
> -	if (addr < dac_mmap_min_addr) {
> +	if (addr <= dac_mmap_min_addr) {
>  		ret = cap_capable(current, current_cred(), CAP_SYS_RAWIO,
>  				  SECURITY_CAP_AUDIT);
>  		/* set PF_SUPERPRIV if it turns out we allow the low mmap */

Clearly missed the boat on this one.


  reply	other threads:[~2010-04-15 12:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15  5:51 wzt.wzt
2010-04-15 12:12 ` Eric Paris [this message]
2010-04-15 12:27   ` wzt wzt

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=1271333540.3042.17.camel@dhcp235-240.rdu.redhat.com \
    --to=eparis@redhat.com \
    --cc=eparis@parisplace.org \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=wzt.wzt@gmail.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

all inboxes | Powered by JetHome®