git: 91301e6ea54a - main - freebsd32: don't implement kldsym

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Wed, 17 Nov 2021 20:22:37 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=91301e6ea54abe2c163c4b502e5116e1f9a0ad2a

commit 91301e6ea54abe2c163c4b502e5116e1f9a0ad2a
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-11-17 20:12:25 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-11-17 20:12:25 +0000

    freebsd32: don't implement kldsym
    
    Previously we fell back to sys_kldsym, but because we'd always
    mismatch on the version field we'd return EINVAL.  A freebsd32
    implementation is impossible with the current ABI as there simply
    isn't space to store a kernel virtual address in a uint32_t.
    
    Reviewed by:    kevans
---
 sys/compat/freebsd32/freebsd32_syscall.h       |  1 -
 sys/compat/freebsd32/freebsd32_syscalls.c      |  2 +-
 sys/compat/freebsd32/freebsd32_sysent.c        |  2 +-
 sys/compat/freebsd32/freebsd32_systrace_args.c | 30 --------------------------
 sys/compat/freebsd32/syscalls.master           |  3 +--
 5 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h
index e97827d96169..71055205093a 100644
--- a/sys/compat/freebsd32/freebsd32_syscall.h
+++ b/sys/compat/freebsd32/freebsd32_syscall.h
@@ -279,7 +279,6 @@
 #define	FREEBSD32_SYS_freebsd32_sched_rr_get_interval	334
 #define	FREEBSD32_SYS_utrace	335
 				/* 336 is freebsd4 freebsd32_sendfile */
-#define	FREEBSD32_SYS_kldsym	337
 #define	FREEBSD32_SYS_freebsd32_jail	338
 #define	FREEBSD32_SYS_sigprocmask	340
 #define	FREEBSD32_SYS_sigsuspend	341
diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c
index 13ed9e9dd591..3a2a515b9dc5 100644
--- a/sys/compat/freebsd32/freebsd32_syscalls.c
+++ b/sys/compat/freebsd32/freebsd32_syscalls.c
@@ -346,7 +346,7 @@ const char *freebsd32_syscallnames[] = {
 	"freebsd32_sched_rr_get_interval",			/* 334 = freebsd32_sched_rr_get_interval */
 	"utrace",			/* 335 = utrace */
 	"compat4.freebsd32_sendfile",		/* 336 = freebsd4 freebsd32_sendfile */
-	"kldsym",			/* 337 = kldsym */
+	"#337",			/* 337 = kldsym */
 	"freebsd32_jail",			/* 338 = freebsd32_jail */
 	"#339",			/* 339 = pioctl */
 	"sigprocmask",			/* 340 = sigprocmask */
diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c
index 0a2fffabdeaf..806d0437884a 100644
--- a/sys/compat/freebsd32/freebsd32_sysent.c
+++ b/sys/compat/freebsd32/freebsd32_sysent.c
@@ -399,7 +399,7 @@ struct sysent freebsd32_sysent[] = {
 	{ .sy_narg = AS(freebsd32_sched_rr_get_interval_args), .sy_call = (sy_call_t *)freebsd32_sched_rr_get_interval, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 334 = freebsd32_sched_rr_get_interval */
 	{ .sy_narg = AS(utrace_args), .sy_call = (sy_call_t *)sys_utrace, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 335 = utrace */
 	{ compat4(AS(freebsd4_freebsd32_sendfile_args),freebsd32_sendfile), .sy_auevent = AUE_SENDFILE, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 336 = freebsd4 freebsd32_sendfile */
-	{ .sy_narg = AS(kldsym_args), .sy_call = (sy_call_t *)sys_kldsym, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },	/* 337 = kldsym */
+	{ .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT },			/* 337 = kldsym */
 	{ .sy_narg = AS(freebsd32_jail_args), .sy_call = (sy_call_t *)freebsd32_jail, .sy_auevent = AUE_JAIL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },	/* 338 = freebsd32_jail */
 	{ .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT },			/* 339 = pioctl */
 	{ .sy_narg = AS(sigprocmask_args), .sy_call = (sy_call_t *)sys_sigprocmask, .sy_auevent = AUE_SIGPROCMASK, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },	/* 340 = sigprocmask */
diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c
index e06efa75b025..21d59a5fdfd9 100644
--- a/sys/compat/freebsd32/freebsd32_systrace_args.c
+++ b/sys/compat/freebsd32/freebsd32_systrace_args.c
@@ -1550,15 +1550,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
 		*n_args = 2;
 		break;
 	}
-	/* kldsym */
-	case 337: {
-		struct kldsym_args *p = params;
-		iarg[0] = p->fileid; /* int */
-		iarg[1] = p->cmd; /* int */
-		uarg[2] = (intptr_t)p->data; /* void * */
-		*n_args = 3;
-		break;
-	}
 	/* freebsd32_jail */
 	case 338: {
 		struct freebsd32_jail_args *p = params;
@@ -5867,22 +5858,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
 			break;
 		};
 		break;
-	/* kldsym */
-	case 337:
-		switch (ndx) {
-		case 0:
-			p = "int";
-			break;
-		case 1:
-			p = "int";
-			break;
-		case 2:
-			p = "userland void *";
-			break;
-		default:
-			break;
-		};
-		break;
 	/* freebsd32_jail */
 	case 338:
 		switch (ndx) {
@@ -10151,11 +10126,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
 		if (ndx == 0 || ndx == 1)
 			p = "int";
 		break;
-	/* kldsym */
-	case 337:
-		if (ndx == 0 || ndx == 1)
-			p = "int";
-		break;
 	/* freebsd32_jail */
 	case 338:
 		if (ndx == 0 || ndx == 1)
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 0408c7ecf265..c9cac48f7ac4 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -611,8 +611,7 @@
 				    uint32_t offset1, uint32_t offset2, \
 				    size_t nbytes, struct sf_hdtr32 *hdtr, \
 				    off_t *sbytes, int flags); }
-337	AUE_NULL	NOPROTO	{ int kldsym(int fileid, int cmd, \
-				    void *data); }
+337	AUE_NULL	UNIMPL	kldsym
 338	AUE_JAIL	STD	{ int freebsd32_jail(struct jail32 *jail); }
 339	AUE_NULL	UNIMPL	pioctl
 340	AUE_SIGPROCMASK	NOPROTO	{ int sigprocmask(int how, \