Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/netbsd32 Catch up after getpid/getgid/getuid chan...



details:   https://anonhg.NetBSD.org/src/rev/a3d973132f9f
branches:  trunk
changeset: 968492:a3d973132f9f
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Jan 18 07:33:24 2020 +0000

description:
Catch up after getpid/getgid/getuid changes in native ABI in 2008

getpid(), getuid() and getgid() used to call respectively sys_getpid(),
sys_getuid() and sys_getgid(). In the BSD4.3 compat mode there was a
fallback to call sys_getpid_with_ppid() and related functions.

In 2008 the compat ifdef was removed in sys/kern/syscalls.master r. 1.216.

For purity reasons we probably shall restore the NetBSD original behavior
and implement BSD4.3 one as a compat module, however it is not worth the
complexity.

Align the netbsd32 compat ABI to native ABI and call functions that return
two integers as in BSD4.3.

diffstat:

 sys/compat/netbsd32/netbsd32_syscall.h           |   2 +-
 sys/compat/netbsd32/netbsd32_syscallargs.h       |   8 ++++----
 sys/compat/netbsd32/netbsd32_syscalls.c          |  10 +++++-----
 sys/compat/netbsd32/netbsd32_syscalls_autoload.c |   4 ++--
 sys/compat/netbsd32/netbsd32_sysent.c            |  10 +++++-----
 sys/compat/netbsd32/netbsd32_systrace_args.c     |  20 ++++++++++----------
 sys/compat/netbsd32/syscalls.master              |   8 ++++----
 7 files changed, 31 insertions(+), 31 deletions(-)

diffs (275 lines):

diff -r 770854132e81 -r a3d973132f9f sys/compat/netbsd32/netbsd32_syscall.h
--- a/sys/compat/netbsd32/netbsd32_syscall.h    Sat Jan 18 07:25:11 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_syscall.h    Sat Jan 18 07:33:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_syscall.h,v 1.146 2019/11/04 11:33:01 rin Exp $ */
+/* $NetBSD: netbsd32_syscall.h,v 1.147 2020/01/18 07:33:24 kamil Exp $ */
 
 /*
  * System call numbers.
diff -r 770854132e81 -r a3d973132f9f sys/compat/netbsd32/netbsd32_syscallargs.h
--- a/sys/compat/netbsd32/netbsd32_syscallargs.h        Sat Jan 18 07:25:11 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_syscallargs.h        Sat Jan 18 07:33:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_syscallargs.h,v 1.145 2019/11/04 11:33:01 rin Exp $ */
+/* $NetBSD: netbsd32_syscallargs.h,v 1.146 2020/01/18 07:33:24 kamil Exp $ */
 
 /*
  * System call argument lists.
@@ -2693,7 +2693,7 @@
 
 int    compat_43_netbsd32_olseek(struct lwp *, const struct compat_43_netbsd32_olseek_args *, register_t *);
 
-int    sys_getpid(struct lwp *, const void *, register_t *);
+int    sys_getpid_with_ppid(struct lwp *, const void *, register_t *);
 
 int    compat_40_netbsd32_mount(struct lwp *, const struct compat_40_netbsd32_mount_args *, register_t *);
 
@@ -2701,7 +2701,7 @@
 
 int    netbsd32_setuid(struct lwp *, const struct netbsd32_setuid_args *, register_t *);
 
-int    sys_getuid(struct lwp *, const void *, register_t *);
+int    sys_getuid_with_euid(struct lwp *, const void *, register_t *);
 
 int    sys_geteuid(struct lwp *, const void *, register_t *);
 
@@ -2747,7 +2747,7 @@
 
 int    netbsd32_sigaction(struct lwp *, const struct netbsd32_sigaction_args *, register_t *);
 
-int    sys_getgid(struct lwp *, const void *, register_t *);
+int    sys_getgid_with_egid(struct lwp *, const void *, register_t *);
 
 int    compat_13_netbsd32_sigprocmask(struct lwp *, const struct compat_13_netbsd32_sigprocmask_args *, register_t *);
 
diff -r 770854132e81 -r a3d973132f9f sys/compat/netbsd32/netbsd32_syscalls.c
--- a/sys/compat/netbsd32/netbsd32_syscalls.c   Sat Jan 18 07:25:11 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_syscalls.c   Sat Jan 18 07:33:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_syscalls.c,v 1.145 2019/11/04 11:33:01 rin Exp $ */
+/* $NetBSD: netbsd32_syscalls.c,v 1.146 2020/01/18 07:33:24 kamil Exp $ */
 
 /*
  * System call names.
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.145 2019/11/04 11:33:01 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.146 2020/01/18 07:33:24 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)
@@ -584,11 +584,11 @@
        /*  17 */       "break",
        /*  18 */       NULL, /* compat_20_netbsd32_getfsstat */
        /*  19 */       NULL, /* compat_43_netbsd32_olseek */
-       /*  20 */       NULL, /* getpid */
+       /*  20 */       "getpid_with_ppid",
        /*  21 */       NULL, /* compat_40_netbsd32_mount */
        /*  22 */       "unmount",
        /*  23 */       "setuid",
-       /*  24 */       NULL, /* getuid */
+       /*  24 */       "getuid_with_euid",
        /*  25 */       NULL, /* geteuid */
        /*  26 */       "ptrace",
        /*  27 */       "recvmsg",
@@ -611,7 +611,7 @@
        /*  44 */       "profil",
        /*  45 */       "ktrace",
        /*  46 */       "sigaction",
-       /*  47 */       NULL, /* getgid */
+       /*  47 */       "getgid_with_egid",
        /*  48 */       NULL, /* compat_13_sigprocmask13 */
        /*  49 */       "__getlogin",
        /*  50 */       "setlogin",
diff -r 770854132e81 -r a3d973132f9f sys/compat/netbsd32/netbsd32_syscalls_autoload.c
--- a/sys/compat/netbsd32/netbsd32_syscalls_autoload.c  Sat Jan 18 07:25:11 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_syscalls_autoload.c  Sat Jan 18 07:33:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_syscalls_autoload.c,v 1.25 2019/11/04 11:33:01 rin Exp $ */
+/* $NetBSD: netbsd32_syscalls_autoload.c,v 1.26 2020/01/18 07:33:24 kamil Exp $ */
 
 /*
  * System call autoload table.
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls_autoload.c,v 1.25 2019/11/04 11:33:01 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls_autoload.c,v 1.26 2020/01/18 07:33:24 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
diff -r 770854132e81 -r a3d973132f9f sys/compat/netbsd32/netbsd32_sysent.c
--- a/sys/compat/netbsd32/netbsd32_sysent.c     Sat Jan 18 07:25:11 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_sysent.c     Sat Jan 18 07:33:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_sysent.c,v 1.144 2019/11/04 11:33:01 rin Exp $ */
+/* $NetBSD: netbsd32_sysent.c,v 1.145 2020/01/18 07:33:24 kamil Exp $ */
 
 /*
  * System call switch table.
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.144 2019/11/04 11:33:01 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.145 2020/01/18 07:33:24 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -212,7 +212,7 @@
                .sy_call = (sy_call_t *)sys_nomodule
        },              /* 19 = compat_43_netbsd32_olseek */
        {
-               .sy_call = (sy_call_t *)sys_getpid
+               .sy_call = (sy_call_t *)sys_getpid_with_ppid
        },              /* 20 = getpid */
        {
                ns(struct compat_40_netbsd32_mount_args),
@@ -227,7 +227,7 @@
                .sy_call = (sy_call_t *)netbsd32_setuid
        },              /* 23 = netbsd32_setuid */
        {
-               .sy_call = (sy_call_t *)sys_getuid
+               .sy_call = (sy_call_t *)sys_getuid_with_euid
        },              /* 24 = getuid */
        {
                .sy_call = (sy_call_t *)sys_geteuid
@@ -313,7 +313,7 @@
                .sy_call = (sy_call_t *)netbsd32_sigaction
        },              /* 46 = netbsd32_sigaction */
        {
-               .sy_call = (sy_call_t *)sys_getgid
+               .sy_call = (sy_call_t *)sys_getgid_with_egid
        },              /* 47 = getgid */
        {
                ns(struct compat_13_netbsd32_sigprocmask_args),
diff -r 770854132e81 -r a3d973132f9f sys/compat/netbsd32/netbsd32_systrace_args.c
--- a/sys/compat/netbsd32/netbsd32_systrace_args.c      Sat Jan 18 07:25:11 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_systrace_args.c      Sat Jan 18 07:33:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_systrace_args.c,v 1.36 2019/11/04 11:33:01 rin Exp $ */
+/* $NetBSD: netbsd32_systrace_args.c,v 1.37 2020/01/18 07:33:24 kamil Exp $ */
 
 /*
  * System call argument to DTrace register array converstion.
@@ -164,7 +164,7 @@
                *n_args = 3;
                break;
        }
-       /* sys_getpid */
+       /* sys_getpid_with_ppid */
        case 20: {
                *n_args = 0;
                break;
@@ -194,7 +194,7 @@
                *n_args = 1;
                break;
        }
-       /* sys_getuid */
+       /* sys_getuid_with_euid */
        case 24: {
                *n_args = 0;
                break;
@@ -375,7 +375,7 @@
                *n_args = 3;
                break;
        }
-       /* sys_getgid */
+       /* sys_getgid_with_egid */
        case 47: {
                *n_args = 0;
                break;
@@ -3785,7 +3785,7 @@
                        break;
                };
                break;
-       /* sys_getpid */
+       /* sys_getpid_with_ppid */
        case 20:
                break;
        /* netbsd32_mount */
@@ -3830,7 +3830,7 @@
                        break;
                };
                break;
-       /* sys_getuid */
+       /* sys_getuid_with_euid */
        case 24:
                break;
        /* sys_geteuid */
@@ -4114,7 +4114,7 @@
                        break;
                };
                break;
-       /* sys_getgid */
+       /* sys_getgid_with_egid */
        case 47:
                break;
        /* netbsd32_sigprocmask */
@@ -9633,7 +9633,7 @@
                if (ndx == 0 || ndx == 1)
                        p = "netbsd32_long";
                break;
-       /* sys_getpid */
+       /* sys_getpid_with_ppid */
        case 20:
        /* netbsd32_mount */
        case 21:
@@ -9650,7 +9650,7 @@
                if (ndx == 0 || ndx == 1)
                        p = "int";
                break;
-       /* sys_getuid */
+       /* sys_getuid_with_euid */
        case 24:
        /* sys_geteuid */
        case 25:
@@ -9747,7 +9747,7 @@
                if (ndx == 0 || ndx == 1)
                        p = "int";
                break;
-       /* sys_getgid */
+       /* sys_getgid_with_egid */
        case 47:
        /* netbsd32_sigprocmask */
        case 48:
diff -r 770854132e81 -r a3d973132f9f sys/compat/netbsd32/syscalls.master
--- a/sys/compat/netbsd32/syscalls.master       Sat Jan 18 07:25:11 2020 +0000
+++ b/sys/compat/netbsd32/syscalls.master       Sat Jan 18 07:33:24 2020 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.130 2019/11/04 11:32:22 rin Exp $
+       $NetBSD: syscalls.master,v 1.131 2020/01/18 07:33:24 kamil Exp $
 
 ;      from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
 ;      @(#)syscalls.master     8.2 (Berkeley) 1/13/94
@@ -97,7 +97,7 @@
 19     COMPAT_43 MODULAR compat_netbsd32_43    \
                        { netbsd32_long|netbsd32||olseek(int fd, \
                            netbsd32_long offset, int whence); }
-20     NOARGS          { pid_t|sys||getpid(void); }
+20     NOARGS          { pid_t|sys||getpid_with_ppid(void); } getpid
 21     COMPAT_40 MODULAR compat_netbsd32_40    \
                        { int|netbsd32||mount(netbsd32_charp type, \
                            netbsd32_charp path, int flags, \
@@ -105,7 +105,7 @@
 22     STD             { int|netbsd32||unmount(netbsd32_charp path, \
                            int flags); }
 23     STD             { int|netbsd32||setuid(uid_t uid); }
-24     NOARGS          { uid_t|sys||getuid(void); }
+24     NOARGS          { uid_t|sys||getuid_with_euid(void); } getuid
 25     NOARGS          { uid_t|sys||geteuid(void); }
 26     STD MODULAR compat_netbsd32_ptrace \
                        { int|netbsd32||ptrace(int req, pid_t pid, \
@@ -150,7 +150,7 @@
 46     STD             { int|netbsd32||sigaction(int signum, \
                            netbsd32_sigactionp_t nsa, \
                            netbsd32_sigactionp_t osa); }
-47     NOARGS          { gid_t|sys||getgid(void); }
+47     NOARGS          { gid_t|sys||getgid_with_egid(void); } getgid
 48     COMPAT_13 MODULAR compat_netbsd32_13    \
                        { int|netbsd32||sigprocmask(int how, \
                            int mask); } sigprocmask13



Home | Main Index | Thread Index | Old Index