public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sys_poll(): fix function definition/negative timeout values
@ 2011-09-15 12:45 Thomas Meyer
  2011-09-15 17:47 ` Andi Kleen
  2011-09-16 17:04 ` Valdis.Kletnieks
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Meyer @ 2011-09-15 12:45 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Fix negative timeout values for x86 userland on x86_64 kernels.
Align sys_poll() definition to glibc's definition.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 fs/select.c              |    2 +-
 include/linux/syscalls.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/select.c b/fs/select.c
index d33418f..e782258 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 1ff0ec2..8f482e5 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);
-- 
1.7.6.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] sys_poll(): fix function definition/negative timeout values
  2011-09-15 12:45 [PATCH] sys_poll(): fix function definition/negative timeout values Thomas Meyer
@ 2011-09-15 17:47 ` Andi Kleen
  2011-09-15 18:05   ` Eric Dumazet
  2011-09-16 17:04 ` Valdis.Kletnieks
  1 sibling, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2011-09-15 17:47 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: Linux Kernel Mailing List

Thomas Meyer <thomas@m3y3r.de> writes:

> Fix negative timeout values for x86 userland on x86_64 kernels.
> Align sys_poll() definition to glibc's definition.

Nack. Please write a compat wrapper that sign extends.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sys_poll(): fix function definition/negative timeout values
  2011-09-15 17:47 ` Andi Kleen
@ 2011-09-15 18:05   ` Eric Dumazet
  2011-09-15 18:12     ` Andi Kleen
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2011-09-15 18:05 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Thomas Meyer, Linux Kernel Mailing List

Le jeudi 15 septembre 2011 à 10:47 -0700, Andi Kleen a écrit :
> Thomas Meyer <thomas@m3y3r.de> writes:
> 
> > Fix negative timeout values for x86 userland on x86_64 kernels.
> > Align sys_poll() definition to glibc's definition.
> 
> Nack. Please write a compat wrapper that sign extends.
> 

Why ?

man poll

int poll(struct pollfd *ufds, unsigned int nfds, int delay); 





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sys_poll(): fix function definition/negative timeout values
  2011-09-15 18:05   ` Eric Dumazet
@ 2011-09-15 18:12     ` Andi Kleen
  2011-09-15 18:21       ` Eric Dumazet
  0 siblings, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2011-09-15 18:12 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Andi Kleen, Thomas Meyer, Linux Kernel Mailing List

On Thu, Sep 15, 2011 at 08:05:17PM +0200, Eric Dumazet wrote:
> Le jeudi 15 septembre 2011 à 10:47 -0700, Andi Kleen a écrit :
> > Thomas Meyer <thomas@m3y3r.de> writes:
> > 
> > > Fix negative timeout values for x86 userland on x86_64 kernels.
> > > Align sys_poll() definition to glibc's definition.
> > 
> > Nack. Please write a compat wrapper that sign extends.
> > 
> 
> Why ?

Because we shouldn't change existing interfaces and there could
be valid reasons on 64bit for really long delays.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sys_poll(): fix function definition/negative timeout values
  2011-09-15 18:12     ` Andi Kleen
@ 2011-09-15 18:21       ` Eric Dumazet
  2011-10-06 23:01         ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2011-09-15 18:21 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Thomas Meyer, Linux Kernel Mailing List

Le jeudi 15 septembre 2011 à 20:12 +0200, Andi Kleen a écrit :
> On Thu, Sep 15, 2011 at 08:05:17PM +0200, Eric Dumazet wrote:
> > Le jeudi 15 septembre 2011 à 10:47 -0700, Andi Kleen a écrit :
> > > Thomas Meyer <thomas@m3y3r.de> writes:
> > > 
> > > > Fix negative timeout values for x86 userland on x86_64 kernels.
> > > > Align sys_poll() definition to glibc's definition.
> > > 
> > > Nack. Please write a compat wrapper that sign extends.
> > > 
> > 
> > Why ?
> 
> Because we shouldn't change existing interfaces and there could
> be valid reasons on 64bit for really long delays.

I disagree.

Existing interface and POSIX mandates "int delay"

The kernel part of the contract was fine when we supported 32bit only
machines, by chance, because sizeof(int) == sizeof(long).

If you want more than 31 bits delay, then we need a new interface, and
this new interface must also work on 32bit arches (sort of poll64())





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sys_poll(): fix function definition/negative timeout values
  2011-09-15 12:45 [PATCH] sys_poll(): fix function definition/negative timeout values Thomas Meyer
  2011-09-15 17:47 ` Andi Kleen
@ 2011-09-16 17:04 ` Valdis.Kletnieks
  1 sibling, 0 replies; 7+ messages in thread
From: Valdis.Kletnieks @ 2011-09-16 17:04 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

On Thu, 15 Sep 2011 14:45:56 +0200, Thomas Meyer said:
> Fix negative timeout values for x86 userland on x86_64 kernels.
> Align sys_poll() definition to glibc's definition.

> -		long, timeout_msecs)
> +		int, timeout_msecs)

Is this going to surprise a non-glibc userspace on any platforms?

[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sys_poll(): fix function definition/negative timeout values
  2011-09-15 18:21       ` Eric Dumazet
@ 2011-10-06 23:01         ` Andrew Morton
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2011-10-06 23:01 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Andi Kleen, Thomas Meyer, Linux Kernel Mailing List

On Thu, 15 Sep 2011 20:21:02 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Le jeudi 15 septembre 2011 __ 20:12 +0200, Andi Kleen a __crit :
> > On Thu, Sep 15, 2011 at 08:05:17PM +0200, Eric Dumazet wrote:
> > > Le jeudi 15 septembre 2011 __ 10:47 -0700, Andi Kleen a __crit :
> > > > Thomas Meyer <thomas@m3y3r.de> writes:
> > > > 
> > > > > Fix negative timeout values for x86 userland on x86_64 kernels.
> > > > > Align sys_poll() definition to glibc's definition.
> > > > 
> > > > Nack. Please write a compat wrapper that sign extends.
> > > > 
> > > 
> > > Why ?
> > 
> > Because we shouldn't change existing interfaces and there could
> > be valid reasons on 64bit for really long delays.
> 
> I disagree.
> 
> Existing interface and POSIX mandates "int delay"
> 
> The kernel part of the contract was fine when we supported 32bit only
> machines, by chance, because sizeof(int) == sizeof(long).
> 
> If you want more than 31 bits delay, then we need a new interface, and
> this new interface must also work on 32bit arches (sort of poll64())

So what's happening here?

If the change will break (or alter) existing code which does

	poll(..., something_greater_than_2g)

then I don't think we can apply the patch.  There may be code out there
which breaks, there may not be.  We don't know.  We screwed up, we get
to wear the cost of having done so.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-06 23:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-15 12:45 [PATCH] sys_poll(): fix function definition/negative timeout values Thomas Meyer
2011-09-15 17:47 ` Andi Kleen
2011-09-15 18:05   ` Eric Dumazet
2011-09-15 18:12     ` Andi Kleen
2011-09-15 18:21       ` Eric Dumazet
2011-10-06 23:01         ` Andrew Morton
2011-09-16 17:04 ` Valdis.Kletnieks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox