[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 2/3] xsm: consolidate loading the policy buffer


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 7 Jun 2022 16:15:45 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LhlZbOwPp9043ER1BXoZcj7AFVJiR8ps1Vacfd5r/OI=; b=ZLSeWPJNwrsk5++GnrO1j0KzSv3poHBNoShoWoOsfcE1Ya+t/W8td4e80cIx9ChmfkzcaL8ZXANyA/605zsW/87JqlSQp2AsCx63e2wuCpY00Sm5TypRKObjxjPOHo3wHG9/3Dj8YMhLpBdDjSapkFqxTsfBQa7qGY1ZyVN8Cdezh1yuDeDKjv4mWiOdweW3lE25ck1ZJ6RQt8kcVPZV65iS24lqus3yZb2fg6odlCV0EEtnnPF/lwtIBKDFdU2yf4G4Oc5jMcuKNLYP72T9I49PBl3NXY7DSiZYlI5KjaAaOYe06UQE/QTRhy9Xrh99pxvo/Hp+oJg1teDuS/vRsA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WfegiwFWLcoUFZgT+yDUuoXz3b4kupT5IHZYTFJG8HOnYh4QRUwegfONzB5B+DHpJYSdTM+f/6xt0jUVolOcn+xSYMtOFEUs6p8VPAQclb2KLBL1BNOSsW4a2KvUqK8mIf8Cy8Wqy4j+EhIZ/YHkpJeyCe9FU5sxlu9JJMDe6PMST2/f4wUkMBRbmz8ciTNLATvmsDg9cDmFU/3YdRkfkr70zuTgyygRqoSS/OoHeVExmwsdpVBq1r/yFpqNm6PeIDQUYOs1W+2XGTRMLbHnodUVTIOviCGYJnnIWWk2KfkGFwccspmFSFspI0Kk6JmaopoYcU+8Rfs0XLMq20iffQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: scott.davis@xxxxxxxxxx, christopher.clark@xxxxxxxxxx, jandryuk@xxxxxxxxx, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 07 Jun 2022 14:15:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.06.2022 16:10, Daniel P. Smith wrote:
> On 6/7/22 09:58, Jan Beulich wrote:
>> On 07.06.2022 15:47, Daniel P. Smith wrote:
>>>
>>> On 6/2/22 05:47, Jan Beulich wrote:
>>>> On 31.05.2022 20:20, Daniel P. Smith wrote:
>>>>> Previously, initializing the policy buffer was split between two 
>>>>> functions,
>>>>> xsm_{multiboot,dt}_policy_init() and xsm_core_init(). The latter for 
>>>>> loading
>>>>> the policy from boot modules and the former for falling back to built-in
>>>>> policy.
>>>>>
>>>>> This patch moves all policy buffer initialization logic under the
>>>>> xsm_{multiboot,dt}_policy_init() functions. It then ensures that an error
>>>>> message is printed for every error condition that may occur in the 
>>>>> functions.
>>>>> With all policy buffer init contained and only called when the policy 
>>>>> buffer
>>>>> must be populated, the respective xsm_{mb,dt}_init() functions will panic 
>>>>> for
>>>>> all errors except ENOENT. An ENOENT signifies that a policy file could 
>>>>> not be
>>>>> located. Since it is not possible to know if late loading of the policy 
>>>>> file is
>>>>> intended, a warning is reported and XSM initialization is continued.
>>>>
>>>> Is it really not possible to know? flask_init() panics in the one case
>>>> where a policy is strictly required. And I'm not convinced it is
>>>> appropriate to issue both an error and a warning in most (all?) of the
>>>> other cases (and it should be at most one of the two anyway imo).
>>>
>>> With how XSM currently works, I do not see how without creating a
>>> layering violation, as you had mentioned before. It is possible for
>>> flask_init() to know because the flask= parameter belongs to the flask
>>> policy module and can be directly checked.
>>>
>>> I think we view this differently. A call to
>>> xsm_{multiboot,dt}_policy_init() is asking for a policy file to be
>>> loaded. If it is not able to do so is an error. This error is reported
>>> back to xsm_{multiboot,dt}_init() which is responsible for initializing
>>> the XSM framework. If it encounters an error for which inhibits it from
>>> initializing XSM would be an error whereas an error it encounters that
>>> does not block initialization should warn the user as such. While it is
>>> true that the only error for the xsm_multiboot_policy_init() currently
>>> is a failure to locate a policy file, ENOENT, I don't see how that
>>> changes the understanding.
>>
>> Well, I think that to avoid the layering violation the decision whether
>> an error is severe enough to warrant a warning (or is even fatal) needs
>> to be left to the specific model (i.e. Flask in this case).
> 
> Except that it is not the policy module that loads the policy, where the
> error could occur. As you pointed out for MISRA compliance, you cannot
> have unhandled errors. So either, the errors must be ignored where they
> occur and wait for a larger, non-specific panic, or a nesting of
> handling/reporting the errors needs to be provided for a user to see in
> the log as to why they ended up at the panic.

Right - I was thinking that the error code could be propagated to Flask
instead of (or, less desirable, along with) the NULL pointer indicating
the absence of a policy module. That still would satisfy the "error
indications need to be checked for" MISRA requirement.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.