User: Password:
|
|
Subscribe / Log in / New account

Re: Linux 3.3-rc4

From:  Linus Torvalds <torvalds-AT-linux-foundation.org>
To:  Thomas Meyer <thomas-AT-m3y3r.de>, Al Viro <viro-AT-zeniv.linux.org.uk>
Subject:  Re: Linux 3.3-rc4
Date:  Tue, 21 Feb 2012 14:43:14 -0800
Message-ID:  <CA+55aFxkbsZN3yG6d9DPGiXmiuX-wOURJcC0hAUN3Qbykv1UhQ@mail.gmail.com>
Cc:  Linux Kernel Mailing List <linux-kernel-AT-vger.kernel.org>, linux-fsdevel-AT-vger.kernel.org
Archive-link:  Article

On Sun, Feb 19, 2012 at 5:42 AM, Thomas Meyer <thomas@m3y3r.de> wrote:
>
> 2.) while debugging above issue: I did find an minor bug in sys_poll() - nobody did take care of
my proposed patch: https://lkml.org/lkml/2011/9/24/35

Ok, so I started out forward-porting that patch to current -git
(trivial: it's just that the system call tables are differently
generated now), but the more I look at it, the more I suspect that we
should perhaps just globally fix "sys_poll()" to have the timeout
argument be 'int'.

Because that *is* the standard user interface (just do "man 2 poll"),
and while all of the git history (and all of the BK history) we've had
it as "long", I suspect we should just fix it.

So I suspect the correct patch is just as attached instead: make
sys_poll() just take an "int timeout". Any user who tried to use a
long value would already have got truncated by glibc - I just checked.

Of course, there is a remote possibility that somebody might not use
glibc, and have used "poll()" with the raw system call interface, and
depended on using a 64-bit "long timeout" on 64-bit architectures.

But quite frankly, that sounds rather unlikely in the extreme.

Comments? If we do this, and somebody actually reports that they use a
64-bit timeout, we could always go back to the broken 'long' argument,
and take your patch to fix the compat case.

                  Linus
 arch/s390/kernel/compat_wrapper.S |    2 +-
 fs/select.c                       |    2 +-
 include/linux/syscalls.h          |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 18c51df9fe06..ff605a39cf43 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -662,7 +662,7 @@ ENTRY(sys32_getresuid16_wrapper)
 ENTRY(sys32_poll_wrapper)
 	llgtr	%r2,%r2			# struct pollfd *
 	llgfr	%r3,%r3			# unsigned int
-	lgfr	%r4,%r4			# long
+	lgfr	%r4,%r4			# int
 	jg	sys_poll		# branch to system call
 
 ENTRY(sys32_setresgid16_wrapper)
diff --git a/fs/select.c b/fs/select.c
index d33418fdc858..e782258d0de3 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -912,7 +912,7 @@ static long do_restart_poll(struct restart_block *restart_block)
 }
 
 SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds,
-		long, timeout_msecs)
+		int, timeout_msecs)
 {
 	struct timespec end_time, *to = NULL;
 	int ret;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 515669fa3c1d..8ec1153ff57b 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -624,7 +624,7 @@ asmlinkage long sys_socketpair(int, int, int, int __user *);
 asmlinkage long sys_socketcall(int call, unsigned long __user *args);
 asmlinkage long sys_listen(int, int);
 asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
-				long timeout);
+				int timeout);
 asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
 			fd_set __user *exp, struct timeval __user *tvp);
 asmlinkage long sys_old_select(struct sel_arg_struct __user *arg);


(Log in to post comments)


Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds