Bug 352197 - mips32: mmap2() not wrapped correctly for page size > 4096
Summary: mips32: mmap2() not wrapped correctly for page size > 4096
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.10 SVN
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-03 04:18 UTC by Duncan
Modified: 2016-10-19 17:44 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
interpret offset argument as units of 4096 bytes (895 bytes, patch)
2015-09-03 04:20 UTC, Duncan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan 2015-09-03 04:18:54 UTC
I'm running valgrind on a sigma designs smp8674b (mips32r2), using 16K pages. 

I've found that the mmap2() wrapper multiplies the mmap() offset argument by page size, however this argument is meant to be in units of 4096 bytes. am_do_mmap_NO_NOTIFY()  expects this.

The result is that calls to mmap2() don't pass through the correct offset argument, resulting (depending on the use case) either in the call failing, or doing the wrong thing.

Patch attached to sort the problem out.

Reproducible: Always
Comment 1 Duncan 2015-09-03 04:20:06 UTC
Created attachment 94363 [details]
interpret offset argument as units of 4096 bytes
Comment 2 Petar Jovanovic 2016-10-06 17:50:15 UTC
The patch has been committed as r16026.
Thank you.
Comment 3 Petar Jovanovic 2016-10-06 17:53:08 UTC
This issue can be closed now.
Comment 4 Julian Seward 2016-10-17 16:14:50 UTC
Petar: Duncan: the patch fixes only the mips32 case.  Is the mips64 path
correct, or does that also need to be fixed?
Comment 5 Petar Jovanovic 2016-10-19 17:44:16 UTC
(In reply to Julian Seward from comment #4)
> Petar: Duncan: the patch fixes only the mips32 case.  Is the mips64 path
> correct, or does that also need to be fixed?

There is no path for mmap2() for MIPS64. That syscall is not supported
on MIPS64, as there is no need for it since the offset is already
64-bit.