Bug 352197

Summary: mips32: mmap2() not wrapped correctly for page size > 4096
Product: [Developer tools] valgrind Reporter: Duncan <dpalmer>
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: major CC: cpigat242, mips32r2
Priority: NOR    
Version: 3.10 SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: interpret offset argument as units of 4096 bytes

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.