The branch main has been updated by stevek:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=30cdbb5833f66354dee8e976bd1d7c2c699600c8

commit 30cdbb5833f66354dee8e976bd1d7c2c699600c8
Author:     Stephen J. Kiernan <[email protected]>
AuthorDate: 2023-08-24 15:32:26 +0000
Commit:     Stephen J. Kiernan <[email protected]>
CommitDate: 2023-08-24 22:45:31 +0000

    freebsd32: Remove mac_syscall from the unimpl list
    
    The mac_syscall system call works fine as long as any MAC module
    that provides a mpo_syscall method handles compat32 appropriately.
    
    Regenerate system call files for freebsd32.
    
    Reviewed by:    sjg
    Obtained from:  Juniper Networks, Inc.
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D41575
---
 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.conf             |  4 ++--
 5 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/sys/compat/freebsd32/freebsd32_syscall.h 
b/sys/compat/freebsd32/freebsd32_syscall.h
index e3777730be1c..3123c3b1f74c 100644
--- a/sys/compat/freebsd32/freebsd32_syscall.h
+++ b/sys/compat/freebsd32/freebsd32_syscall.h
@@ -326,6 +326,7 @@
 #define        FREEBSD32_SYS_lchflags  391
 #define        FREEBSD32_SYS_uuidgen   392
 #define        FREEBSD32_SYS_freebsd32_sendfile        393
+#define        FREEBSD32_SYS_mac_syscall       394
 #define        FREEBSD32_SYS_freebsd11_freebsd32_getfsstat     395
 #define        FREEBSD32_SYS_freebsd11_statfs  396
 #define        FREEBSD32_SYS_freebsd11_fstatfs 397
diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c 
b/sys/compat/freebsd32/freebsd32_syscalls.c
index ccc910ee5ca9..e64c36b32d00 100644
--- a/sys/compat/freebsd32/freebsd32_syscalls.c
+++ b/sys/compat/freebsd32/freebsd32_syscalls.c
@@ -399,7 +399,7 @@ const char *freebsd32_syscallnames[] = {
        "lchflags",                     /* 391 = lchflags */
        "uuidgen",                      /* 392 = uuidgen */
        "freebsd32_sendfile",                   /* 393 = freebsd32_sendfile */
-       "#394",                 /* 394 = mac_syscall */
+       "mac_syscall",                  /* 394 = mac_syscall */
        "compat11.freebsd32_getfsstat",         /* 395 = freebsd11 
freebsd32_getfsstat */
        "compat11.statfs",              /* 396 = freebsd11 statfs */
        "compat11.fstatfs",             /* 397 = freebsd11 fstatfs */
diff --git a/sys/compat/freebsd32/freebsd32_sysent.c 
b/sys/compat/freebsd32/freebsd32_sysent.c
index fec6f4a47bd6..2bb45fc3d2e2 100644
--- a/sys/compat/freebsd32/freebsd32_sysent.c
+++ b/sys/compat/freebsd32/freebsd32_sysent.c
@@ -455,7 +455,7 @@ struct sysent freebsd32_sysent[] = {
        { .sy_narg = AS(lchflags_args), .sy_call = (sy_call_t *)sys_lchflags, 
.sy_auevent = AUE_LCHFLAGS, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },  /* 
391 = lchflags */
        { .sy_narg = AS(uuidgen_args), .sy_call = (sy_call_t *)sys_uuidgen, 
.sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC 
},   /* 392 = uuidgen */
        { .sy_narg = AS(freebsd32_sendfile_args), .sy_call = (sy_call_t 
*)freebsd32_sendfile, .sy_auevent = AUE_SENDFILE, .sy_flags = SYF_CAPENABLED, 
.sy_thrcnt = SY_THR_STATIC },     /* 393 = freebsd32_sendfile */
-       { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, 
.sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT },                     /* 394 = 
mac_syscall */
+       { .sy_narg = AS(mac_syscall_args), .sy_call = (sy_call_t 
*)sys_mac_syscall, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = 
SY_THR_STATIC },        /* 394 = mac_syscall */
        { compat11(AS(freebsd11_freebsd32_getfsstat_args),freebsd32_getfsstat), 
.sy_auevent = AUE_GETFSSTAT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },       
/* 395 = freebsd11 freebsd32_getfsstat */
        { compat11(AS(freebsd11_statfs_args),statfs), .sy_auevent = AUE_STATFS, 
.sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },    /* 396 = freebsd11 statfs */
        { compat11(AS(freebsd11_fstatfs_args),fstatfs), .sy_auevent = 
AUE_FSTATFS, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC },    /* 
397 = freebsd11 fstatfs */
diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c 
b/sys/compat/freebsd32/freebsd32_systrace_args.c
index 2c26a0ddab2f..fb1fddc6ae5e 100644
--- a/sys/compat/freebsd32/freebsd32_systrace_args.c
+++ b/sys/compat/freebsd32/freebsd32_systrace_args.c
@@ -1848,6 +1848,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, 
int *n_args)
                *n_args = 8;
                break;
        }
