Author: brooks
Date: Wed Nov 14 00:46:02 2018
New Revision: 340424
URL: https://svnweb.freebsd.org/changeset/base/340424

Log:
  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:
  head/sys/compat/freebsd32/capabilities.conf
Modified:
  head/sys/compat/freebsd32/Makefile
  head/sys/compat/freebsd32/syscalls.conf
  head/sys/kern/makesyscalls.sh

Modified: head/sys/compat/freebsd32/Makefile
==============================================================================
--- head/sys/compat/freebsd32/Makefile  Wed Nov 14 00:33:03 2018        
(r340423)
+++ head/sys/compat/freebsd32/Makefile  Wed Nov 14 00:46:02 2018        
(r340424)
@@ -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: head/sys/compat/freebsd32/syscalls.conf
==============================================================================
--- head/sys/compat/freebsd32/syscalls.conf     Wed Nov 14 00:33:03 2018        
(r340423)
+++ head/sys/compat/freebsd32/syscalls.conf     Wed Nov 14 00:46:02 2018        
(r340424)
@@ -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: head/sys/kern/makesyscalls.sh
==============================================================================
--- head/sys/kern/makesyscalls.sh       Wed Nov 14 00:33:03 2018        
(r340423)
+++ head/sys/kern/makesyscalls.sh       Wed Nov 14 00:46:02 2018        
(r340424)
@@ -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\"
                "'
 
@@ -381,7 +383,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