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.
This commit is contained in:
kamil 2020-01-18 07:33:24 +00:00
parent 3929486f4f
commit 1741a0b962
7 changed files with 31 additions and 31 deletions

View File

@ -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. * System call numbers.

View File

@ -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. * System call argument lists.
@ -2693,7 +2693,7 @@ int compat_20_netbsd32_getfsstat(struct lwp *, const struct compat_20_netbsd32_g
int compat_43_netbsd32_olseek(struct lwp *, const struct compat_43_netbsd32_olseek_args *, register_t *); 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 *); int compat_40_netbsd32_mount(struct lwp *, const struct compat_40_netbsd32_mount_args *, register_t *);
@ -2701,7 +2701,7 @@ int netbsd32_unmount(struct lwp *, const struct netbsd32_unmount_args *, registe
int netbsd32_setuid(struct lwp *, const struct netbsd32_setuid_args *, register_t *); 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 *); int sys_geteuid(struct lwp *, const void *, register_t *);
@ -2747,7 +2747,7 @@ int netbsd32_ktrace(struct lwp *, const struct netbsd32_ktrace_args *, register_
int netbsd32_sigaction(struct lwp *, const struct netbsd32_sigaction_args *, register_t *); 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 *); int compat_13_netbsd32_sigprocmask(struct lwp *, const struct compat_13_netbsd32_sigprocmask_args *, register_t *);

View File

@ -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. * System call names.
@ -8,7 +8,7 @@
*/ */
#include <sys/cdefs.h> #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)
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
@ -584,11 +584,11 @@ const char *const altnetbsd32_syscallnames[] = {
/* 17 */ "break", /* 17 */ "break",
/* 18 */ NULL, /* compat_20_netbsd32_getfsstat */ /* 18 */ NULL, /* compat_20_netbsd32_getfsstat */
/* 19 */ NULL, /* compat_43_netbsd32_olseek */ /* 19 */ NULL, /* compat_43_netbsd32_olseek */
/* 20 */ NULL, /* getpid */ /* 20 */ "getpid_with_ppid",
/* 21 */ NULL, /* compat_40_netbsd32_mount */ /* 21 */ NULL, /* compat_40_netbsd32_mount */
/* 22 */ "unmount", /* 22 */ "unmount",
/* 23 */ "setuid", /* 23 */ "setuid",
/* 24 */ NULL, /* getuid */ /* 24 */ "getuid_with_euid",
/* 25 */ NULL, /* geteuid */ /* 25 */ NULL, /* geteuid */
/* 26 */ "ptrace", /* 26 */ "ptrace",
/* 27 */ "recvmsg", /* 27 */ "recvmsg",
@ -611,7 +611,7 @@ const char *const altnetbsd32_syscallnames[] = {
/* 44 */ "profil", /* 44 */ "profil",
/* 45 */ "ktrace", /* 45 */ "ktrace",
/* 46 */ "sigaction", /* 46 */ "sigaction",
/* 47 */ NULL, /* getgid */ /* 47 */ "getgid_with_egid",
/* 48 */ NULL, /* compat_13_sigprocmask13 */ /* 48 */ NULL, /* compat_13_sigprocmask13 */
/* 49 */ "__getlogin", /* 49 */ "__getlogin",
/* 50 */ "setlogin", /* 50 */ "setlogin",

View File

@ -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. * System call autoload table.
@ -8,7 +8,7 @@
*/ */
#include <sys/cdefs.h> #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) #if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"

View File

@ -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. * System call switch table.
@ -8,7 +8,7 @@
*/ */
#include <sys/cdefs.h> #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) #if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
@ -212,7 +212,7 @@ struct sysent netbsd32_sysent[] = {
.sy_call = (sy_call_t *)sys_nomodule .sy_call = (sy_call_t *)sys_nomodule
}, /* 19 = compat_43_netbsd32_olseek */ }, /* 19 = compat_43_netbsd32_olseek */
{ {
.sy_call = (sy_call_t *)sys_getpid .sy_call = (sy_call_t *)sys_getpid_with_ppid
}, /* 20 = getpid */ }, /* 20 = getpid */
{ {
ns(struct compat_40_netbsd32_mount_args), ns(struct compat_40_netbsd32_mount_args),
@ -227,7 +227,7 @@ struct sysent netbsd32_sysent[] = {
.sy_call = (sy_call_t *)netbsd32_setuid .sy_call = (sy_call_t *)netbsd32_setuid
}, /* 23 = netbsd32_setuid */ }, /* 23 = netbsd32_setuid */
{ {
.sy_call = (sy_call_t *)sys_getuid .sy_call = (sy_call_t *)sys_getuid_with_euid
}, /* 24 = getuid */ }, /* 24 = getuid */
{ {
.sy_call = (sy_call_t *)sys_geteuid .sy_call = (sy_call_t *)sys_geteuid
@ -313,7 +313,7 @@ struct sysent netbsd32_sysent[] = {
.sy_call = (sy_call_t *)netbsd32_sigaction .sy_call = (sy_call_t *)netbsd32_sigaction
}, /* 46 = netbsd32_sigaction */ }, /* 46 = netbsd32_sigaction */
{ {
.sy_call = (sy_call_t *)sys_getgid .sy_call = (sy_call_t *)sys_getgid_with_egid
}, /* 47 = getgid */ }, /* 47 = getgid */
{ {
ns(struct compat_13_netbsd32_sigprocmask_args), ns(struct compat_13_netbsd32_sigprocmask_args),

View File

@ -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. * System call argument to DTrace register array converstion.
@ -164,7 +164,7 @@ systrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_
*n_args = 3; *n_args = 3;
break; break;
} }
/* sys_getpid */ /* sys_getpid_with_ppid */
case 20: { case 20: {
*n_args = 0; *n_args = 0;
break; break;
@ -194,7 +194,7 @@ systrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_
*n_args = 1; *n_args = 1;
break; break;
} }
/* sys_getuid */ /* sys_getuid_with_euid */
case 24: { case 24: {
*n_args = 0; *n_args = 0;
break; break;
@ -375,7 +375,7 @@ systrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_
*n_args = 3; *n_args = 3;
break; break;
} }
/* sys_getgid */ /* sys_getgid_with_egid */
case 47: { case 47: {
*n_args = 0; *n_args = 0;
break; break;
@ -3785,7 +3785,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break; break;
}; };
break; break;
/* sys_getpid */ /* sys_getpid_with_ppid */
case 20: case 20:
break; break;
/* netbsd32_mount */ /* netbsd32_mount */
@ -3830,7 +3830,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break; break;
}; };
break; break;
/* sys_getuid */ /* sys_getuid_with_euid */
case 24: case 24:
break; break;
/* sys_geteuid */ /* sys_geteuid */
@ -4114,7 +4114,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break; break;
}; };
break; break;
/* sys_getgid */ /* sys_getgid_with_egid */
case 47: case 47:
break; break;
/* netbsd32_sigprocmask */ /* netbsd32_sigprocmask */
@ -9633,7 +9633,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1) if (ndx == 0 || ndx == 1)
p = "netbsd32_long"; p = "netbsd32_long";
break; break;
/* sys_getpid */ /* sys_getpid_with_ppid */
case 20: case 20:
/* netbsd32_mount */ /* netbsd32_mount */
case 21: case 21:
@ -9650,7 +9650,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1) if (ndx == 0 || ndx == 1)
p = "int"; p = "int";
break; break;
/* sys_getuid */ /* sys_getuid_with_euid */
case 24: case 24:
/* sys_geteuid */ /* sys_geteuid */
case 25: case 25:
@ -9747,7 +9747,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1) if (ndx == 0 || ndx == 1)
p = "int"; p = "int";
break; break;
/* sys_getgid */ /* sys_getgid_with_egid */
case 47: case 47:
/* netbsd32_sigprocmask */ /* netbsd32_sigprocmask */
case 48: case 48:

View File

@ -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 ; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -97,7 +97,7 @@
19 COMPAT_43 MODULAR compat_netbsd32_43 \ 19 COMPAT_43 MODULAR compat_netbsd32_43 \
{ netbsd32_long|netbsd32||olseek(int fd, \ { netbsd32_long|netbsd32||olseek(int fd, \
netbsd32_long offset, int whence); } 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 \ 21 COMPAT_40 MODULAR compat_netbsd32_40 \
{ int|netbsd32||mount(netbsd32_charp type, \ { int|netbsd32||mount(netbsd32_charp type, \
netbsd32_charp path, int flags, \ netbsd32_charp path, int flags, \
@ -105,7 +105,7 @@
22 STD { int|netbsd32||unmount(netbsd32_charp path, \ 22 STD { int|netbsd32||unmount(netbsd32_charp path, \
int flags); } int flags); }
23 STD { int|netbsd32||setuid(uid_t uid); } 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); } 25 NOARGS { uid_t|sys||geteuid(void); }
26 STD MODULAR compat_netbsd32_ptrace \ 26 STD MODULAR compat_netbsd32_ptrace \
{ int|netbsd32||ptrace(int req, pid_t pid, \ { int|netbsd32||ptrace(int req, pid_t pid, \
@ -150,7 +150,7 @@
46 STD { int|netbsd32||sigaction(int signum, \ 46 STD { int|netbsd32||sigaction(int signum, \
netbsd32_sigactionp_t nsa, \ netbsd32_sigactionp_t nsa, \
netbsd32_sigactionp_t osa); } 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 \ 48 COMPAT_13 MODULAR compat_netbsd32_13 \
{ int|netbsd32||sigprocmask(int how, \ { int|netbsd32||sigprocmask(int how, \
int mask); } sigprocmask13 int mask); } sigprocmask13