[#5446] BUG() in nommu.c add_nommu_region() when using ALSA mmap
Submitted By: Peter Meerwald
Open Date
2009-08-17 13:20:30 Close Date
2009-12-04 01:08:25
Priority:
Medium Assignee:
Graf Yang
Status:
Closed Fixed In Release:
N/A
Found In Release:
snaps Release:
Category:
N/A Board:
N/A
Processor:
ALL Silicon Revision:
Is this bug repeatable?:
Yes Resolution:
Fixed
Uboot version or rev.:
Toolchain version or rev.:
svn
App binary format:
N/A
Summary: BUG() in nommu.c add_nommu_region() when using ALSA mmap
Details:
I get a BUG() in nommu.c add_nommu_region(), line 534 when using ALSA (e.g. with linphone)
the BUG() is caused by the following code in nommu.c, do_mmap_pgoff(), see XXX comments:
/* obtain the address at which to make a shared mapping
* - this is the hook for quasi-memory character devices to
* tell us the location of a shared mapping
*/
if (file && file->f_op->get_unmapped_area) {
// XXX this calls dummy_get_unmapped_area() in pcm_native.c which just returns 0
addr = file->f_op->get_unmapped_area(file, addr, len,
pgoff, flags);
if (IS_ERR((void *) addr)) {
ret = addr;
if (ret != (unsigned long) -ENOSYS)
goto error_just_free;
/* the driver refused to tell us where to site
* the mapping so we'll have to attempt to copy
* it */
ret = (unsigned long) -ENODEV;
if (!(capabilities & BDI_CAP_MAP_COPY))
goto error_just_free;
capabilities &= ~BDI_CAP_MAP_DIRECT;
} else {
//XXX here we let the region start at zero which is incorrect
vma->vm_start = region->vm_start = addr;
vma->vm_end = region->vm_end = addr + len;
}
}
}
vma->vm_region = region;
/* set up the mapping */
if (file && vma->vm_flags & VM_SHARED)
// XXX there the vma is changed, but not the region
// XXX we end up with a vma which is not within the region (!!)
ret = do_mmap_shared_file(vma);
else
ret = do_mmap_private(vma, region, len);
if (ret < 0)
goto error_put_region;
add_nommu_region(region);
I'm not sure how to best fix this; one way is to implement dummy_get_unmapped_area() such that it return the correct address -- this approach can also be seen here: http://mailman.alsa-project.org/pipermail/alsa-devel/2009-March/015802.html (I'm not sure what happened with the patch)
alternatively, one can correct the region after do_mmap_shared_file() using the data from vma
Follow-ups
--- Graf Yang 2009-09-25 03:27:17
I have checked in a patch to fix this bug.
Mainline will fix it also.
--- Robin Getz 2009-09-25 10:04:06
Graf:
I think mainline (David H) said your patch was wrong, and I didn't see any
follow up from you on this.
I don't think this is fixed/closed yet...
Please follow up on the mailing list.
On Thu 24 Sep 2009 08:29, David Howells pondered:
> <graff.yang@gmail.com> wrote:
>
> > Due to the new vm_region codes, mmap will failed if it is
MAP_PRIVATE,
> > or the get_unmapped_area() not do actual things.
>
> Hmmm... Seems one of my debugging patches had a work around for this -
> all it did was #ifdef-out the first if-statement in do_mmap_private().
> That, however, prevents XIP.
>
> Sadly, your patch doesn't completely fix the problem either. The BUG in
> add_nommu_region() barks.
>
> Let me poke at it some more.
>
> David
--- Mike Frysinger 2009-09-25 13:01:38
true, but there isnt much for us to do but wait for David. he didnt say the
proposed change was wrong as much as it was incomplete. until he fixes it,
keeping this in our tree is OK i think.
--- Michael Hennerich 2009-09-25 14:26:05
Agreed -
No BUG()s barking for me in mm/nommu -
this patch fixed all the problems I've been aware of.
And didn't add new ones...
--- Graf Yang 2009-09-26 23:06:18
David had sent out his own patch, and is merged into mainline.
Now the memory map address should be got from get_unmapped_area().
I think I will add it to our fb driver later.
--- Mike Frysinger 2009-09-26 23:13:59
are you talking about this commit ?
NOMMU: Fix MAP_PRIVATE mmap() of objects where the data can be mapped directly
--- Graf Yang 2009-09-27 00:18:29
yes,
[merged] nommu-fix-map_private-mmap-of-objects-where-the-data-can-be-mapped
directly.patch removed from -mm tree
commit a190887b58c32d19c2eee007c5eb8faa970a69ba
--- Mike Frysinger 2009-09-27 02:30:54
ok, ive merged the two commits David has put into mainline
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
No Files Were Found