Skip to contentSkip to conversation

Debian: Support runvar to set flask mode

PATCH In review Ian Campbell 2 participants 4 messages Dec 14, 2015 – Jan 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Debian: Support runvar to set flask mode

Currently it is hardcoding to enforcing but it might be useful to run with e.g. permissive or even disabled (aka dummy mode)

---
 Osstest/Debian.pm               | 10 ++++++++--
 overlay/etc/grub.d/20_linux_xen |  4 +++-
 2 files changed, 11 insertions(+), 3 deletions(-)
Osstest/Debian.pm +8 -2
index 76171c0..52b8ebc 100644
@@ -201,8 +201,9 @@ sub setupboot_uboot ($$$$) {
 	    my $set_flask_addr_r =
 		$flask_policy_addr_r ?
 		"setenv flask_policy_addr_r $flask_policy_addr_r" : "";
+            my $flaskmode = target_var($ho, 'flaskmode')//'enforcing';
 
-	    $xenhopt .= " flask=enforcing";
+	    $xenhopt .= " flask=${flaskmode}";
 	    $flask_commands = <<END;
 
 ${set_flask_addr_r}
@@ -604,7 +605,9 @@ END
                     $v =~ s/^\s*([\'\"])(.*)\1\s*$/$2/;
                     $k{$k}= $v;
                 }
-                next if m/^GRUB_CMDLINE_(?:XEN|LINUX(?:_XEN_REPLACE)?(?:_DEFAULT)?).*\=|^GRUB_DEFAULT.*\=/;
+                next if m/^GRUB_CMDLINE_(?:XEN|LINUX(?:_XEN_REPLACE)?(?:_DEFAULT)?).*\=/;
+                next if m/^GRUB_DEFAULT.*\=/;
+                next if m/^export GRUB_XEN_FLASK_MODE\=/;
                 print ::EO;
             }
             print ::EO <<END or die $!;
@@ -632,6 +635,9 @@ END
                 $rk =~ s/LINUX/LINUX_XEN_REPLACE/;
                 print ::EO "$rk=\"$v\"\n" or die $!;
 	    }
+
+	    my $flaskmode = target_var($ho, 'flaskmode')//'enforcing';
+	    print ::EO "export GRUB_XEN_FLASK_MODE=${flaskmode}\n";
         });
     };
 
overlay/etc/grub.d/20_linux_xen +3 -1
index aaead1b..5780cf3 100755
@@ -93,7 +93,9 @@ linux_entry ()
       if test ! -e "${xen_dirname}/${xenpolicy}" ; then
 	  return
       fi
-      xen_args=`echo $xen_args flask=enforcing`
+      if test -n "${GRUB_XEN_FLASK_MODE}" ; then
+          xen_args=`echo $xen_args flask=${GRUB_XEN_FLASK_MODE}`
+      fi
       if ${recovery} ; then
 	  title="$(gettext_quoted "%s, with Xen %s (XSM enabled) and Linux %s (recovery mode)")"
       else
Signature · 1 line
2.6.1
#1 lore raw

Ian Campbell writes ("[PATCH OSSTEST] Debian: Support runvar to set flask mode"):

Quoted 2 lines

Currently it is hardcoding to enforcing but it might be useful to run with e.g. permissive or even disabled (aka dummy mode)

...

overlay/etc/grub.d/20_linux_xen linux_entry () · line 98

Quoted 10 lines
overlay/etc/grub.d/20_linux_xen +3 -1
@@ -93,7 +93,9 @@ linux_entry ()
       if test ! -e "${xen_dirname}/${xenpolicy}" ; then
 	  return
       fi
-      xen_args=`echo $xen_args flask=enforcing`
+      if test -n "${GRUB_XEN_FLASK_MODE}" ; then
+          xen_args=`echo $xen_args flask=${GRUB_XEN_FLASK_MODE}`
+      fi

I thought we were hoping to eventually do away with our copy of this file. Has this change gone upstream ?

Ian.

#2 lore raw
Quoted 5 lines · Ian Jackson

Ian Campbell writes ("[PATCH OSSTEST] Debian: Support runvar to set flask mode"):

Quoted 2 lines

Currently it is hardcoding to enforcing but it might be useful to run with e.g.  permissive or even disabled (aka dummy mode)

...

Quoted 13 lines
Quoted 10 lines
overlay/etc/grub.d/20_linux_xen +0 -0
@@ -93,7 +93,9 @@ linux_entry ()

       if test ! -e "${xen_dirname}/${xenpolicy}" ; then return
       fi
-      xen_args=echo $xen_args flask=enforcing
+      if test -n "${GRUB_XEN_FLASK_MODE}" ; then
+          xen_args=echo $xen_args flask=${GRUB_XEN_FLASK_MODE} +      fi

I thought we were hoping to eventually do away with our copy of this file.  Has this change gone upstream ?

Sadly there has not been a peep from the maintainers on http://savannah.gnu
.org/bugs/?43420

Perhaps we should also send the patch to the upstream ML?

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

Ian Campbell writes ("Re: [PATCH OSSTEST] Debian: Support runvar to set flask mode"):

Quoted 8 lines · Ian Jackson
Quoted 2 lines

I thought we were hoping to eventually do away with our copy of this file.  Has this change gone upstream ?

Sadly there has not been a peep from the maintainers on http://savannah.gnu
.org/bugs/?43420

Perhaps we should also send the patch to the upstream ML?

That would perhaps help but TBH I am content if there is a bug in the upstream bug tracker.

Ian.