Re: Inconsistency with COMPAT_10

2014-07-25 Thread Maxime Villard
Le 18/04/2014 10:30, Maxime Villard a écrit :
 Hi all,
 I think there's an inconsistency with COMPAT_10 in the open() syscall:
 
 - kern/vfs_syscalls.c - l.1631 --
 
 #ifdef COMPAT_10  /* XXX: and perhaps later */
   if (path == NULL) {
   pb = pathbuf_create(.);
   if (pb == NULL)
   return ENOMEM;
   } else
 #endif
   {
   error = pathbuf_copyin(path, pb);
   if (error)
   return error;
   }
 
 -
 
  compat/netbsd32/netbsd32_netbsd.c - l.240 --
 
   if (SCARG(ua, path) != NULL) {
   error = pathbuf_copyin(SCARG(ua, path), pb);
   if (error)
   return error;
   } else {
   pb = pathbuf_create(.);
   if (pb == NULL)
   return ENOMEM;
   }
 
 -
 
 COMPAT_10 should be added in netbsd32, or removed from the native
 syscall. But I'm not sure which fix should be applied.
 
 I guess there's someone around here who knows how to fix that.
 
 Thanks!
 Maxime
 

I've kept this issue in my TODO list until now - I told myself I would fix it 
after
investigating a bit. But now I figure out that I don't have to:

Index: netbsd32_netbsd.c
===
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_netbsd.c,v
retrieving revision 1.192
diff -u -r1.192 netbsd32_netbsd.c
--- netbsd32_netbsd.c   28 Jun 2014 22:27:50 -  1.192
+++ netbsd32_netbsd.c   18 Jul 2014 18:01:38 -
@@ -230,28 +230,12 @@
syscallarg(mode_t) mode;
} */
struct sys_open_args ua;
-   struct pathbuf *pb;
-   int error, fd;
 
NETBSD32TOP_UAP(path, const char);
NETBSD32TO64_UAP(flags);
NETBSD32TO64_UAP(mode);
-
-   if (SCARG(ua, path) != NULL) {
-   error = pathbuf_copyin(SCARG(ua, path), pb);
-   if (error) 
-   return error; 
-   } else {
-   pb = pathbuf_create(.);
-   if (pb == NULL)
-   return ENOMEM;
-   }
-
-error = do_open(l, NULL, pb, SCARG(ua, flags), SCARG(ua, mode), fd);
-pathbuf_destroy(pb);
-   if (error == 0)
-   *retval = fd;
-return error;
+
+   return sys_open(l, ua, retval);
 }
 
 int


Just redirect to sys_open(), which will handle the rest. Copied from 
linux_file.c.

Ok?


Re: Inconsistency with COMPAT_10

2014-04-19 Thread David Holland
On Fri, Apr 18, 2014 at 10:13:13AM -0400, Greg Troxel wrote:
   COMPAT_10 should be added in netbsd32, or removed from the native
   syscall. But I'm not sure which fix should be applied.
  
  Probably added in compat32.  But I don't know how common programs are
  that rely on this bug.
  
  I wonder if pathbuf_create results in a need to free pb later.

Either way it needs to (and does) call pathbuf_destroy.

-- 
David A. Holland
dholl...@netbsd.org


Re: Inconsistency with COMPAT_10

2014-04-18 Thread Greg Troxel

Maxime Villard m...@m00nbsd.net writes:

 COMPAT_10 should be added in netbsd32, or removed from the native
 syscall. But I'm not sure which fix should be applied.

Probably added in compat32.  But I don't know how common programs are
that rely on this bug.

I wonder if pathbuf_create results in a need to free pb later.


pgpW3yc5CFvS5.pgp
Description: PGP signature


Re: Inconsistency with COMPAT_10

2014-04-18 Thread Christos Zoulas
In article 5350e2b5.6000...@m00nbsd.net,
Maxime Villard  m...@m00nbsd.net wrote:
Hi all,
I think there's an inconsistency with COMPAT_10 in the open() syscall:

- kern/vfs_syscalls.c - l.1631 --

#ifdef COMPAT_10   /* XXX: and perhaps later */
   if (path == NULL) {
   pb = pathbuf_create(.);
   if (pb == NULL)
   return ENOMEM;
   } else
#endif
   {
   error = pathbuf_copyin(path, pb);
   if (error)
   return error;
   }

-

 compat/netbsd32/netbsd32_netbsd.c - l.240 --

   if (SCARG(ua, path) != NULL) {
   error = pathbuf_copyin(SCARG(ua, path), pb);
   if (error)
   return error;
   } else {
   pb = pathbuf_create(.);
   if (pb == NULL)
   return ENOMEM;
   }

-

COMPAT_10 should be added in netbsd32, or removed from the native
syscall. But I'm not sure which fix should be applied.

I guess there's someone around here who knows how to fix that.

I guess add COMPAT_10 in netbsd32_netbsd.c

christos