Re: [PATCH] nommu: add page_align to mmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bob,

On 05/05/11 20:19, Bob Liu wrote:
On Thu, May 5, 2011 at 9:38 AM, Greg Ungerer<gerg@xxxxxxxxxxxx>  wrote:
On 05/05/11 07:13, Andrew Morton wrote:

On Wed, 27 Apr 2011 15:12:14 +0800
Bob Liu<lliubbo@xxxxxxxxx>  áwrote:

Currently on nommu arch mmap(),mremap() and munmap() doesn't do
page_align()
which is incorrect and not consist with mmu arch.
This patch fix it.


Can you explain this fully please? áWhat was the user-observeable
behaviour before the patch, and after?

And some input from nommu maintainers would be nice.

Its not obvious to me that there is a problem here. Are there
any issues caused by the current behavior that this fixes?


Yes, there is a issue.

Some drivers'  mmap() function depend on (vma->vm_end - vma->start) is
page aligned which is true on mmu arch but not on nommu.
eg: uvc camera driver.

What's more, sometimes I got munmap() error.
The reason is split file: mm/nommu.c
                    do {
1614                         if (start>  vma->vm_start) {
1615                                 kleave(" = -EINVAL [miss]");
1616                                 return -EINVAL;
1617                         }
1618                         if (end == vma->vm_end)
1619                                 goto erase_whole_vma;

<<=====================here
1620                         rb = rb_next(&vma->vm_rb);
1621                         vma = rb_entry(rb, struct vm_area_struct, vm_rb);
1622                 } while (rb);
1623                 kleave(" = -EINVAL [split file]");

Because end is not page aligned (passed into from userspace) while
some unknown reason
vma->vm_end is aligned,  this loop will fail and -EINVAL[split file]
error returned.
But it's hard to reproduce.

And in my opinion consist with mmu alway a better choice.

Thanks for your review.

Ok, makes sense. Can you add some of this writeup to the patch
commit message?

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@xxxxxxxxxxxx
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]