From 1d9983b2214d02ca823999ac0edbf34a06e6bb6b Mon Sep 17 00:00:00 2001 From: kevans Date: Wed, 25 Sep 2019 18:09:19 +0000 Subject: [PATCH] sysent: regenerate after r352705 This also implements it, fixes kdump, and removes no longer needed bits from lib/libc/sys/shm_open.c for the interim. --- lib/libc/sys/shm_open.c | 4 --- sys/compat/freebsd32/freebsd32_syscall.h | 2 +- sys/compat/freebsd32/freebsd32_syscalls.c | 2 +- sys/compat/freebsd32/freebsd32_sysent.c | 8 ++++- .../freebsd32/freebsd32_systrace_args.c | 30 ------------------- sys/kern/init_sysent.c | 8 ++++- sys/kern/syscalls.c | 2 +- sys/kern/systrace_args.c | 30 ------------------- sys/kern/uipc_shm.c | 4 ++- sys/sys/syscall.h | 2 +- sys/sys/syscall.mk | 2 +- sys/sys/sysproto.h | 14 ++++----- usr.bin/kdump/kdump.c | 4 ++- 13 files changed, 32 insertions(+), 80 deletions(-) diff --git a/lib/libc/sys/shm_open.c b/lib/libc/sys/shm_open.c index e6281f87bbb5..a7846474f092 100644 --- a/lib/libc/sys/shm_open.c +++ b/lib/libc/sys/shm_open.c @@ -46,10 +46,6 @@ __FBSDID("$FreeBSD$"); __weak_reference(shm_open, _shm_open); __weak_reference(shm_open, __sys_shm_open); -#ifndef SYS_freebsd12_shm_open -#define SYS_freebsd12_shm_open SYS_shm_open -#endif - #define SHM_OPEN2_OSREL 1300048 #define MEMFD_NAME_PREFIX "memfd:" diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index b79832ddfe34..c535b03a05d8 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -404,7 +404,7 @@ #define FREEBSD32_SYS_freebsd32_truncate 479 #define FREEBSD32_SYS_freebsd32_ftruncate 480 #define FREEBSD32_SYS_thr_kill2 481 -#define FREEBSD32_SYS_shm_open 482 +#define FREEBSD32_SYS_freebsd12_shm_open 482 #define FREEBSD32_SYS_shm_unlink 483 #define FREEBSD32_SYS_cpuset 484 #define FREEBSD32_SYS_freebsd32_cpuset_setid 485 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index a1a45b3988c7..1e42d2aaf0ce 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -500,7 +500,7 @@ const char *freebsd32_syscallnames[] = { "freebsd32_ftruncate", /* 480 = freebsd32_ftruncate */ #endif "thr_kill2", /* 481 = thr_kill2 */ - "shm_open", /* 482 = shm_open */ + "compat12.shm_open", /* 482 = freebsd12 shm_open */ "shm_unlink", /* 483 = shm_unlink */ "cpuset", /* 484 = cpuset */ #ifdef PAD64_REQUIRED diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index c87f9e4654fd..c64cd81c1f3c 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -51,6 +51,12 @@ #define compat11(n, name) 0, (sy_call_t *)nosys #endif +#ifdef COMPAT_FREEBSD12 +#define compat12(n, name) n, (sy_call_t *)__CONCAT(freebsd12_,name) +#else +#define compat12(n, name) 0, (sy_call_t *)nosys +#endif + /* The casts are bogus but will do for now. */ struct sysent freebsd32_sysent[] = { #if !defined(PAD64_REQUIRED) && !defined(__amd64__) @@ -547,7 +553,7 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_ftruncate_args), (sy_call_t *)freebsd32_ftruncate, AUE_FTRUNCATE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 480 = freebsd32_ftruncate */ #endif { AS(thr_kill2_args), (sy_call_t *)sys_thr_kill2, AUE_THR_KILL2, NULL, 0, 0, 0, SY_THR_STATIC }, /* 481 = thr_kill2 */ - { AS(shm_open_args), (sy_call_t *)sys_shm_open, AUE_SHMOPEN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 482 = shm_open */ + { compat12(AS(freebsd12_shm_open_args),shm_open), AUE_SHMOPEN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 482 = freebsd12 shm_open */ { AS(shm_unlink_args), (sy_call_t *)sys_shm_unlink, AUE_SHMUNLINK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 483 = shm_unlink */ { AS(cpuset_args), (sy_call_t *)sys_cpuset, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 484 = cpuset */ #ifdef PAD64_REQUIRED diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c index d3655038c737..45ed055967e2 100644 --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -2491,15 +2491,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } - /* shm_open */ - case 482: { - struct shm_open_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - iarg[1] = p->flags; /* int */ - iarg[2] = p->mode; /* mode_t */ - *n_args = 3; - break; - } /* shm_unlink */ case 483: { struct shm_unlink_args *p = params; @@ -7453,22 +7444,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* shm_open */ - case 482: - switch(ndx) { - case 0: - p = "userland const char *"; - break; - case 1: - p = "int"; - break; - case 2: - p = "mode_t"; - break; - default: - break; - }; - break; /* shm_unlink */ case 483: switch(ndx) { @@ -10476,11 +10451,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* shm_open */ - case 482: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* shm_unlink */ case 483: if (ndx == 0 || ndx == 1) diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 53b969739785..4727e8189254 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -47,6 +47,12 @@ #define compat11(n, name) 0, (sy_call_t *)nosys #endif +#ifdef COMPAT_FREEBSD12 +#define compat12(n, name) n, (sy_call_t *)__CONCAT(freebsd12_,name) +#else +#define compat12(n, name) 0, (sy_call_t *)nosys +#endif + /* The casts are bogus but will do for now. */ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 0 = syscall */ @@ -531,7 +537,7 @@ struct sysent sysent[] = { { AS(truncate_args), (sy_call_t *)sys_truncate, AUE_TRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 479 = truncate */ { AS(ftruncate_args), (sy_call_t *)sys_ftruncate, AUE_FTRUNCATE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 480 = ftruncate */ { AS(thr_kill2_args), (sy_call_t *)sys_thr_kill2, AUE_THR_KILL2, NULL, 0, 0, 0, SY_THR_STATIC }, /* 481 = thr_kill2 */ - { AS(shm_open_args), (sy_call_t *)sys_shm_open, AUE_SHMOPEN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 482 = shm_open */ + { compat12(AS(freebsd12_shm_open_args),shm_open), AUE_SHMOPEN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 482 = freebsd12 shm_open */ { AS(shm_unlink_args), (sy_call_t *)sys_shm_unlink, AUE_SHMUNLINK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 483 = shm_unlink */ { AS(cpuset_args), (sy_call_t *)sys_cpuset, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 484 = cpuset */ { AS(cpuset_setid_args), (sy_call_t *)sys_cpuset_setid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 485 = cpuset_setid */ diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index d9b361da2f31..1e5a69ce6a68 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -488,7 +488,7 @@ const char *syscallnames[] = { "truncate", /* 479 = truncate */ "ftruncate", /* 480 = ftruncate */ "thr_kill2", /* 481 = thr_kill2 */ - "shm_open", /* 482 = shm_open */ + "compat12.shm_open", /* 482 = freebsd12 shm_open */ "shm_unlink", /* 483 = shm_unlink */ "cpuset", /* 484 = cpuset */ "cpuset_setid", /* 485 = cpuset_setid */ diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 0ea576919c24..3816389eb3d0 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -2575,15 +2575,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } - /* shm_open */ - case 482: { - struct shm_open_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - iarg[1] = p->flags; /* int */ - iarg[2] = p->mode; /* mode_t */ - *n_args = 3; - break; - } /* shm_unlink */ case 483: { struct shm_unlink_args *p = params; @@ -7555,22 +7546,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* shm_open */ - case 482: - switch(ndx) { - case 0: - p = "userland const char *"; - break; - case 1: - p = "int"; - break; - case 2: - p = "mode_t"; - break; - default: - break; - }; - break; /* shm_unlink */ case 483: switch(ndx) { @@ -10445,11 +10420,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* shm_open */ - case 482: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* shm_unlink */ case 483: if (ndx == 0 || ndx == 1) diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 4c21da4bc38a..f25f47201b9a 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -904,13 +904,15 @@ kern_shm_open(struct thread *td, const char *userpath, int flags, mode_t mode, } /* System calls. */ +#ifdef COMPAT_FREEBSD12 int -sys_shm_open(struct thread *td, struct shm_open_args *uap) +freebsd12_shm_open(struct thread *td, struct freebsd12_shm_open_args *uap) { return (kern_shm_open(td, uap->path, uap->flags | O_CLOEXEC, uap->mode, NULL, F_SEAL_SEAL)); } +#endif int sys_shm_unlink(struct thread *td, struct shm_unlink_args *uap) diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index d1a0c5967e3d..57b764ec9085 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -418,7 +418,7 @@ #define SYS_truncate 479 #define SYS_ftruncate 480 #define SYS_thr_kill2 481 -#define SYS_shm_open 482 +#define SYS_freebsd12_shm_open 482 #define SYS_shm_unlink 483 #define SYS_cpuset 484 #define SYS_cpuset_setid 485 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index b85e9cea73c0..e813af1e7bcf 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -327,7 +327,7 @@ MIASM = \ truncate.o \ ftruncate.o \ thr_kill2.o \ - shm_open.o \ + freebsd12_shm_open.o \ shm_unlink.o \ cpuset.o \ cpuset_setid.o \ diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index b0f92e750ef0..0b9364830128 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -1381,11 +1381,6 @@ struct thr_kill2_args { char id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)]; char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)]; }; -struct shm_open_args { - char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; - char mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)]; -}; struct shm_unlink_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; }; @@ -2123,7 +2118,6 @@ int sys_lseek(struct thread *, struct lseek_args *); int sys_truncate(struct thread *, struct truncate_args *); int sys_ftruncate(struct thread *, struct ftruncate_args *); int sys_thr_kill2(struct thread *, struct thr_kill2_args *); -int sys_shm_open(struct thread *, struct shm_open_args *); int sys_shm_unlink(struct thread *, struct shm_unlink_args *); int sys_cpuset(struct thread *, struct cpuset_args *); int sys_cpuset_setid(struct thread *, struct cpuset_setid_args *); @@ -2654,6 +2648,12 @@ int freebsd11_mknodat(struct thread *, struct freebsd11_mknodat_args *); #ifdef COMPAT_FREEBSD12 +struct freebsd12_shm_open_args { + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)]; +}; +int freebsd12_shm_open(struct thread *, struct freebsd12_shm_open_args *); #endif /* COMPAT_FREEBSD12 */ @@ -3037,7 +3037,7 @@ int freebsd11_mknodat(struct thread *, struct freebsd11_mknodat_args *); #define SYS_AUE_truncate AUE_TRUNCATE #define SYS_AUE_ftruncate AUE_FTRUNCATE #define SYS_AUE_thr_kill2 AUE_THR_KILL2 -#define SYS_AUE_shm_open AUE_SHMOPEN +#define SYS_AUE_freebsd12_shm_open AUE_SHMOPEN #define SYS_AUE_shm_unlink AUE_SHMUNLINK #define SYS_AUE_cpuset AUE_NULL #define SYS_AUE_cpuset_setid AUE_NULL diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 25b2508f862f..3319d2f06607 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1246,7 +1246,8 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags) ip++; narg--; break; - case SYS_shm_open: +#ifdef SYS_freebsd12_shm_open + case SYS_freebsd12_shm_open: print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_open_flags, ip[0]); @@ -1255,6 +1256,7 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags) ip += 2; narg -= 2; break; +#endif case SYS_minherit: print_number(ip, narg, c); print_number(ip, narg, c);