This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/21908] dynamic linker broke on ia64 (mmap2 consolidation is the suspect)


https://sourceware.org/bugzilla/show_bug.cgi?id=21908

--- Comment #7 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
I was puzzled why for ia64 and m68k the mmap2 is not working on multiple of 4K
as for other arches (for instance powerpc) and it seems indeed that for ia64
and m68k the underlying semantic of mmap2 is indeed dependent of kernel
PAGE_SHIFT definition.  For instance, m68k mmap2 implementation:

arch/m68k/kernel/sys_m68k.c:

 39 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
 40         unsigned long prot, unsigned long flags,
 41         unsigned long fd, unsigned long pgoff)
 42 {
 43         /*
 44          * This is wrong for sun3 - there PAGE_SIZE is 8Kb,
 45          * so we need to shift the argument down by 1; m68k mmap64(3)
 46          * (in libc) expects the last argument of mmap2 in 4Kb units.
 47          */
 48         return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
 49 }

And ia64:

arch/ia64/kernel/sys_ia64.c

133 /*
134  * mmap2() is like mmap() except that the offset is expressed in units
135  * of PAGE_SIZE (instead of bytes).  This allows to mmap2() (pieces
136  * of) files that are larger than the address space of the CPU.
137  */
138 asmlinkage unsigned long
139 sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int
fd, long pgoff)
140 {
141         addr = sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
142         if (!IS_ERR((void *) addr))
143                 force_successful_syscall_return();
144         return addr;
145 }

While for powerpc it adjusts the pgoff to be independent of PAGE_SHIFT:

arch/powerpc/kernel/syscalls.c

 65 SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
 66                 unsigned long, prot, unsigned long, flags,
 67                 unsigned long, fd, unsigned long, pgoff)
 68 {
 69         return do_mmap2(addr, len, prot, flags, fd, pgoff, PAGE_SHIFT-12);
 70 }

I will send a patch upstream fixing it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]