All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Sven Vermeulen <sven.vermeulen@siphos.be>
Cc: selinux@tycho.nsa.gov, Eric Paris <eparis@redhat.com>,
	Russell Coker <russell@coker.com.au>,
	Joshua Brindle <method@manicmethod.com>,
	"Christopher J. PeBenito" <cpebenito@tresys.com>
Subject: Re: libsemanage/libsepol still supported for non-MLS/MCS setups?
Date: Thu, 23 Feb 2012 15:46:32 -0500	[thread overview]
Message-ID: <1330029992.27529.63.camel@moss-pluto> (raw)
In-Reply-To: <20120223201735.GA5810@siphos.be>

On Thu, 2012-02-23 at 21:17 +0100, Sven Vermeulen wrote:
> Hi guys,
> 
> Is libsemanage (and libsepol) still supported on policies without MLS/MCS?
> For some reason, I get segfaults when using libsemanage-2.1.6 on a "strict"
> policy (one without levels).
> 
> The backtrace is as follows:
> 
> (gdb) run -B
> Starting program: /usr/sbin/semodule -B
> 
> Program received signal SIGSEGV, Segmentation fault.
> __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:32
> 32      ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
>         in ../sysdeps/x86_64/multiarch/../strlen.S
> (gdb) bt
> #0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:32
> #1  0x000003a1d08ddce1 in ustr_replace_cstr () from /usr/lib64/libustr-1.0.so.1
> #2  0x000003a1d1524835 in replace_all (str=0x3a1d88e93c0 "HOME_DIR/.+\tsystem_u:object_r:user_home_t", repl=0x3ffffffde00)
>     at genhomedircon.c:499
> #3  0x000003a1d1524b58 in write_home_dir_context (s=0x3ffffffdf20, out=0x3a1d7444510, tpl=0x3a1d6e1f1b0, 
>     user=0x3a1d71b2680 "user_u", seuser=0x3a1d71b2680 "user_u", home=0x3a1d71e08a3 "/home/[^/]*", 
>     role_prefix=0x3a1d71bafc0 "user", level=0x0) at genhomedircon.c:566
> #4  0x000003a1d1525d68 in write_context_file (s=0x3ffffffdf20, out=0x3a1d7444510) at genhomedircon.c:998
> #5  0x000003a1d1526054 in semanage_genhomedircon (sh=0x3a1d1b6b280, policydb=0x3a1d6e01dd0, usepasswd=1, ignoredirs=0x0)
>     at genhomedircon.c:1076
> #6  0x000003a1d151e30c in semanage_direct_commit (sh=0x3a1d1b6b280) at direct_api.c:994
> #7  0x000003a1d15234fe in semanage_commit (sh=0x3a1d1b6b280) at handle.c:435
> #8  0x000003a1d1969318 in main (argc=<optimized out>, argv=0x3ffffffe278) at semodule.c:466
> 
> As you can see in frame #3, level is 0x0, which is confirmed when
> traversing the &s variable in the write_context_file function:
> 
> (gdb) frame 4
> #4  0x000003a1d1525d68 in write_context_file (s=0x3ffffffdf20, out=0x3a1d7444510) at genhomedircon.c:998
> 998     genhomedircon.c: No such file or directory.
>         in genhomedircon.c
> (gdb) print s.fallback_user_level
> $1 = 0x0
> (gdb) print s.fallback_user      
> $2 = 0x3a1d71b2680 "user_u"
> (gdb) print s.fallback_user_prefix
> $3 = 0x3a1d71bafc0 "user"
> 
> Looking at how this can become 0x0, I think that 
> 
> 1. write_context_file calls setup_fallback_user
> 2. setup_fallback_user calls semanage_user_query (for a default account?)
>    this returns >= 0
> 3. setup_fallback_user calls semanage_user_get_mlslevel
> 4. semanage_user_get_mlslevel eventually calls sepol_user_get_mlslevel
> 5. sepol_user_get_mlslevel returns 0x0
> 
> Should sepol_user_get_mlslevel return some default (like "s0") if the
> system doesn't use MLS/MCS? Or shouldn't it be called if one doesn't have
> MCS/MLS?

Looks the same to me as:
http://marc.info/?t=131443240600002&r=1&w=2
http://marc.info/?t=132433045500005&r=1&w=2

It seems that last patch never got applied.

The non-MCS/MLS case doesn't get much testing since most of the
distributions seem to enable MCS in their default policies.

-- 
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

      parent reply	other threads:[~2012-02-23 20:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23 20:17 libsemanage/libsepol still supported for non-MLS/MCS setups? Sven Vermeulen
2012-02-23 20:42 ` Eric Paris
2012-02-24 18:11   ` Sven Vermeulen
2012-02-23 20:46 ` Stephen Smalley [this message]

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=1330029992.27529.63.camel@moss-pluto \
    --to=sds@tycho.nsa.gov \
    --cc=cpebenito@tresys.com \
    --cc=eparis@redhat.com \
    --cc=method@manicmethod.com \
    --cc=russell@coker.com.au \
    --cc=selinux@tycho.nsa.gov \
    --cc=sven.vermeulen@siphos.be \
    /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.