From: Joshua Brindle <jbrindle@tresys.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: selinux@tycho.nsa.gov, dwalsh@redhat.com, SELinux-dev@tresys.com,
Ivan Gyurdiev <ivg2@cornell.edu>
Subject: Re: [ SEMANAGE ] [ SEPOL ] More database work
Date: Wed, 12 Oct 2005 16:16:13 -0400 [thread overview]
Message-ID: <434D6F0D.6090801@tresys.com> (raw)
In-Reply-To: <1129146727.26188.77.camel@moss-spartans.epoch.ncsc.mil>
Stephen Smalley wrote:
> On Wed, 2005-10-12 at 14:06 -0400, Joshua Brindle wrote:
>
>>Another idea, instead of downgrading the binary (because of the
>>possibility of an incompatible downgrade in the future) what about using
>>the expander in libsepol to build a kernel image from the linked module?
>>This is basically the same as the libsemanage suggestion but without
>>using libsemanage.
>
>
> "Downgrading" just means setting the desired policy version for the
> binary policy image (via sepol_policydb_set_vers) and then calling
> sepol_policydb_write to write the image to memory or a file. That is
> what libsemanage already does for expansion after calling
> sepol_expand_module (which merely expands to a policydb, not a binary
> policy image). The policydb is not versioned in its memory
> representation; it merely carries around a version reflecting its source
> for use in subsequent generation of an image - either the version of the
> original policy image loaded into the policydb via a policydb_read or
> the latest version supported by libsepol when creating a new image via
> expand_module. So if libsepol doesn't support a "downgrade" of a binary
> policy image to an older version due to incompatibility, it isn't going
> to support expanding to that version either. It ultimately all comes
> through policydb_write.
>
This is true assuming policydb_write is always going to do the version
compatibility. Since that will probably be the case for the foreseeable
future this is fine.
> Also, libselinux shouldn't be pulling directly from the module store, so
> it would still have some dependency on libsemanage to find that linked
> module file. At present, libsemanage depends on libselinux and
> libsepol, libselinux depends on libsepol (for load_policy only), and
> libsepol depends on nothing (other than libc, of course).
>
Ok, that is true
>
>>I think downgrading is probably
>>the best way to do it now.
>
>
> I was thinking that the policy pathname could then become versionless,
> but it occurs to me that the version suffix is still useful in allowing
> libselinux to determine the policy version of the file (to decide
> whether a downgrade is required) without needing to parse it, and
> preserving the suffix also lets us unify the loading logic. So, the
> behavior of libsemanage and libselinux would be as follows:
> - libsemanage always generates the latest policy version supported by
> libsepol (the default), writing it to a versioned policy pathname with
> that version number. It doesn't use the kernel's policy version at all.
>
libselinux can do a partial parse to get the version, but this obviously
isn't as easy as reading the suffix . but this will leave old (albeit
unused) policies laying around.
it is probably a good idea for libselinux to parse the first few fields
(magic number, version, etc) anyway before sending an image to the kernel.
> - libselinux always searches for a versioned filename with the highest
> version <= the sepol max, opens and mmaps that file, uses the version
> suffix to determine whether a downgrade is required, and downgrades if
> necessary to the kernel's version. This same logic applies both for the
> managed case and the unmanaged case.
>
so, if preserve booleans is on it reads the image, sets the policyvers
to the kernel version, sets booleans and writes the image, this makes
sense. If preserve booleans is not on it loads the policy, decides if a
downgrade is needed and if not sends the image directly to the kernel.
This sounds optimal for the init case. I'm comfortable with this.
--
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.
next prev parent reply other threads:[~2005-10-12 20:16 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-06 16:01 [ SEMANAGE ] [ SEPOL ] More database work Ivan Gyurdiev
2005-10-06 16:05 ` Ivan Gyurdiev
2005-10-06 19:27 ` Stephen Smalley
2005-10-07 14:30 ` Stephen Smalley
2005-10-07 15:52 ` Stephen Smalley
2005-10-07 18:30 ` Stephen Smalley
2005-10-07 19:36 ` Joshua Brindle
2005-10-07 19:54 ` Stephen Smalley
2005-10-07 20:15 ` Joshua Brindle
2005-10-07 20:23 ` Stephen Smalley
2005-10-07 20:41 ` Joshua Brindle
2005-10-11 19:15 ` Stephen Smalley
2005-10-11 20:05 ` Stephen Smalley
2005-10-11 20:17 ` Stephen Smalley
2005-10-11 22:45 ` Joshua Brindle
2005-10-11 22:51 ` Joshua Brindle
2005-10-12 14:58 ` Stephen Smalley
2005-10-12 15:34 ` Joshua Brindle
2005-10-12 15:44 ` Stephen Smalley
2005-10-12 16:19 ` Joshua Brindle
2005-10-12 16:26 ` Stephen Smalley
2005-10-12 18:06 ` Joshua Brindle
2005-10-12 19:52 ` Stephen Smalley
2005-10-12 20:11 ` Stephen Smalley
2005-10-13 16:43 ` Stephen Smalley
2005-10-13 18:43 ` Stephen Smalley
2005-10-13 18:54 ` Stephen Smalley
2005-10-12 20:16 ` Joshua Brindle [this message]
2005-10-12 20:43 ` Stephen Smalley
2005-10-07 21:17 ` Stephen Smalley
2005-10-07 22:48 ` Ivan Gyurdiev
2005-10-11 12:32 ` Stephen Smalley
2005-10-11 12:51 ` Stephen Smalley
2005-10-13 19:29 ` Stephen Smalley
2005-10-13 22:35 ` Joshua Brindle
2005-10-14 12:02 ` Stephen Smalley
2005-10-14 13:33 ` Joshua Brindle
2005-10-14 13:49 ` Stephen Smalley
2005-10-07 19:37 ` Stephen Smalley
2005-10-07 15:52 ` Ivan Gyurdiev
2005-10-07 16:01 ` Stephen Smalley
2005-10-07 16:05 ` Stephen Smalley
2005-10-07 16:46 ` Ivan Gyurdiev
2005-10-07 17:04 ` Stephen Smalley
2005-10-07 16:06 ` Joshua Brindle
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=434D6F0D.6090801@tresys.com \
--to=jbrindle@tresys.com \
--cc=SELinux-dev@tresys.com \
--cc=dwalsh@redhat.com \
--cc=ivg2@cornell.edu \
--cc=sds@tycho.nsa.gov \
--cc=selinux@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.