mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Jan Beulich" <JBeulich@suse.com>
Cc: <davem@davemloft.net>, <adobriyan@gmail.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fix proc_reg_get_unmapped_area()
Date: Wed, 16 Oct 2013 13:40:44 -0700	[thread overview]
Message-ID: <20131016134044.d1bd8004f4fb94df405a541d@linux-foundation.org> (raw)
In-Reply-To: <525E957802000078000FB6FE@nat28.tlf.novell.com>

On Wed, 16 Oct 2013 12:32:40 +0100 "Jan Beulich" <JBeulich@suse.com> wrote:

> Commit c4fe24485729fc2cbff324c111e67a1cc2f9adea ("sparc: fix PCI device
> proc file mmap(2)"), while fixing one problem, introduced two new ones:
> - the function truncates the return value from ->get_unmapped_area() on
>   64-bit architectures,
> - _all_ descendants are now required to set .get_unmapped_area to non-
>   NULL, which wasn't necessary before (and shouldn't be).
> 
> Both - afaict - are a result from a too simplistic copy'n'paste from
> proc_reg_mmap() done in that change.
> 
> This likely also addresses reports like the one at
> http://linux-kernel.2935.n7.nabble.com/mmap-for-proc-vmcore-broken-since-3-12-rc1-td729326.html.
> 
> ...
>
> --- 3.12-rc5/fs/proc/inode.c
> +++ 3.12-rc5-proc-get-unmapped-area/fs/proc/inode.c
> @@ -288,12 +288,12 @@ static int proc_reg_mmap(struct file *fi
>  static unsigned long proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags)
>  {
>  	struct proc_dir_entry *pde = PDE(file_inode(file));
> -	int rv = -EIO;
> -	unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
> +	unsigned long rv = -EIO;
> +
>  	if (use_pde(pde)) {
> -		get_unmapped_area = pde->proc_fops->get_unmapped_area;
> -		if (get_unmapped_area)
> -			rv = get_unmapped_area(file, orig_addr, len, pgoff, flags);
> +		rv = (pde->proc_fops->get_unmapped_area
> +		      ?: current->mm->get_unmapped_area)(file, orig_addr, len,
> +							 pgoff, flags);
>  		unuse_pde(pde);
>  	}
>  	return rv;

I think these two patches will address the problems:

http://ozlabs.org/~akpm/mmots/broken-out/procfs-fix-unintended-truncation-of-returned-mapped-address.patch
http://ozlabs.org/~akpm/mmots/broken-out/procfs-call-default-get_unmapped_area-on-mmu-present-architectures.patch

I'll be sending those Linuswards today.  Please check them.  (I think
your version would break the nommu build).


  reply	other threads:[~2013-10-16 20:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16 11:32 Jan Beulich
2013-10-16 20:40 ` Andrew Morton [this message]
2013-10-17  7:23   ` Jan Beulich
2013-10-17  8:36     ` HATAYAMA Daisuke
2013-10-17  9:16       ` Jan Beulich

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=20131016134044.d1bd8004f4fb94df405a541d@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=JBeulich@suse.com \
    --cc=adobriyan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®