From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Cc: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH] Fix boot crash on xsm/flask enabled builds when no policy module is present
Date: Mon, 26 Aug 2013 09:27:07 -0400 [thread overview]
Message-ID: <521B57AB.9080007@tycho.nsa.gov> (raw)
In-Reply-To: <521B335F.9020004@citrix.com>
On 08/26/2013 06:52 AM, Andrew Cooper wrote:
> On 26/08/2013 11:03, Tomasz Wroblewski wrote:
>> Xen crashes on boot of xsm/flask enabled builds, if policy module is not specified.
>> This seems to have worked on 4.1 at least. Can be fixed by testing whether policy_buffer
>> is NULL before attempting to load from it - it's a global which is set to non-NULL when
>> policy module is detected.
>>
>> Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
>
> CCing Daniel De Graaf, as the maintainer of this code.
>
> However FWIW,
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
>> ---
>> xen/xsm/flask/hooks.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
>> index fa0589a..cfa2929 100644
>> --- a/xen/xsm/flask/hooks.c
>> +++ b/xen/xsm/flask/hooks.c
>> @@ -1585,7 +1585,8 @@ static __init int flask_init(void)
>> if ( register_xsm(&flask_ops) )
>> panic("Flask: Unable to register with XSM.\n");
>>
>> - ret = security_load_policy(policy_buffer, policy_size);
>> + if ( policy_buffer )
>> + ret = security_load_policy(policy_buffer, policy_size);
>>
>> if ( flask_enforcing )
>> printk("Flask: Starting in enforcing mode.\n");
>
While this change is not wrong, I also don't see how it could fix
anything. The security_load_policy function will not dereference
policy_buffer if policy_size is zero (it'll return -EINVAL first),
and the only location that sets policy_size (xsm_policy_init) also
sets policy_buffer. If this function is setting the NULL pointer,
it also does a dereference - and it will be visible in the printk.
Also, on 08/26/2013 07:12 AM, Jan Beulich wrote:
> Question is whether policy_buffer == NULL really isn't supposed
> to result in a -E... return value (as in fact flask initialization failed).
The return value of flask_init isn't ever checked. A failure to
load the policy at boot is identical to no policy - waiting for a
flask_disable or "xl loadpolicy" hypercall from dom0.
--
Daniel De Graaf
National Security Agency
next prev parent reply other threads:[~2013-08-26 13:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-26 10:03 [PATCH] Fix boot crash on xsm/flask enabled builds when no policy module is present Tomasz Wroblewski
2013-08-26 10:52 ` Andrew Cooper
2013-08-26 13:27 ` Daniel De Graaf [this message]
2013-08-26 13:32 ` Tomasz Wroblewski
2013-08-26 11:12 ` Jan Beulich
2013-08-26 12:24 ` Tomasz Wroblewski
2013-08-26 12:41 ` Andrew Cooper
2013-08-26 13:00 ` Jan Beulich
2013-08-26 13:34 ` Tomasz Wroblewski
2013-08-26 17:00 ` Tomasz Wroblewski
2013-08-27 7:13 ` Jan Beulich
2013-08-27 7:23 ` Tomasz Wroblewski
2013-08-27 7:47 ` [PATCH] xmalloc: make whole pages xfree() clear the order field (ab)used by xmalloc() Jan Beulich
2013-09-09 11:14 ` Keir Fraser
2013-08-27 8:50 ` [PATCH] Fix boot crash on xsm/flask enabled builds when no policy module is present Andrew 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=521B57AB.9080007@tycho.nsa.gov \
--to=dgdegra@tycho.nsa.gov \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=tomasz.wroblewski@citrix.com \
--cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).