From: Steve Lawrence <slawrence@tresys.com>
To: Kohei KaiGai <kaigai@kaigai.gr.jp>
Cc: KaiGai Kohei <kohei.kaigai@EU.NEC.COM>,
SELinux-NSA <selinux@tycho.nsa.gov>
Subject: Re: libselinux: add selinux_status_* interfaces for /selinux/status
Date: Tue, 01 Mar 2011 12:53:56 -0500 [thread overview]
Message-ID: <4D6D32B4.9050108@tresys.com> (raw)
In-Reply-To: <AANLkTines9S4PR-G2bX00CmV=4NUW3YGs67p4hp5WUBw@mail.gmail.com>
On 02/11/2011 04:09 PM, Kohei KaiGai wrote:
>> The patch looks okay to me, but I'm seeing unexpected behavior with the
>> selinux_status_policyload(). For example, when running your sample
>> status.c code, I get the following (I'm just calling load_policy after
>> each line is printed):
>>
>> # ./status
>> -- selinux kernel status page --
>> policyload = 0, enforcing = 1, deny_unknown = 0
>> policyload = 2, enforcing = 1, deny_unknown = 0
>> policyload = 3, enforcing = 1, deny_unknown = 0
>> policyload = 4, enforcing = 1, deny_unknown = 0
>>
>> policyload jumps from 0 to 2 when reloading policy the first time, but
>> all other policy loads after that are incremented by 1, as expected. And
>> it doesn't matter if it's using mmap or falls back to netlink. Same
>> behavior in both cases.
>>
>> It doesn't look like the problem is in this patch, so I'm guessing this
>> is a problem in the kernel? Or am I missing something and this is the
>> correct behavior?
>>
> It is a specification, not a problem. :-)
>
> See the manpage part of the patch. It says ...
>
> | +.BR selinux_status_policyload
> | +returns times of policy reloaded on the running system, or -1 on error.
> | +Note that it is not a reliable value on fallback-mode until it receive
> | +the first event message via netlink socket.
> | +Thus, don't use this value to know actual times of policy reloaded.
>
> When we use this interface with fallback mode, it opens a netlink socket
> to receive messages from the kernel space.
> The message packet will deliver userspace number of policy reloaded,
> so it also means application cannot know the information until it receives
> the first message packet.
>
> As the manpage says, our recommendable usage of selinux_status_policyload()
> on fall-back mode is detection of the policy reloaded event, not knowing
> the actual number of policy reloaded in the system.
>
> Of course, when /selinux/status is available, this interface always returns
> the correct number.
>
> Thanks,
I see, looks good then.
Acked-by: Steve Lawrence <slawrence@tresys.com>
Merged as of libselinux to 2.0.99
--
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:[~2011-03-01 17:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-22 13:42 libselinux: add selinux_status_* interfaces for /selinux/status Kohei KaiGai
2011-01-27 1:02 ` KaiGai Kohei
2011-02-09 14:05 ` Kohei Kaigai
2011-02-11 20:27 ` Steve Lawrence
2011-02-11 21:09 ` Kohei KaiGai
2011-03-01 17:53 ` Steve Lawrence [this message]
2011-03-07 17:07 ` Kohei Kaigai
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=4D6D32B4.9050108@tresys.com \
--to=slawrence@tresys.com \
--cc=kaigai@kaigai.gr.jp \
--cc=kohei.kaigai@EU.NEC.COM \
--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.