From nobody Wed Nov 17 20:22:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 737351855517; Wed, 17 Nov 2021 20:22:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HvZ9d2Vffz4rDc; Wed, 17 Nov 2021 20:22:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C0A4277FC; Wed, 17 Nov 2021 20:22:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AHKMhba060093; Wed, 17 Nov 2021 20:22:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AHKMhNc060092; Wed, 17 Nov 2021 20:22:43 GMT (envelope-from git) Date: Wed, 17 Nov 2021 20:22:43 GMT Message-Id: <202111172022.1AHKMhNc060092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: d257e57d18e6 - main - freebsd32: add missing pads to preadv and pwritev List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d257e57d18e6d1569fc255aa7a43981f6c8068fb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=d257e57d18e6d1569fc255aa7a43981f6c8068fb commit d257e57d18e6d1569fc255aa7a43981f6c8068fb Author: Brooks Davis AuthorDate: 2021-11-17 20:12:25 +0000 Commit: Brooks Davis CommitDate: 2021-11-17 20:12:25 +0000 freebsd32: add missing pads to preadv and pwritev Reviewed by: kevans --- sys/compat/freebsd32/freebsd32_proto.h | 47 +++++++++++++ sys/compat/freebsd32/freebsd32_syscall.h | 2 + sys/compat/freebsd32/freebsd32_syscalls.c | 5 ++ sys/compat/freebsd32/freebsd32_sysent.c | 5 ++ sys/compat/freebsd32/freebsd32_systrace_args.c | 93 ++++++++++++++++++++++++++ sys/compat/freebsd32/syscalls.master | 13 ++++ 6 files changed, 165 insertions(+) diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h index 701c4494b628..6c1dc013835d 100644 --- a/sys/compat/freebsd32/freebsd32_proto.h +++ b/sys/compat/freebsd32/freebsd32_proto.h @@ -247,20 +247,39 @@ struct freebsd32_lutimes_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char tptr_l_[PADL_(const struct timeval32 *)]; const struct timeval32 * tptr; char tptr_r_[PADR_(const struct timeval32 *)]; }; +#ifdef PAD64_REQUIRED struct freebsd32_preadv_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; + char _pad_l_[PADL_(int)]; int _pad; char _pad_r_[PADR_(int)]; char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)]; char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)]; }; struct freebsd32_pwritev_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; + char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; + char _pad_l_[PADL_(int)]; int _pad; char _pad_r_[PADR_(int)]; + char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)]; + char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)]; +}; +#else +struct freebsd32_preadv_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)]; char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)]; }; +struct freebsd32_pwritev_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; + char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; + char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)]; + char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)]; +}; +#endif struct freebsd32_modstat_args { char modid_l_[PADL_(int)]; int modid; char modid_r_[PADR_(int)]; char stat_l_[PADL_(struct module_stat32 *)]; struct module_stat32 * stat; char stat_r_[PADR_(struct module_stat32 *)]; @@ -801,8 +820,13 @@ int freebsd32_aio_read(struct thread *, struct freebsd32_aio_read_args *); int freebsd32_aio_write(struct thread *, struct freebsd32_aio_write_args *); int freebsd32_lio_listio(struct thread *, struct freebsd32_lio_listio_args *); int freebsd32_lutimes(struct thread *, struct freebsd32_lutimes_args *); +#ifdef PAD64_REQUIRED int freebsd32_preadv(struct thread *, struct freebsd32_preadv_args *); int freebsd32_pwritev(struct thread *, struct freebsd32_pwritev_args *); +#else +int freebsd32_preadv(struct thread *, struct freebsd32_preadv_args *); +int freebsd32_pwritev(struct thread *, struct freebsd32_pwritev_args *); +#endif int freebsd32_modstat(struct thread *, struct freebsd32_modstat_args *); int freebsd32_kldstat(struct thread *, struct freebsd32_kldstat_args *); int freebsd32_aio_return(struct thread *, struct freebsd32_aio_return_args *); @@ -979,6 +1003,9 @@ struct ofreebsd32_getdirentries_args { #ifdef PAD64_REQUIRED #else #endif +#ifdef PAD64_REQUIRED +#else +#endif int ofreebsd32_lseek(struct thread *, struct ofreebsd32_lseek_args *); int ofreebsd32_stat(struct thread *, struct ofreebsd32_stat_args *); int ofreebsd32_lstat(struct thread *, struct ofreebsd32_lstat_args *); @@ -1013,6 +1040,9 @@ struct freebsd4_freebsd32_fstatfs_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char buf_l_[PADL_(struct ostatfs32 *)]; struct ostatfs32 * buf; char buf_r_[PADR_(struct ostatfs32 *)]; }; +#ifdef PAD64_REQUIRED +#else +#endif struct freebsd4_freebsd32_fhstatfs_args { char u_fhp_l_[PADL_(const struct fhandle *)]; const struct fhandle * u_fhp; char u_fhp_r_[PADR_(const struct fhandle *)]; char buf_l_[PADL_(struct ostatfs32 *)]; struct ostatfs32 * buf; char buf_r_[PADR_(struct ostatfs32 *)]; @@ -1111,6 +1141,9 @@ struct freebsd6_freebsd32_ftruncate_args { char length1_l_[PADL_(uint32_t)]; uint32_t length1; char length1_r_[PADR_(uint32_t)]; char length2_l_[PADL_(uint32_t)]; uint32_t length2; char length2_r_[PADR_(uint32_t)]; }; +#ifdef PAD64_REQUIRED +#else +#endif struct freebsd6_freebsd32_aio_read_args { char aiocbp_l_[PADL_(struct oaiocb32 *)]; struct oaiocb32 * aiocbp; char aiocbp_r_[PADR_(struct oaiocb32 *)]; }; @@ -1187,6 +1220,9 @@ struct freebsd7_freebsd32_shmctl_args { #ifdef PAD64_REQUIRED #else #endif +#ifdef PAD64_REQUIRED +#else +#endif int freebsd7_freebsd32___semctl(struct thread *, struct freebsd7_freebsd32___semctl_args *); int freebsd7_freebsd32_msgctl(struct thread *, struct freebsd7_freebsd32_msgctl_args *); int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_args *); @@ -1199,6 +1235,9 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_ #if !defined(PAD64_REQUIRED) && !defined(__amd64__) #define PAD64_REQUIRED #endif +#ifdef PAD64_REQUIRED +#else +#endif struct freebsd10_freebsd32_umtx_lock_args { char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)]; }; @@ -1249,6 +1288,9 @@ struct freebsd11_freebsd32_getdirentries_args { char count_l_[PADL_(u_int)]; u_int count; char count_r_[PADR_(u_int)]; char basep_l_[PADL_(int32_t *)]; int32_t * basep; char basep_r_[PADR_(int32_t *)]; }; +#ifdef PAD64_REQUIRED +#else +#endif struct freebsd11_freebsd32_fhstat_args { char u_fhp_l_[PADL_(const struct fhandle *)]; const struct fhandle * u_fhp; char u_fhp_r_[PADR_(const struct fhandle *)]; char sb_l_[PADL_(struct freebsd11_stat32 *)]; struct freebsd11_stat32 * sb; char sb_r_[PADR_(struct freebsd11_stat32 *)]; @@ -1313,6 +1355,9 @@ int freebsd11_freebsd32_fstatat(struct thread *, struct freebsd11_freebsd32_fsta #ifdef PAD64_REQUIRED #else #endif +#ifdef PAD64_REQUIRED +#else +#endif #endif /* COMPAT_FREEBSD12 */ @@ -1389,6 +1434,8 @@ int freebsd11_freebsd32_fstatat(struct thread *, struct freebsd11_freebsd32_fsta #define FREEBSD32_SYS_AUE_freebsd32_lutimes AUE_LUTIMES #define FREEBSD32_SYS_AUE_freebsd32_preadv AUE_PREADV #define FREEBSD32_SYS_AUE_freebsd32_pwritev AUE_PWRITEV +#define FREEBSD32_SYS_AUE_freebsd32_preadv AUE_PREADV +#define FREEBSD32_SYS_AUE_freebsd32_pwritev AUE_PWRITEV #define FREEBSD32_SYS_AUE_freebsd4_freebsd32_fhstatfs AUE_FHSTATFS #define FREEBSD32_SYS_AUE_freebsd11_freebsd32_fhstat AUE_FHSTAT #define FREEBSD32_SYS_AUE_freebsd32_modstat AUE_NULL diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index 312c136aa074..426221bf94eb 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -239,6 +239,8 @@ #define FREEBSD32_SYS_freebsd11_nfstat 279 #define FREEBSD32_SYS_freebsd11_nlstat 280 #define FREEBSD32_SYS_freebsd32_preadv 289 +#define FREEBSD32_SYS_freebsd32_pwritev 290 +#define FREEBSD32_SYS_freebsd32_preadv 289 #define FREEBSD32_SYS_freebsd32_pwritev 290 /* 297 is freebsd4 freebsd32_fhstatfs */ #define FREEBSD32_SYS_fhopen 298 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index 31887661f39b..1630992680a2 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -298,8 +298,13 @@ const char *freebsd32_syscallnames[] = { "#286", /* 286 = nosys */ "#287", /* 287 = nosys */ "#288", /* 288 = nosys */ +#ifdef PAD64_REQUIRED "freebsd32_preadv", /* 289 = freebsd32_preadv */ "freebsd32_pwritev", /* 290 = freebsd32_pwritev */ +#else + "freebsd32_preadv", /* 289 = freebsd32_preadv */ + "freebsd32_pwritev", /* 290 = freebsd32_pwritev */ +#endif "#291", /* 291 = nosys */ "#292", /* 292 = nosys */ "#293", /* 293 = nosys */ diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index dc700fca2a10..76d402de3f5e 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -351,8 +351,13 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 286 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 287 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 288 = nosys */ +#ifdef PAD64_REQUIRED { .sy_narg = AS(freebsd32_preadv_args), .sy_call = (sy_call_t *)freebsd32_preadv, .sy_auevent = AUE_PREADV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 289 = freebsd32_preadv */ { .sy_narg = AS(freebsd32_pwritev_args), .sy_call = (sy_call_t *)freebsd32_pwritev, .sy_auevent = AUE_PWRITEV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 290 = freebsd32_pwritev */ +#else + { .sy_narg = AS(freebsd32_preadv_args), .sy_call = (sy_call_t *)freebsd32_preadv, .sy_auevent = AUE_PREADV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 289 = freebsd32_preadv */ + { .sy_narg = AS(freebsd32_pwritev_args), .sy_call = (sy_call_t *)freebsd32_pwritev, .sy_auevent = AUE_PWRITEV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 290 = freebsd32_pwritev */ +#endif { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 291 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 292 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 293 = nosys */ diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c index 98fb1dea15a8..f61641e3ab24 100644 --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -1307,6 +1307,32 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 2; break; } +#ifdef PAD64_REQUIRED + /* freebsd32_preadv */ + case 289: { + struct freebsd32_preadv_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t)p->iovp; /* struct iovec32 * */ + uarg[2] = p->iovcnt; /* u_int */ + iarg[3] = p->_pad; /* int */ + uarg[4] = p->offset1; /* uint32_t */ + uarg[5] = p->offset2; /* uint32_t */ + *n_args = 6; + break; + } + /* freebsd32_pwritev */ + case 290: { + struct freebsd32_pwritev_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t)p->iovp; /* struct iovec32 * */ + uarg[2] = p->iovcnt; /* u_int */ + iarg[3] = p->_pad; /* int */ + uarg[4] = p->offset1; /* uint32_t */ + uarg[5] = p->offset2; /* uint32_t */ + *n_args = 6; + break; + } +#else /* freebsd32_preadv */ case 289: { struct freebsd32_preadv_args *p = params; @@ -1329,6 +1355,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 5; break; } +#endif /* fhopen */ case 298: { struct fhopen_args *p = params; @@ -5498,6 +5525,58 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; +#ifdef PAD64_REQUIRED + /* freebsd32_preadv */ + case 289: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "userland struct iovec32 *"; + break; + case 2: + p = "u_int"; + break; + case 3: + p = "int"; + break; + case 4: + p = "uint32_t"; + break; + case 5: + p = "uint32_t"; + break; + default: + break; + }; + break; + /* freebsd32_pwritev */ + case 290: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "userland struct iovec32 *"; + break; + case 2: + p = "u_int"; + break; + case 3: + p = "int"; + break; + case 4: + p = "uint32_t"; + break; + case 5: + p = "uint32_t"; + break; + default: + break; + }; + break; +#else /* freebsd32_preadv */ case 289: switch (ndx) { @@ -5542,6 +5621,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; +#endif /* fhopen */ case 298: switch (ndx) { @@ -10009,6 +10089,18 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; +#ifdef PAD64_REQUIRED + /* freebsd32_preadv */ + case 289: + if (ndx == 0 || ndx == 1) + p = "ssize_t"; + break; + /* freebsd32_pwritev */ + case 290: + if (ndx == 0 || ndx == 1) + p = "ssize_t"; + break; +#else /* freebsd32_preadv */ case 289: if (ndx == 0 || ndx == 1) @@ -10019,6 +10111,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "ssize_t"; break; +#endif /* fhopen */ case 298: if (ndx == 0 || ndx == 1) diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index c4f94cab1add..410499e57609 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -541,14 +541,27 @@ 286 AUE_NULL UNIMPL nosys 287 AUE_NULL UNIMPL nosys 288 AUE_NULL UNIMPL nosys +#ifdef PAD64_REQUIRED 289 AUE_PREADV STD { ssize_t freebsd32_preadv(int fd, \ struct iovec32 *iovp, \ u_int iovcnt, \ + int _pad, \ uint32_t offset1, uint32_t offset2); } 290 AUE_PWRITEV STD { ssize_t freebsd32_pwritev(int fd, \ + struct iovec32 *iovp, \ + u_int iovcnt, \ + int _pad, \ + uint32_t offset1, uint32_t offset2); } +#else +289 AUE_PREADV STD { ssize_t freebsd32_preadv(int fd, \ struct iovec32 *iovp, \ u_int iovcnt, \ uint32_t offset1, uint32_t offset2); } +290 AUE_PWRITEV STD { ssize_t freebsd32_pwritev(int fd, \ + struct iovec32 *iovp, \ + u_int iovcnt, \ + uint32_t offset1, uint32_t offset2); } +#endif 291 AUE_NULL UNIMPL nosys 292 AUE_NULL UNIMPL nosys 293 AUE_NULL UNIMPL nosys