diff mbox series

selinux-testsuite: don't break the system after running the cgroups_label tests

Message ID 156763458867.12445.11356660144461085311.stgit@chester (mailing list archive)
State Accepted
Headers show
Series selinux-testsuite: don't break the system after running the cgroups_label tests | expand

Commit Message

Paul Moore Sept. 4, 2019, 10:03 p.m. UTC
From: Paul Moore <paul@paul-moore.com>

Commit be0ca8feeb9b ("selinux-testsuite: ensure the cgroups_label
tests works on old and new systems"), and perhaps an earlier related
commit, broke systems after the tests were run by operating on
/sys/fs/cgroup/unified directly and not a sub-directory.  Fix this
by restoring the old (sub-directory) behavior.

Reported-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 0 files changed

Comments

Stephen Smalley Sept. 5, 2019, 12:24 p.m. UTC | #1
On 9/4/19 6:03 PM, Paul Moore wrote:
> From: Paul Moore <paul@paul-moore.com>
> 
> Commit be0ca8feeb9b ("selinux-testsuite: ensure the cgroups_label
> tests works on old and new systems"), and perhaps an earlier related
> commit, broke systems after the tests were run by operating on
> /sys/fs/cgroup/unified directly and not a sub-directory.  Fix this
> by restoring the old (sub-directory) behavior.
> 
> Reported-by: Stephen Smalley <sds@tycho.nsa.gov>
> Signed-off-by: Paul Moore <paul@paul-moore.com>

Tested-by: Stephen Smalley <sds@tycho.nsa.gov>

> ---
>   0 files changed

That's a little odd.

> 
> diff --git a/tests/cgroupfs_label/test b/tests/cgroupfs_label/test
> index 13f0434..3accca0 100755
> --- a/tests/cgroupfs_label/test
> +++ b/tests/cgroupfs_label/test
> @@ -6,8 +6,11 @@ BEGIN { plan tests => 2 }
>   my $ret;
>   
>   # Older systems use /sys/fs/cgroup/unified, newer use /sys/fs/cgroup.
> -my $dir = "/sys/fs/cgroup/unified";
> -if ( !-d $dir ) {
> +my $dir;
> +if ( -d "/sys/fs/cgroup/unified" ) {
> +    $dir = "/sys/fs/cgroup/unified/selinuxtest";
> +}
> +else {
>       $dir = "/sys/fs/cgroup/selinuxtest";
>   }
>   
>
Paul Moore Sept. 5, 2019, 8:23 p.m. UTC | #2
On Thu, Sep 5, 2019 at 8:24 AM Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 9/4/19 6:03 PM, Paul Moore wrote:
> > From: Paul Moore <paul@paul-moore.com>
> >
> > Commit be0ca8feeb9b ("selinux-testsuite: ensure the cgroups_label
> > tests works on old and new systems"), and perhaps an earlier related
> > commit, broke systems after the tests were run by operating on
> > /sys/fs/cgroup/unified directly and not a sub-directory.  Fix this
> > by restoring the old (sub-directory) behavior.
> >
> > Reported-by: Stephen Smalley <sds@tycho.nsa.gov>
> > Signed-off-by: Paul Moore <paul@paul-moore.com>
>
> Tested-by: Stephen Smalley <sds@tycho.nsa.gov>

Merged, thanks.

> > ---
> >   0 files changed
>
> That's a little odd.

Huh, yes it is ... ?  Not sure what happened here, but that part is
automatically generated by 'stg mail'.  I don't see the same problem
(missing diffstat) on the other patch I sent last night, so I'm not
going to worry too much about it, but I'll keep an eye on it.

> > diff --git a/tests/cgroupfs_label/test b/tests/cgroupfs_label/test
> > index 13f0434..3accca0 100755
> > --- a/tests/cgroupfs_label/test
> > +++ b/tests/cgroupfs_label/test
> > @@ -6,8 +6,11 @@ BEGIN { plan tests => 2 }
> >   my $ret;
> >
> >   # Older systems use /sys/fs/cgroup/unified, newer use /sys/fs/cgroup.
> > -my $dir = "/sys/fs/cgroup/unified";
> > -if ( !-d $dir ) {
> > +my $dir;
> > +if ( -d "/sys/fs/cgroup/unified" ) {
> > +    $dir = "/sys/fs/cgroup/unified/selinuxtest";
> > +}
> > +else {
> >       $dir = "/sys/fs/cgroup/selinuxtest";
> >   }

--
paul moore
www.paul-moore.com
diff mbox series

Patch

diff --git a/tests/cgroupfs_label/test b/tests/cgroupfs_label/test
index 13f0434..3accca0 100755
--- a/tests/cgroupfs_label/test
+++ b/tests/cgroupfs_label/test
@@ -6,8 +6,11 @@  BEGIN { plan tests => 2 }
 my $ret;
 
 # Older systems use /sys/fs/cgroup/unified, newer use /sys/fs/cgroup.
-my $dir = "/sys/fs/cgroup/unified";
-if ( !-d $dir ) {
+my $dir;
+if ( -d "/sys/fs/cgroup/unified" ) {
+    $dir = "/sys/fs/cgroup/unified/selinuxtest";
+}
+else {
     $dir = "/sys/fs/cgroup/selinuxtest";
 }