+       /* mac_syscall */
+       case 394: {
+               struct mac_syscall_args *p = params;
+               uarg[a++] = (intptr_t)p->policy; /* const char * */
+               iarg[a++] = p->call; /* int */
+               uarg[a++] = (intptr_t)p->arg; /* void * */
+               *n_args = 3;
+               break;
+       }
        /* ksem_close */
        case 400: {
                struct ksem_close_args *p = params;
@@ -6328,6 +6337,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char 
*desc, size_t descsz)
                        break;
                };
                break;
+       /* mac_syscall */
+       case 394:
+               switch (ndx) {
+               case 0:
+                       p = "userland const char *";
+                       break;
+               case 1:
+                       p = "int";
+                       break;
+               case 2:
+                       p = "userland void *";
+                       break;
+               default:
+                       break;
+               };
+               break;
        /* ksem_close */
        case 400:
                switch (ndx) {
@@ -10145,6 +10170,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char 
*desc, size_t descsz)
                if (ndx == 0 || ndx == 1)
                        p = "int";
                break;
+       /* mac_syscall */
+       case 394:
+               if (ndx == 0 || ndx == 1)
+                       p = "int";
+               break;
        /* ksem_close */
        case 400:
                if (ndx == 0 || ndx == 1)
diff --git a/sys/compat/freebsd32/syscalls.conf 
b/sys/compat/freebsd32/syscalls.conf
index de198206dc47..af0409d8b3f1 100644
--- a/sys/compat/freebsd32/syscalls.conf
+++ b/sys/compat/freebsd32/syscalls.conf
@@ -47,7 +47,7 @@ syscall_no_abi_change="aio_cancel thr_exit thr_kill thr_kill2 
thr_self thr_set_n
 obsol="getkerninfo"
 
 # Syscalls without implementations:
-# *mac_* - should be implemented
+# __mac_* - should be implemented
 # afs3_syscall - requires significant porting, probably doesn't make sense
 # kldsym - can't be implemented (kernel virtual addresses can't fit in 32-bits)
 # lgetfh - should be implemented
@@ -55,4 +55,4 @@ obsol="getkerninfo"
 # nnpfs_syscall - requires significant porting, probably doesn't make sense
 # ntp_gettime - should be implemented
 # thr_create - was unimplemented and appears to be unnecessicary
-unimpl="afs3_syscall kldsym __mac_get_proc __mac_set_proc __mac_get_fd 
__mac_get_file __mac_set_fd __mac_set_file __mac_get_pid __mac_get_link 
__mac_set_link __mac_execve mac_syscall nfssvc nlm_syscall ntp_gettime lgetfh 
nnpfs_syscall thr_create"
+unimpl="afs3_syscall kldsym __mac_get_proc __mac_set_proc __mac_get_fd 
__mac_get_file __mac_set_fd __mac_set_file __mac_get_pid __mac_get_link 
__mac_set_link __mac_execve nfssvc nlm_syscall ntp_gettime lgetfh nnpfs_syscall 
thr_create"

Reply via email to