[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#520034: linux-2.6: inexistant syscalls return wrong errno on mips/mipsel



Package: linux-2.6
Version: 2.6.18.dfsg.1-24
Severity: critical
Tags: patch
Justification: breaks unrelated software

Uninexistant syscalls on mips/mipsel return -ENOSYS errno instead of 
ENOSYS. Moreover in some cases it even returns EINVAL instead of ENOSYS.
This make userland software like glibc or coreutils unable to detect 
that the syscall does not exist and implement a fallback, which leads
to breakage like 'touch' not working anymore.

This is especially true for lenny running with a kernel from etch, and
will become more true with sid with a kernel from lenny as the glibc 
version increases.

This has been fixed in kernel 2.6.28, so kernels from etch, etchnhalf
and lenny are affected. The patch series below applies for all of 
them.


commit bda8229bdd087167f463ad5e74299987924f8137
Author: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date:   Sat Oct 25 01:17:22 2008 +0900

    MIPS: Set positive error number to errno on illegal_syscall
    
    Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 5e75a31..ffa23bd 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -180,7 +180,7 @@ bad_stack:
 	 * The system call does not exist in this kernel
 	 */
 illegal_syscall:
-	li	v0, -ENOSYS			# error
+	li	v0, ENOSYS			# error
 	sw	v0, PT_R2(sp)
 	li	t0, 1				# set error flag
 	sw	t0, PT_R7(sp)
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 3d58204..a9e1716 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -117,7 +117,7 @@ syscall_trace_entry:
 
 illegal_syscall:
 	/* This also isn't a 64-bit syscall, throw an error.  */
-	li	v0, -ENOSYS			# error
+	li	v0, ENOSYS			# error
 	sd	v0, PT_R2(sp)
 	li	t0, 1				# set error flag
 	sd	t0, PT_R7(sp)
commit fb498e2570eedc6c9c3d165e370624dfc3aed97b
Author: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date:   Sat Oct 25 01:17:23 2008 +0900

    MIPS: Set ENOSYS to errno on illegal system call number for syscall(2)
    
    Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index ffa23bd..759f680 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -293,7 +293,7 @@ bad_alignment:
 	jr	t2
 	/* Unreached */
 
-einval:	li	v0, -EINVAL
+einval:	li	v0, -ENOSYS
 	jr	ra
 	END(sys_syscall)
 
commit c6cb4df96fa22d1174d6fb6dfc2c7501d7afaeea
Author: David Daney <ddaney@caviumnetworks.com>
Date:   Fri Oct 31 11:23:09 2008 -0700

    MIPS: Return ENOSYS from sys32_syscall on 64bit kernels like elsewhere.
    
    When the o32 errno was changed to ENOSYS, we forgot to update the code
    for 64bit kernels.
    
    Signed-off-by: David Daney <ddaney@caviumnetworks.com>
    Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 3d55e3b..fefef4a 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -196,7 +196,7 @@ LEAF(sys32_syscall)
 	jr	t2
 	/* Unreached */
 
-einval:	li	v0, -EINVAL
+einval:	li	v0, -ENOSYS
 	jr	ra
 	END(sys32_syscall)
 

-- System Information:
Debian Release: 5.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: mipsel (mips64)

Kernel: Linux 2.6.26-1-5kc-malta
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash



Reply to: