From: "Zhang, Ning A" <ning.a.zhang@intel.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: maybe a bug in SELinux: security_context_to_sid_core
Date: Wed, 28 Feb 2018 06:47:07 +0000 [thread overview]
Message-ID: <1519800427.32465.22.camel@intel.com> (raw)
Hi,
Before SELinux is initialized, get scontext by secid by using:
security_secctx_to_secid() may return wrong numbe
eg:
security_secctx_to_secid("devnull", strlen("devnull"), &sid);
sid here will be 1
because:
in security_context_to_sid_core:
...
if (!ss_initialized) {
int i;
for (i = 1; i < SECINITSID_NUM; i++) {
if (!strcmp(initial_sid_to_string[i],
scontext)) {
*sid = i;
return 0;
}
}
*sid = SECINITSID_KERNEL;
return 0;
}
...
and SECINITSID_DEVNULL equals to SECINITSID_NUM, and it will never get
right secid for "devnull".
is this by design or bug?
BR.
Ning.
next reply other threads:[~2018-02-28 6:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 6:47 Zhang, Ning A [this message]
2018-03-09 2:07 ` maybe a bug in SELinux: security_context_to_sid_core Zhang, Ning A
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=1519800427.32465.22.camel@intel.com \
--to=ning.a.zhang@intel.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox