Author: brooks
Date: Wed Aug 28 07:53:10 2019
New Revision: 351566
URL: https://svnweb.freebsd.org/changeset/base/351566

Log:
  MFC r340424:
  
  Use the main capabilities.conf for freebsd32.
  
  Allow the location of capabilities.conf to be configured.
  
  Also allow a per-abi syscall prefix to be configured with the
  abi_func_prefix syscalls.conf variable and check syscalls against
  entries in capabilities.conf with and without the prefix amended.
  
  Take advantage of these two features to allow use shared
  capabilities.conf
  between the default syscall vector and the freebsd32 compatability
  layer.  We've been inconsistent about keeping the two in sync as
  evidenced by the bugs fixed in r340294.  This eliminates that problem
  going forward.
  
  Reviewed by:  kib
  Obtained from:        CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:        https://reviews.freebsd.org/D17932

Deleted:
  stable/12/sys/compat/freebsd32/capabilities.conf
Modified:
  stable/12/sys/compat/freebsd32/Makefile
  stable/12/sys/compat/freebsd32/syscalls.conf
  stable/12/sys/kern/makesyscalls.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/freebsd32/Makefile
==============================================================================
--- stable/12/sys/compat/freebsd32/Makefile     Wed Aug 28 07:43:31 2019        
(r351565)
+++ stable/12/sys/compat/freebsd32/Makefile     Wed Aug 28 07:53:10 2019        
(r351566)
@@ -11,7 +11,7 @@ all:
 sysent:  freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h 
freebsd32_systrace_args.c
 
 freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h 
freebsd32_systrace_args.c : \
-           ../../kern/makesyscalls.sh syscalls.master syscalls.conf 
capabilities.conf
+           ../../kern/makesyscalls.sh syscalls.master syscalls.conf 
../../kern/capabilities.conf
        sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
 
 clean:

Modified: stable/12/sys/compat/freebsd32/syscalls.conf
==============================================================================
--- stable/12/sys/compat/freebsd32/syscalls.conf        Wed Aug 28 07:43:31 
2019        (r351565)
+++ stable/12/sys/compat/freebsd32/syscalls.conf        Wed Aug 28 07:53:10 
2019        (r351566)
@@ -9,3 +9,5 @@ syscallprefix="FREEBSD32_SYS_"
 switchname="freebsd32_sysent"
 namesname="freebsd32_syscallnames"
 systrace="freebsd32_systrace_args.c"
+abi_func_prefix="freebsd32_"
+capabilities_conf="../../kern/capabilities.conf"

Modified: stable/12/sys/kern/makesyscalls.sh
==============================================================================
--- stable/12/sys/kern/makesyscalls.sh  Wed Aug 28 07:43:31 2019        
(r351565)
+++ stable/12/sys/kern/makesyscalls.sh  Wed Aug 28 07:53:10 2019        
(r351566)
@@ -45,14 +45,8 @@ sysarg="sysarg.switch.$$"
 sysprotoend="sysprotoend.$$"
 systracetmp="systrace.$$"
 systraceret="systraceret.$$"
+capabilities_conf="capabilities.conf"
 
-if [ -r capabilities.conf ]; then
-       capenabled=`egrep -v '^#|^$' capabilities.conf`
-       capenabled=`echo $capenabled | sed 's/ /,/g'`
-else
-       capenabled=""
-fi
-
 trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl 
$syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 
$syscompat10dcl $syscompat11 $syscompat11dcl $sysent $sysinc $sysarg 
$sysprotoend $systracetmp $systraceret" 0
 
 touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl 
$syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 
$syscompat10dcl $syscompat11 $syscompat11dcl $sysent $sysinc $sysarg 
$sysprotoend $systracetmp $systraceret
@@ -67,6 +61,13 @@ if [ -n "$2" ]; then
        . $2
 fi
 
+if [ -r $capabilities_conf ]; then
+       capenabled=`egrep -v '^#|^$' $capabilities_conf`
+       capenabled=`echo $capenabled | sed 's/ /,/g'`
+else
+       capenabled=""
+fi
+
 sed -e '
        # FreeBSD ID, includes, comments, and blank lines
        /.*\$FreeBSD/b done_joining
@@ -137,6 +138,7 @@ sed -e '
                switchname = \"$switchname\"
                namesname = \"$namesname\"
                infile = \"$1\"
+               abi_func_prefix = \"$abi_func_prefix\"
                capenabled_string = \"$capenabled\"
                "'
 
@@ -375,7 +377,8 @@ sed -e '
                # from it.
                #
                for (cap in capenabled) {
-                       if (funcname == capenabled[cap]) {
+                       if (funcname == capenabled[cap] ||
+                           funcname == abi_func_prefix capenabled[cap]) {
                                flags = "SYF_CAPENABLED";
                                break;
                        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to