9aa97968ed
* mem.c (sys_old_mmap): For Ia64 and 32-bit personality of x86-64, copy narrow parameters from userspace by single umove, not by six separate ones; then assign them to long u_arg[i]. For SH[64], avoid copying of tcp->u_arg. (sys_mmap): Add FIXME comment - SH64 and i386 seem to be handled differently for no apparent reason. * test/mmap_offset_decode.c: New test program, illustrates FIXME. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* Should strace show byte or page offsets in mmap syscalls
|
|
* which take page offset parameters?
|
|
*
|
|
* At the time of writing, sys_mmap() converts page to byte offsets,
|
|
* but only for SH64! But this routine is used on i386 too - by mmap2 syscall,
|
|
* which uses page offsets too. As it stands now, SH64 and i386 are inconsistent.
|
|
*
|
|
* sys_old_mmap() is used for old mmap syscall, which uses byte offset -
|
|
* should be ok.
|
|
* sys_mmap64() is currently buggy (should print bogus offset, but I can't
|
|
* test it right now. What arch/bitness invokes sys_mmap64?)
|
|
*
|
|
* This program is intended for testing what strace actually shows. Usage:
|
|
* $ gcc test/mmap_offset_decode.c -o mmap_offset_decode -static
|
|
* $ strace ./mmap_offset_decode
|
|
*
|
|
* As of today (2011-08), on i386 strace prints page offset.
|
|
*/
|
|
|
|
#define _LARGEFILE_SOURCE
|
|
#define _LARGEFILE64_SOURCE
|
|
#define _FILE_OFFSET_BITS 64
|
|
#include <sys/mman.h>
|
|
#include <errno.h>
|
|
int main()
|
|
{
|
|
/* 0x1000 is meant to be page size multiplier */
|
|
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
|
|
0x7fff0000LL * 0x1000);
|
|
return errno != 0;
|
|
}
|