public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* consolidate compat readv/writev/execve/select/nfsservctl [v2]
@ 2004-04-16 16:00 Arnd Bergmann
  2004-04-16 16:02 ` [PATCH 1/4] Consolidate sys32_readv and sys32_writev Arnd Bergmann
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Arnd Bergmann @ 2004-04-16 16:00 UTC (permalink / raw)
  To: linux-kernel

I'm following up with patches to introduce new compat_sys_* functions
for the largest four ones. All of these had some bugs on most
architectures, usually resulting from missing updates after the
native handler was changed.

This is the second version of these cleanups that include a fix for
compat_sys_select and an update from Arun Sharma to use compat_do_execve
on ia64 as well.

For readv, writev, execve and select, ia64 and x86_64 use a different
method from the others and I chose to use the more common one, which
is a bit more code but avoids an extra copy of the user data.

The patches are also available at
http://www.arndb.de/patches/linux/2.6.6-rc1/ and apply cleanly
to 2.6.6-rc1 and 2.6.5-mm6. They are tested on x86_64, ia64 and s390.

Please consider for 2.6.6-rc*-mm* and 2.6.7.

	Arnd <><


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Consolidate sys32 select
@ 2004-05-25 23:10 Arnd Bergmann
  2004-05-26  6:09 ` Martin Josefsson
  0 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2004-05-25 23:10 UTC (permalink / raw)
  To: Martin Josefsson; +Cc:  David S. Miller , arnd, linux-kernel, ultralinux


Martin Josefsson <gandalf@wlug.westbo.se> schrieb am 26.05.2004,
00:29:13:

> You mean in compat_sys_select() ?
> compat_ptr() takes an u32 as argument, needs casting, ugly.
> But you want it done that way?

When using compat_ptr properly, you don't need any casts,
see the patch below (the patch is probably messed up by my 
broken mailer, but you get the picture).

> I see this problem when compat_sys_select() is called directly from
> syscall, not via sunos_select() which uses compat_ptr()

Which brings us to a more global question on the syscall handlers.

There are currently different strategies on how to handle argument
extension for the compat syscall handlers. s390 always goes through
assembly wrappers (arch/s390/kernel/compat_wrapper.S), ppc64 does
something similar in C (arch/ppc64/kernel/sys_ppc32.c). Since the
other architectures appear to need conversion only for potentially 
negative integer values (and sparc64 pointers), it's far less 
consistant there.

There may be some more corner cases (e.g. reporting a wrong error
value for a negative syscall arguments) where this goes bad on one
architecture or another. This makes me wonder if the s390 wrapper
mechanism should be generalized to get on the safe side here. I
already have a sed script to generate the s390 compat_wrapper.S
from the syscall prototypes, but there should be a way to do the
same in an architecture independent way.

      Arnd <><

===== fs/compat.c 1.24 vs edited =====
--- 1.24/fs/compat.c	Sat May 22 06:31:47 2004
+++ edited/fs/compat.c	Wed May 26 00:57:49 2004
@@ -1300,13 +1300,15 @@
 
 asmlinkage long
 compat_sys_select(int n, compat_ulong_t __user *inp, compat_ulong_t
__user *outp,
-		compat_ulong_t __user *exp, struct compat_timeval __user *tvp)
+		compat_ulong_t __user *exp, compat_uptr_t utv)
 {
 	fd_set_bits fds;
+	struct compat_timeval __user *tvp;
 	char *bits;
 	long timeout;
 	int ret, size, max_fdset;
 
+	tvp = compat_ptr(utv);
 	timeout = MAX_SCHEDULE_TIMEOUT;
 	if (tvp) {
 		time_t sec, usec;

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

end of thread, other threads:[~2004-05-27 13:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-16 16:00 consolidate compat readv/writev/execve/select/nfsservctl [v2] Arnd Bergmann
2004-04-16 16:02 ` [PATCH 1/4] Consolidate sys32_readv and sys32_writev Arnd Bergmann
2004-04-16 16:04 ` [PATCH 2/4] Consolidate do_execve32 Arnd Bergmann
2004-04-16 16:05 ` [PATCH 3/4] Consolidate sys32_select Arnd Bergmann
2004-05-25 22:02   ` Martin Josefsson
2004-05-25 22:12     ` David S. Miller
2004-05-25 22:29       ` Martin Josefsson
2004-04-16 16:08 ` [PATCH 4/4] Consolidate sys32_nfsservctl Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2004-05-25 23:10 [PATCH 3/4] Consolidate sys32 select Arnd Bergmann
2004-05-26  6:09 ` Martin Josefsson
2004-05-27 13:39   ` Arnd Bergmann

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