git: 6dcd7db176f8 - main - freebsd32: fix type size of pointer array args
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Nov 2021 20:22:21 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=6dcd7db176f8ca4372e215f015636cfea7d4e52a
commit 6dcd7db176f8ca4372e215f015636cfea7d4e52a
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-11-17 20:12:23 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-11-17 20:12:23 +0000
freebsd32: fix type size of pointer array args
Make pointers to arrays of pointers `uint32_t *` so the sizes of the
array elements are correct. In an ideal world we'd use something
like __ptr32 annotations instead.
Reviewed by: kevans
---
sys/compat/freebsd32/freebsd32_proto.h | 8 ++++----
sys/compat/freebsd32/freebsd32_systrace_args.c | 16 ++++++++--------
sys/compat/freebsd32/syscalls.master | 10 +++++-----
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h
index 673618de8771..34ba0974c9b9 100644
--- a/sys/compat/freebsd32/freebsd32_proto.h
+++ b/sys/compat/freebsd32/freebsd32_proto.h
@@ -247,7 +247,7 @@ struct freebsd32_aio_write_args {
};
struct freebsd32_lio_listio_args {
char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];
- char acb_list_l_[PADL_(struct aiocb32 * const *)]; struct aiocb32 * const * acb_list; char acb_list_r_[PADR_(struct aiocb32 * const *)];
+ char acb_list_l_[PADL_(uint32_t *)]; uint32_t * acb_list; char acb_list_r_[PADR_(uint32_t *)];
char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)];
char sig_l_[PADL_(struct sigevent32 *)]; struct sigevent32 * sig; char sig_r_[PADR_(struct sigevent32 *)];
};
@@ -281,7 +281,7 @@ struct freebsd32_aio_return_args {
char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)];
};
struct freebsd32_aio_suspend_args {
- char aiocbp_l_[PADL_(struct aiocb32 * const *)]; struct aiocb32 * const * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 * const *)];
+ char aiocbp_l_[PADL_(uint32_t *)]; uint32_t * aiocbp; char aiocbp_r_[PADR_(uint32_t *)];
char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)];
char timeout_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * timeout; char timeout_r_[PADR_(const struct timespec32 *)];
};
@@ -305,7 +305,7 @@ struct freebsd32_sigwaitinfo_args {
char info_l_[PADL_(struct siginfo32 *)]; struct siginfo32 * info; char info_r_[PADR_(struct siginfo32 *)];
};
struct freebsd32_aio_waitcomplete_args {
- char aiocbp_l_[PADL_(struct aiocb32 **)]; struct aiocb32 ** aiocbp; char aiocbp_r_[PADR_(struct aiocb32 **)];
+ char aiocbp_l_[PADL_(uint32_t *)]; uint32_t * aiocbp; char aiocbp_r_[PADR_(uint32_t *)];
char timeout_l_[PADL_(struct timespec32 *)]; struct timespec32 * timeout; char timeout_r_[PADR_(struct timespec32 *)];
};
struct freebsd32_nmount_args {
@@ -1130,7 +1130,7 @@ struct freebsd6_freebsd32_aio_write_args {
};
struct freebsd6_freebsd32_lio_listio_args {
char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];
- char acb_list_l_[PADL_(struct oaiocb32 * const *)]; struct oaiocb32 * const * acb_list; char acb_list_r_[PADR_(struct oaiocb32 * const *)];
+ char acb_list_l_[PADL_(uint32_t *)]; uint32_t * acb_list; char acb_list_r_[PADR_(uint32_t *)];
char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)];
char sig_l_[PADL_(struct osigevent32 *)]; struct osigevent32 * sig; char sig_r_[PADR_(struct osigevent32 *)];
};
diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c
index 0315b0b3f142..ffeae23fc3a3 100644
--- a/sys/compat/freebsd32/freebsd32_systrace_args.c
+++ b/sys/compat/freebsd32/freebsd32_systrace_args.c
@@ -1278,7 +1278,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 257: {
struct freebsd32_lio_listio_args *p = params;
iarg[0] = p->mode; /* int */
- uarg[1] = (intptr_t)p->acb_list; /* struct aiocb32 * const * */
+ uarg[1] = (intptr_t)p->acb_list; /* uint32_t * */
iarg[2] = p->nent; /* int */
uarg[3] = (intptr_t)p->sig; /* struct sigevent32 * */
*n_args = 4;
@@ -1437,7 +1437,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* freebsd32_aio_suspend */
case 315: {
struct freebsd32_aio_suspend_args *p = params;
- uarg[0] = (intptr_t)p->aiocbp; /* struct aiocb32 * const * */
+ uarg[0] = (intptr_t)p->aiocbp; /* uint32_t * */
iarg[1] = p->nent; /* int */
uarg[2] = (intptr_t)p->timeout; /* const struct timespec32 * */
*n_args = 3;
@@ -1721,7 +1721,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* freebsd32_aio_waitcomplete */
case 359: {
struct freebsd32_aio_waitcomplete_args *p = params;
- uarg[0] = (intptr_t)p->aiocbp; /* struct aiocb32 ** */
+ uarg[0] = (intptr_t)p->aiocbp; /* uint32_t * */
uarg[1] = (intptr_t)p->timeout; /* struct timespec32 * */
*n_args = 2;
break;
@@ -2271,7 +2271,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct abort2_args *p = params;
uarg[0] = (intptr_t)p->why; /* const char * */
iarg[1] = p->nargs; /* int */
- uarg[2] = (intptr_t)p->args; /* void ** */
+ uarg[2] = (intptr_t)p->args; /* uint32_t * */
*n_args = 3;
break;
}
@@ -5445,7 +5445,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "int";
break;
case 1:
- p = "userland struct aiocb32 * const *";
+ p = "userland uint32_t *";
break;
case 2:
p = "int";
@@ -5702,7 +5702,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 315:
switch (ndx) {
case 0:
- p = "userland struct aiocb32 * const *";
+ p = "userland uint32_t *";
break;
case 1:
p = "int";
@@ -6166,7 +6166,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 359:
switch (ndx) {
case 0:
- p = "userland struct aiocb32 **";
+ p = "userland uint32_t *";
break;
case 1:
p = "userland struct timespec32 *";
@@ -7100,7 +7100,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "int";
break;
case 2:
- p = "userland void **";
+ p = "userland uint32_t *";
break;
default:
break;
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index ac0ece71ef5b..81ed039a4195 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -491,7 +491,7 @@
256 AUE_AIO_WRITE STD { int freebsd32_aio_write( \
struct aiocb32 *aiocbp); }
257 AUE_LIO_LISTIO STD { int freebsd32_lio_listio(int mode, \
- struct aiocb32 * const *acb_list, \
+ uint32_t *acb_list, \
int nent, struct sigevent32 *sig); }
258 AUE_NULL UNIMPL nosys
259 AUE_NULL UNIMPL nosys
@@ -572,7 +572,7 @@
314 AUE_AIO_RETURN STD { int freebsd32_aio_return( \
struct aiocb32 *aiocbp); }
315 AUE_AIO_SUSPEND STD { int freebsd32_aio_suspend( \
- struct aiocb32 * const * aiocbp, int nent, \
+ uint32_t * aiocbp, int nent, \
const struct timespec32 *timeout); }
316 AUE_AIO_CANCEL NOPROTO { int aio_cancel(int fd, \
struct aiocb *aiocbp); }
@@ -583,7 +583,7 @@
319 AUE_AIO_WRITE COMPAT6 { int freebsd32_aio_write( \
struct oaiocb32 *aiocbp); }
320 AUE_LIO_LISTIO COMPAT6 { int freebsd32_lio_listio(int mode, \
- struct oaiocb32 * const *acb_list, \
+ uint32_t *acb_list, \
int nent, struct osigevent32 *sig); }
321 AUE_NULL NOPROTO { int yield(void); }
322 AUE_NULL OBSOL thr_sleep
@@ -662,7 +662,7 @@
const char *path, int attrnamespace, \
const char *attrname); }
359 AUE_AIO_WAITCOMPLETE STD { int freebsd32_aio_waitcomplete( \
- struct aiocb32 **aiocbp, \
+ uint32_t *aiocbp, \
struct timespec32 *timeout); }
360 AUE_GETRESUID NOPROTO { int getresuid(uid_t *ruid, uid_t *euid, \
uid_t *suid); }
@@ -850,7 +850,7 @@
461 AUE_MQ_NOTIFY NOSTD { int freebsd32_kmq_notify(int mqd, \
const struct sigevent32 *sigev); }
462 AUE_MQ_UNLINK NOPROTO|NOSTD { int kmq_unlink(const char *path); }
-463 AUE_NULL NOPROTO { int abort2(const char *why, int nargs, void **args); }
+463 AUE_NULL NOPROTO { int abort2(const char *why, int nargs, uint32_t *args); }
464 AUE_NULL NOPROTO { int thr_set_name(int32_t id, const char *name); }
465 AUE_AIO_FSYNC STD { int freebsd32_aio_fsync(int op, \
struct aiocb32 *aiocbp); }