[uClibc 0002454]: Fixing ARM EABI support bug in syscall()

bugs at busybox.net bugs at busybox.net
Fri Oct 3 15:04:31 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=2454 
====================================================================== 
Reported By:                Joe Lin
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   2454
Category:                   Architecture Specific
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             03-06-2008 04:12 PST
Last Modified:              10-03-2008 08:04 PDT
====================================================================== 
Summary:                    Fixing ARM EABI support bug in syscall()
Description: 
When making an EABI syscall() system call, the library does not correctly
pass requesting system number to the Linux kernel.

For example, the ping facility in Busybox will issue a syscall() to get
monotonic time (see monotonic_us() in libbb/time.c). The syscall() in
syscall-eabi.S passes R7 value verbatim. But the kernel (see linux's
vector_swi routine in arch/arm/kernel/entry-common.S) expects R7 a number
without __NR_SYSCALL_BASE.

This bug caused a Segmentation Fault.

Below is the patch.

--------------------------------------------------------------
diff -Naurd uClibc-0.9.29/libc/sysdeps/linux/arm/syscall-eabi.S
uClibc-0.9.29-p1/libc/sysdeps/linux/arm/syscall-eabi.S
--- uClibc-0.9.29/libc/sysdeps/linux/arm/syscall-eabi.S 2006-02-11
12:29:52.000000000 +0800
+++ uClibc-0.9.29-p1/libc/sysdeps/linux/arm/syscall-eabi.S      2008-03-06
19:53:15.000000000 +0800
@@ -29,7 +29,7 @@
 syscall:
        mov     ip, sp
        stmfd   sp!, {r4, r5, r6, r7}
-       mov     r7, r0
+       sub     r7, r0, #SYS_SYSCALL_BASE
        mov     r0, r1
        mov     r1, r2
        mov     r2, r3
--------------------------------------------------------------
====================================================================== 

---------------------------------------------------------------------- 
 khem - 04-09-08 00:07  
---------------------------------------------------------------------- 
is your kernel compiled with AEABI ?
Are you compiling uclibc also with EABI turned on in toolchain ? 

---------------------------------------------------------------------- 
 Joe Lin - 04-09-08 19:22  
---------------------------------------------------------------------- 
Yes, I compiled both kernel and uClibc with EABI turned on. If uClibc was
compiled in OABI, it would go through different path in kernel, which got
no problem. If kernel was not compiled to process EABI executables, EABI
programs would not work. 

---------------------------------------------------------------------- 
 khem - 04-10-08 19:12  
---------------------------------------------------------------------- 
I do not get segmentation fault on using busybox applet ping. 

---------------------------------------------------------------------- 
 Joe Lin - 04-13-08 18:39  
---------------------------------------------------------------------- 
No segmentation fault? My code runs with the patch ok, which means it
should get the fault if without the patch.

I'll take a time to review the exact point of problem using my hardware
ICE. For now I just can't remember where the instruction is in the
arch/arm/kernel/entry-common.S. Will report the point then. 

---------------------------------------------------------------------- 
 bernhardf - 10-03-08 08:04  
---------------------------------------------------------------------- 
Any update? 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
03-06-08 04:12  Joe Lin        New Issue                                    
03-06-08 04:12  Joe Lin        Status                   new => assigned     
03-06-08 04:12  Joe Lin        Assigned To               => uClibc          
04-09-08 00:07  khem           Note Added: 0006484                          
04-09-08 19:22  Joe Lin        Note Added: 0006504                          
04-10-08 19:12  khem           Note Added: 0006554                          
04-13-08 18:39  Joe Lin        Note Added: 0006604                          
10-03-08 08:04  bernhardf      Note Added: 0012664                          
======================================================================




More information about the uClibc-cvs mailing list