All of lore.kernel.org
 help / color / mirror / Atom feed
From: Garrett Cooper <yanegomi@gmail.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Eric Paris <eparis@parisplace.org>,
	James Morris <jmorris@namei.org>,
	ltp-list@lists.sourceforge.net
Subject: Re: [LTP] regression: selinux testsuite broken since October
Date: Thu, 14 Jan 2010 20:22:42 -0800	[thread overview]
Message-ID: <364299f41001142022r6cfed8det72ba8a2c038ffcdf@mail.gmail.com> (raw)
In-Reply-To: <1263506364.8548.74.camel@moss-pluto.epoch.ncsc.mil>

On Thu, Jan 14, 2010 at 1:59 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On Thu, 2010-01-14 at 13:32 -0800, Garrett Cooper wrote:
>> On Thu, Jan 14, 2010 at 1:29 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>> > On Thu, Jan 14, 2010 at 12:44 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>> >> On Thu, 2010-01-14 at 15:35 -0500, Stephen Smalley wrote:
>> >>> I guess I'm not being clear.  Most of the work presently done by 'load'
>> >>> can be done during make all/install.  In particular, everything except
>> >>> for running semodule -i can be done during make all, and then make
>> >>> install should just copy test_policy.pp (the output of make all) to
>> >>> the /opt/ltp tree.  Then test_selinux.sh only needs to run semodule
>> >>> -i /path/to/test_policy.pp before the tests and semodule -r test_policy
>> >>> afterward.  We can also avoid copying test_policy.te to the system
>> >>> policy devel directory altogether.  Something like this patch (and
>> >>> Makefile.selinux can then be removed altogether):
>> >>
>> >> Oops, wrong variable expansion syntax in test_selinux.sh.  Corrected
>> >> patch is below.  This one actually runs ;)
>> >>
>> >> Index: testscripts/test_selinux.sh
>> >> ===================================================================
>> >> RCS file: /cvsroot/ltp/ltp/testscripts/test_selinux.sh,v
>> >> retrieving revision 1.15
>> >> diff -u -r1.15 test_selinux.sh
>> >> --- testscripts/test_selinux.sh 13 Jan 2010 18:50:53 -0000      1.15
>> >> +++ testscripts/test_selinux.sh 14 Jan 2010 20:41:22 -0000
>> >> @@ -89,11 +89,10 @@
>> >>  config_allow_domain_fd_use 0
>> >>
>> >>  # build and install the test policy...
>> >> -echo "building and installing test_policy module..."
>> >> -cd $POLICYDIR
>> >> -make load
>> >> +echo "installing test_policy module..."
>> >> +$SEMODULE -i $POLICYDIR/test_policy.pp
>> >>  if [ $? != 0 ]; then
>> >> -       echo "Failed to build and load test_policy module, aborting test run."
>> >> +       echo "Failed to install load test_policy module, aborting test run."
>> >>        config_unset_expandcheck
>> >>        exit 1
>> >>  else
>> >> @@ -126,8 +125,7 @@
>> >>  /usr/bin/chcon -t $SAVEBINTYPE $LTPROOT/testcases/bin
>> >>
>> >>  echo "Removing test_policy module..."
>> >> -cd $POLICYDIR
>> >> -make cleanup 2>&1
>> >> +$SEMODULE -r test_policy
>> >>  if [ $? != 0 ]; then
>> >>        echo "Failed to remove test_policy module."
>> >>        exit 1
>> >> Index: testcases/kernel/security/selinux-testsuite/refpolicy/Makefile
>> >> ===================================================================
>> >> RCS file: /cvsroot/ltp/ltp/testcases/kernel/security/selinux-testsuite/refpolicy/Makefile,v
>> >> retrieving revision 1.17
>> >> diff -u -r1.17 Makefile
>> >> --- testcases/kernel/security/selinux-testsuite/refpolicy/Makefile      14 Jan 2010 12:40:58 -0000      1.17
>> >> +++ testcases/kernel/security/selinux-testsuite/refpolicy/Makefile      14 Jan 2010 20:41:22 -0000
>> >> @@ -39,10 +39,11 @@
>> >>
>> >>  CHECKPOLICY            ?= $(DESTDIR)/usr/bin/checkpolicy
>> >>  CHECKPOLICY_VERS       ?= $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ')
>> >> +POLICY_DEVEL_DIR       ?= $(DESTDIR)/usr/share/selinux/devel
>> >>
>> >>  INSTALL_DIR            := testcases/kernel/security/selinux-testsuite/refpolicy
>> >>
>> >> -INSTALL_TARGETS                := Makefile.selinux
>> >> +INSTALL_TARGETS                := test_policy.pp
>> >>
>> >>  TEST_POLICY_DIR                := $(abs_srcdir)/policy_files
>> >>
>> >> @@ -63,8 +64,17 @@
>> >>  POLICY_FILES           := test_global.te \
>> >>                           $(filter-out test_global.te,$(notdir $(wildcard $(TEST_POLICY_DIR)/*.te)))
>> >>
>> >> +all: test_policy.pp
>> >> +
>> >> +test_policy.pp: test_policy.te
>> >> +       @set -e; if [ -d "$(POLICY_DEVEL_DIR)" ]; then \
>> >> +           $(MAKE) -f $(POLICY_DEVEL_DIR)/Makefile test_policy.pp; \
>> >> +       else \
>> >> +            echo "ERROR: You must have selinux-policy?-devel? installed."; \
>> >> +           false; \
>> >> +       fi
>> >> +
>> >>  test_policy.te: $(addprefix $(TEST_POLICY_DIR)/,$(POLICY_FILES))
>> >>        (cd "$(TEST_POLICY_DIR)" && cat $(POLICY_FILES)) > $@
>> >>
>> >>  include $(top_srcdir)/include/mk/generic_leaf_target.mk
>> >> -include $(abs_srcdir)/Makefile.selinux
>> >
>> > Cool! This is a lot easier than I originally thought it would be.
>> >
>> > Everything specified with all should be specified instead with the
>>
>> s/Everything specified with all/All dependencies of all/
>>
>> MAKE_TARGETS variable. This is because it adds everything in
>> > MAKE_TARGETS to variables (CLEAN_TARGETS, INSTALL_TARGETS), which then
>> > handle it appropriately via clean and install.
>> >
>> > All I have to do after this is resolve the (semodule?) security bit
>> > enabling for the tests, and we'll be in good shape for all build,
>> > install, and test scenarios with selinux.
>
> Further diff on top of the prior one to resolve a few remaining issues
> in getting the tests to pass.  With these two patches, all tests appear
> to pass on Fedora 12.
>
> Things that remain unresolved:
> - RHEL4 support.  Is RHEL4 to be supported still by ltp, given
> dependencies?  RHEL4 has been using the test policy under policy/ and
> has a different build/load process.
> - Running individual tests manually.  As described in the
> selinux-testsuite README, it used to be possible to run individual tests
> via tests/runtest.sh in order to more easily hunt down specific failures
> and get more verbose output than we get from any of the results/* files.
>
> diff -u testscripts/test_selinux.sh testscripts/test_selinux.sh
> --- testscripts/test_selinux.sh 14 Jan 2010 20:41:22 -0000
> +++ testscripts/test_selinux.sh 14 Jan 2010 21:48:15 -0000
> @@ -113,7 +113,7 @@
>  # The ../testcases/bin directory needs to have the test_file_t type.
>  # Save and restore later.
>  SAVEBINTYPE=`ls -Zd $LTPROOT/testcases/bin | awk '{ print $4 }' | awk -F: '{ print $3 }'`
> -/usr/bin/chcon -t test_file_t $LTPROOT/testcases/bin
> +/usr/bin/chcon -R -t test_file_t $LTPROOT/testcases/bin
>
>  $LTPROOT/bin/ltp-pan -S -a $LTPROOT/results/selinux -n ltp-selinux -l $LTPROOT/results/selinux.logfile -o $LTPROOT/results/selinux.outfile -p -f $LTPROOT/runtest/selinux
>
> @@ -122,7 +122,7 @@
>  rm -rf $TMP/selinux
>
>  # Restore type of .../testcases/bin directory
> -/usr/bin/chcon -t $SAVEBINTYPE $LTPROOT/testcases/bin
> +/usr/bin/chcon -R -t $SAVEBINTYPE $LTPROOT/testcases/bin
>
>  echo "Removing test_policy module..."
>  $SEMODULE -r test_policy
> only in patch2:
> unchanged:
> --- testcases/kernel/security/selinux-testsuite/tests/file/selinux_file.sh      11 May 2009 06:39:46 -0000      1.7
> +++ testcases/kernel/security/selinux-testsuite/tests/file/selinux_file.sh      14 Jan 2010 21:48:15 -0000
> @@ -193,7 +193,7 @@
>        fi
>
>        # return to $LTPROOT directory
> -       cd ${PWD}
> +       cd ${SAVEPWD}
>
>        return $RC
>  }
> only in patch2:
> unchanged:
> --- testcases/kernel/security/selinux-testsuite/tests/inherit/Makefile  9 Oct 2009 17:55:51 -0000       1.2
> +++ testcases/kernel/security/selinux-testsuite/tests/inherit/Makefile  14 Jan 2010 21:48:15 -0000
> @@ -25,8 +25,6 @@
>  include $(top_srcdir)/include/mk/env_pre.mk
>  include $(abs_srcdir)/../Makefile.inc
>
> -LDFLAGS                        += -static
> -
>  LDLIBS                 += -lselinux
>
>  include $(top_srcdir)/include/mk/generic_leaf_target.mk
> only in patch2:
> unchanged:
> --- testcases/kernel/security/selinux-testsuite/tests/inherit/selinux_inherit.sh        21 Apr 2009 09:39:58 -0000      1.4
> +++ testcases/kernel/security/selinux-testsuite/tests/inherit/selinux_inherit.sh        14 Jan 2010 21:48:15 -0000
> @@ -25,6 +25,7 @@
>
>        # run tests in $LTPROOT/testcases/bin directory
>        SAVEPWD=${PWD}
> +       LTPBIN=${LTPBIN:-$LTPROOT/testcases/bin}
>        cd ${LTPBIN}
>        CURRENTDIR="."
>  }
> @@ -39,7 +40,7 @@
>        # the test_file from test_inherit_parent_t.
>        # Should fail on fd use permission.
>
> -       runcon -t test_inherit_parent_t -- selinux_inherit_parent test_inherit_nouse_t $SELINUXTMPDIR/test_file selinux_inherit_child 2>&1
> +       runcon -t test_inherit_parent_t -- $CURRENTDIR/selinux_inherit_parent test_inherit_nouse_t $SELINUXTMPDIR/test_file $CURRENTDIR/selinux_inherit_child 2>&1
>        RC=$?
>        if [ $RC -ne 0 ]
>        then

Thanks -- committed.
-Garrett

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2010-01-15  4:22 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-06 15:25 [LTP] regression: selinux testsuite broken since October Stephen Smalley
2010-01-06 17:18 ` Serge E. Hallyn
2010-01-07  9:04   ` Garrett Cooper
2010-01-06 18:50 ` Serge E. Hallyn
2010-01-07 19:40   ` Stephen Smalley
2010-01-08 18:20     ` Garrett Cooper
2010-01-08 18:45       ` Stephen Smalley
2010-01-08 18:50         ` Stephen Smalley
2010-01-08 21:38           ` Garrett Cooper
2010-01-08 22:00             ` Stephen Smalley
2010-01-08 22:08               ` Garrett Cooper
2010-01-09  7:27                 ` Garrett Cooper
2010-01-11 19:12                   ` Stephen Smalley
2010-01-11 19:50                     ` Serge E. Hallyn
2010-01-11 19:55                       ` Stephen Smalley
2010-01-11 20:19                         ` Serge E. Hallyn
2010-01-11 20:58                           ` Serge E. Hallyn
2010-01-11 21:00                             ` Serge E. Hallyn
2010-01-11 21:31                               ` Serge E. Hallyn
2010-01-12  8:36                                 ` Garrett Cooper
2010-01-12 13:16                                 ` Stephen Smalley
2010-01-12 16:55                                   ` Garrett Cooper
2010-01-12 17:19                                     ` Garrett Cooper
2010-01-12 17:24                                       ` Garrett Cooper
2010-01-12 17:26                                       ` Garrett Cooper
2010-01-12 19:12                                         ` Stephen Smalley
2010-01-13  6:51                                           ` Garrett Cooper
2010-01-13  6:54                                             ` Garrett Cooper
2010-01-13 13:43                                             ` Stephen Smalley
2010-01-13 18:52                                               ` Garrett Cooper
2010-01-13 19:18                                                 ` Stephen Smalley
2010-01-13 19:37                                                   ` Garrett Cooper
2010-01-13 19:49                                                     ` Stephen Smalley
2010-01-13 21:58                                                       ` Garrett Cooper
2010-01-13 22:00                                                       ` Serge E. Hallyn
2010-01-13 22:03                                                         ` Stephen Smalley
2010-01-13 22:49                                                           ` Garrett Cooper
2010-01-14 14:07                                                             ` Stephen Smalley
2010-01-14 20:10                                                               ` Garrett Cooper
2010-01-14 20:35                                                                 ` Stephen Smalley
2010-01-14 20:44                                                                   ` Stephen Smalley
2010-01-14 21:29                                                                     ` Garrett Cooper
2010-01-14 21:32                                                                       ` Garrett Cooper
2010-01-14 21:59                                                                         ` Stephen Smalley
2010-01-14 22:31                                                                           ` Stephen Smalley
2010-01-15  4:22                                                                           ` Garrett Cooper [this message]
2010-01-15  4:44                                                                           ` Garrett Cooper
2010-01-15 14:11                                                                             ` Stephen Smalley
2010-01-15 14:17                                                                               ` Stephen Smalley
2010-01-12  8:29                               ` Garrett Cooper
2010-01-12 13:00                                 ` Stephen Smalley
2010-01-12 15:38                                 ` Serge E. Hallyn
2010-01-12 16:56                                   ` Garrett Cooper
2010-01-12 18:51                                   ` Stephen Smalley
2010-01-15 17:48                                   ` Garrett Cooper
2010-01-26  8:31                                     ` Garrett Cooper
2010-01-26 14:30                                       ` Stephen Smalley
2010-01-27  6:34                                         ` Garrett Cooper
2010-01-27 19:12                                           ` Stephen Smalley
2010-01-27 22:37                                             ` Garrett Cooper
2010-01-28  5:56                                               ` Garrett Cooper
2010-01-28 14:02                                                 ` Stephen Smalley
2010-01-28 15:10                                                   ` Garrett Cooper
2010-01-12  8:43                         ` Garrett Cooper
2010-01-12 13:08                           ` Stephen Smalley
2010-01-06 18:58 ` Serge E. Hallyn
2010-01-07  9:05   ` Garrett Cooper
2010-01-07 19:23     ` Stephen Smalley
2010-01-07  9:18 ` Garrett Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=364299f41001142022r6cfed8det72ba8a2c038ffcdf@mail.gmail.com \
    --to=yanegomi@gmail.com \
    --cc=eparis@parisplace.org \
    --cc=jmorris@namei.org \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=sds@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.