From patchwork Wed Sep 24 09:12:22 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Halesh S X-Patchwork-Id: 1260 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id B94DCDDFE7 for ; Wed, 24 Sep 2008 19:13:33 +1000 (EST) X-Original-To: linuxppc-embedded@ozlabs.org Delivered-To: linuxppc-embedded@ozlabs.org Received: from IE1EHSOBE005.bigfish.com (outbound-dub.frontbridge.com [213.199.154.16]) by ozlabs.org (Postfix) with ESMTP id 86956DDE25; Wed, 24 Sep 2008 19:13:20 +1000 (EST) Received: from mail20-dub-R.bigfish.com (10.5.252.3) by IE1EHSOBE005.bigfish.com (10.5.252.25) with Microsoft SMTP Server id 8.1.240.5; Wed, 24 Sep 2008 09:13:14 +0000 Received: from mail20-dub (localhost.localdomain [127.0.0.1]) by mail20-dub-R.bigfish.com (Postfix) with ESMTP id 7A9B014181F8; Wed, 24 Sep 2008 09:13:14 +0000 (UTC) X-BigFish: VPS-32(zz542N1432Ra0dJ936fO9371P1127izzzzz2dh6bh61h) X-Spam-TCS-SCL: 0:0 Received: by mail20-dub (MessageSwitch) id 1222247592543814_388; Wed, 24 Sep 2008 09:13:12 +0000 (UCT) Received: from sggdcex1ns01.sony.com.sg (sggdcex1ns01.sony.com.sg [121.100.32.134]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by mail20-dub.bigfish.com (Postfix) with ESMTP id CE4A4380075; Wed, 24 Sep 2008 09:13:11 +0000 (UTC) Received: from sggdcwn1vs01.sony.com.sg (sggdcwn1vs01 [43.68.8.23]) by sggdcex1ns01.sony.com.sg (8.13.7+Sun/8.13.7) with SMTP id m8O9CvUj002454; Wed, 24 Sep 2008 17:12:58 +0800 (SGT) Received: from (sgsesgdcid01.sony.com.sg [43.68.8.1]) by sggdcwn1vs01.sony.com.sg with smtp id 1167_fa35f738_8a18_11dd_904b_001372631f16; Wed, 24 Sep 2008 17:12:57 +0800 Received: from sgapxbh04.ap.sony.com ([43.68.15.49]) by sgsesgdcid01.sony.com.sg (8.13.7+Sun/8.13.7) with ESMTP id m8O9CvDc003739; Wed, 24 Sep 2008 17:12:57 +0800 (SGT) Received: from insardxms01.ap.sony.com ([43.88.102.10]) by sgapxbh04.ap.sony.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 24 Sep 2008 17:12:40 +0800 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325 Content-Class: urn:content-classes:message MIME-Version: 1.0 Subject: RE: [PATCH] remove bogus ppc_select syscall Importance: normal Priority: normal Date: Wed, 24 Sep 2008 14:42:22 +0530 Message-ID: <7B7EF7F090B9804A830ACC82F2CDE95D56E615@insardxms01.ap.sony.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] remove bogus ppc_select syscall Thread-Index: AckeEL3kAcgEZ/4fTkulZxtmUxUchQAEnOFA From: "Sadashiiv, Halesh" To: "Arnd Bergmann" , , X-OriginalArrivalTime: 24 Sep 2008 09:12:40.0867 (UTC) FILETIME=[B22CBF30:01C91E25] Cc: linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-embedded@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-embedded-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-embedded-bounces+patchwork-incoming=ozlabs.org@ozlabs.org I have tested the provided patch on PPC32 with little modifications. Test passed on the PPC32. Modification to Arnd's Patch: In systbl.h you have changed -SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select) +SYSCALL(sys_ni_syscall) That has to be -SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select) +SYSCALL(ni_syscall) Which failed the kernel build. It's a typo from your side I think. After fixing it build went fine. Signed-off-by: Halesh Sadashiv Signed-off-by: Arnd Bergmann - return sys_select(n, inp, outp, exp, tvp); -} -#endif - #ifdef CONFIG_PPC64 long ppc64_personality(unsigned long personality) { Thanks Halesh >-----Original Message----- >From: Arnd Bergmann [mailto:arnd@arndb.de] >Sent: Wednesday, September 24, 2008 12:09 PM >To: linuxppc-embedded@ozlabs.org; paulus@samba.org >Cc: benh@kernel.crashing.org; Sadashiiv, Halesh; linuxppc-dev@ozlabs.org >Subject: [PATCH] remove bogus ppc_select syscall > >The ppc_select function was introduced in linux-2.3.48 in order to support >code confusing the legacy select() calling convention with the standard one. >Even 11 years ago, all correctly built code should not have done this and >could have easily been phased out. Nothing that was compiled later should >actually try to use the old_select interface, and it would have been broken >already on all ppc64 kernels with the syscall emulation layer. > >This patch brings the 32 bit compat ABI and the native 32 bit ABI for >powerpc into a consistent state, by removing support for both the >old_select system call number and the handler for it. > >The bug report triggering this came from Halesh Sadashiiv >, who discovered that the 32 bit >implementation of ppc_select would in case of a negative number >of file descriptors incorrectly return -EFAULT instead of -EINVAL. >There seems to be no way to fix this problem in a way that would >keep broken pre-1997 binaries running. > >Signed-off-by: Arnd Bergmann >Cc: Halesh Sadashiiv >--- > >Halesh, please test this patch to make sure it fixes the problem >you reported. I do not have a ppc32 machine I can try this on. > >diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h >index e07d0c7..46107cc 100644 >--- a/arch/powerpc/include/asm/unistd.h >+++ b/arch/powerpc/include/asm/unistd.h >@@ -92,7 +92,7 @@ > #define __NR_settimeofday 79 > #define __NR_getgroups 80 > #define __NR_setgroups 81 >-#define __NR_select 82 >+/* Number 82 was the old (pre-1.3.x) select */ > #define __NR_symlink 83 > #define __NR_oldlstat 84 > #define __NR_readlink 85 >diff --git a/arch/powerpc/include/asm/systbl.h >b/arch/powerpc/include/asm/systbl.h >index f6cc7a4..5a69b32 100644 >--- a/arch/powerpc/include/asm/systbl.h >+++ b/arch/powerpc/include/asm/systbl.h >@@ -85,7 +85,7 @@ COMPAT_SYS_SPU(gettimeofday) > COMPAT_SYS_SPU(settimeofday) > COMPAT_SYS_SPU(getgroups) > COMPAT_SYS_SPU(setgroups) >-SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select) >+SYSCALL(sys_ni_syscall) > SYSCALL_SPU(symlink) > OLDSYS(lstat) > COMPAT_SYS_SPU(readlink) >@@ -145,7 +145,7 @@ SYSCALL_SPU(setfsuid) > SYSCALL_SPU(setfsgid) > SYSCALL_SPU(llseek) > COMPAT_SYS_SPU(getdents) >-SYSX_SPU(sys_select,ppc32_select,ppc_select) >+SYSX_SPU(sys_select,ppc32_select,sys_select) > SYSCALL_SPU(flock) > SYSCALL_SPU(msync) > COMPAT_SYS_SPU(readv) >diff --git a/arch/powerpc/kernel/syscalls.c >b/arch/powerpc/kernel/syscalls.c >index c04832c..c2e6a74 100644 >--- a/arch/powerpc/kernel/syscalls.c >+++ b/arch/powerpc/kernel/syscalls.c >@@ -183,31 +183,6 @@ unsigned long sys_mmap(unsigned long addr, size_t len, > return do_mmap2(addr, len, prot, flags, fd, offset, PAGE_SHIFT); > } > >-#ifdef CONFIG_PPC32 >-/* >- * Due to some executables calling the wrong select we sometimes >- * get wrong args. This determines how the args are being passed >- * (a single ptr to them all args passed) then calls >- * sys_select() with the appropriate args. -- Cort >- */ >-int >-ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user >*exp, struct timeval __user *tvp) >-{ >- if ( (unsigned long)n >= 4096 ) >- { >- unsigned long __user *buffer = (unsigned long __user *)n; >- if (!access_ok(VERIFY_READ, buffer, 5*sizeof(unsigned long)) >- || __get_user(n, buffer) >- || __get_user(inp, ((fd_set __user * __user *)(buffer+1))) >- || __get_user(outp, ((fd_set __user * __user >*)(buffer+2))) >- || __get_user(exp, ((fd_set __user * __user *)(buffer+3))) >- || __get_user(tvp, ((struct timeval __user * __user >*)(buffer+4)))) >- return -EFAULT; >- } >- return sys_select(n, inp, outp, exp, tvp); >-} >-#endif >- > #ifdef CONFIG_PPC64 > long ppc64_personality(unsigned long personality) > { ------------------------------------------------------------------- This email is confidential and intended only for the use of the individual or entity named above and may contain information that is privileged. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this email is strictly prohibited. If you have received this email in error, please notify us immediately by return email or telephone and destroy the original message. - This mail is sent via Sony Asia Pacific Mail Gateway. ------------------------------------------------------------------- diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index e07d0c7..46107cc 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h @@ -92,7 +92,7 @@ #define __NR_settimeofday 79 #define __NR_getgroups 80 #define __NR_setgroups 81 -#define __NR_select 82 +/* Number 82 was the old (pre-1.3.x) select */ #define __NR_symlink 83 #define __NR_oldlstat 84 #define __NR_readlink 85 diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index f6cc7a4..5a69b32 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h @@ -85,7 +85,7 @@ COMPAT_SYS_SPU(gettimeofday) COMPAT_SYS_SPU(settimeofday) COMPAT_SYS_SPU(getgroups) COMPAT_SYS_SPU(setgroups) -SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select) +SYSCALL(ni_syscall) SYSCALL_SPU(symlink) OLDSYS(lstat) COMPAT_SYS_SPU(readlink) @@ -145,7 +145,7 @@ SYSCALL_SPU(setfsuid) SYSCALL_SPU(setfsgid) SYSCALL_SPU(llseek) COMPAT_SYS_SPU(getdents) -SYSX_SPU(sys_select,ppc32_select,ppc_select) +SYSX_SPU(sys_select,ppc32_select,sys_select) SYSCALL_SPU(flock) SYSCALL_SPU(msync) COMPAT_SYS_SPU(readv) diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c index c04832c..c2e6a74 100644 --- a/arch/powerpc/kernel/syscalls.c +++ b/arch/powerpc/kernel/syscalls.c @@ -183,31 +183,6 @@ unsigned long sys_mmap(unsigned long addr, size_t len, return do_mmap2(addr, len, prot, flags, fd, offset, PAGE_SHIFT); } -#ifdef CONFIG_PPC32 -/* - * Due to some executables calling the wrong select we sometimes - * get wrong args. This determines how the args are being passed - * (a single ptr to them all args passed) then calls - * sys_select() with the appropriate args. -- Cort - */ -int -ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp) -{ - if ( (unsigned long)n >= 4096 ) - { - unsigned long __user *buffer = (unsigned long __user *)n; - if (!access_ok(VERIFY_READ, buffer, 5*sizeof(unsigned long)) - || __get_user(n, buffer) - || __get_user(inp, ((fd_set __user * __user *)(buffer+1))) - || __get_user(outp, ((fd_set __user * __user *)(buffer+2))) - || __get_user(exp, ((fd_set __user * __user *)(buffer+3))) - || __get_user(tvp, ((struct timeval __user * __user *)(buffer+4)))) - return -EFAULT; - }