This is the mail archive of the glibc-bugs@sources.redhat.com 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 libc/957] New: endian error in mmap64 for big-endian arm


When using mmap64 with a non-zero offset on a big-endian arm machine, I always    
received EINVAL as return-value. Looking at the assembler-code in   
sysdeps/unix/sysv/linux/arm/mmap64.S the problem seems to be an endian-error:   
   
...   
#ifdef __NR_mmap2   
        ldr     ip, [sp, $4]            @ offset low part   
        str     r5, [sp, #-4]!   
        ldr     r5, [sp, $12]           @ offset high part   
        str     r4, [sp, #-4]!   
        movs    r4, ip, lsl $20         @ check that offset is page-aligned   
        mov     ip, ip, lsr $12   
        moveqs  r4, r5, lsr $12         @ check for overflow   
        bne     .Linval   
...   
   
For big-endian arm machines, the high-part of the 64-bit offset-value should  
be in sp+4, while the low-part is in sp+8. So, the above code always results  
in the detection of an overflow and jumping to .Linval. Changing the code to   
   
        ldr     ip, [sp, $8]            @ offset low part   
        str     r5, [sp, #-4]!   
        ldr     r5, [sp, $8]           @ offset high part   
        str     r4, [sp, #-4]!   
  
fixed the problem for me.

-- 
           Summary: endian error in mmap64 for big-endian arm
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: shenkel at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: armeb-linux


http://sources.redhat.com/bugzilla/show_bug.cgi?id=957

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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