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

Re: [PATCH] misra: add deviation for PrintErrMesg() function


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Tue, 19 Aug 2025 14:32:52 +0000
  • Accept-language: en-US, uk-UA, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=t9valugcgQlnsK2Qp7SaIZUvpnlYPMRUBOINW/eHfTk=; b=dwyDdPqe6owQhasrFH3/1FyJx3j+x2C9ywh8+aZEbzKvZEda+yMomsblESu8JyGEmbrLcSvvOLfxvARqhvsMfPMyEII9LwBzwruo87/eE+3+NqPfbM1A8I7g4rtMNi+YXpRFngxMNqeUABot5TrS/VAbYKpaKVG1gOKtknoclbnAe4BsBTg9sOisqvAZqrpM8RKs7foz0ndBcnbphVJI/WIhVr65Rmr+03/J4k9WC2wmTzq+HqCO/u50gWVDrW/uixCD5RuYMqp59tYmQnNAZQdtjJN/jPM9z7dA1dqlzg5+jPp/g5d44SoDtu8u26X6DGE5bbP5MW6Kn62lrsfMcQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pwutyx1d5zZVTBqaJvyOSpAmjS6J88EP48XNSy/uQ0BB+cF4u9EXkRaBjl5POJ67Em9QpE8nsxRiYeYLpvHrPcQekeYPIDj8rDOHQ4InELmxn9TzOymJyWJDuzpAIXolTgYprpCGeROagylV/8Gh/LeSKLAKLa5wju8Lgh+NYoJlyIBUydwi/oMQDMPBcxdszWV1uD7lkglsA4LBu8ESZPRElbfHqXGtTxXA6DIgjCFcyvosVt9xlvy6n4BVfd3lPfyNXDWQeEteRk1fGzMBaSKTKf19P09T6P1kZIYupzmSAPNQTMk8wiGCXv5krB7aupCFxQ0WjOuhRO1xAW0OYg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 19 Aug 2025 14:33:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcEQr89D/JS5GCrUaBbORYWk1wAbRp920AgAASxgA=
  • Thread-topic: [PATCH] misra: add deviation for PrintErrMesg() function


On 8/19/25 16:25, Jan Beulich wrote:
> On 19.08.2025 15:12, Dmytro Prokopchuk1 wrote:
>> MISRA C Rule 2.1 states: "A project shall not contain unreachable code."
>>
>> The function 'PrintErrMesg()' is implemented to never return control to
>> its caller. At the end of its execution, it calls 'blexit()', which, in
>> turn, invokes '__builtin_unreachable()'. This makes the 'return false;'
>> statement in 'read_file()' function unreachable.
> 
> I'm disappointed. In earlier review comments I pointed out that there are
> two. Yet you say "the", without further disambiguation.
> 
>> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
>> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
>> @@ -41,6 +41,10 @@ not executable, and therefore it is safe for them to be 
>> unreachable."
>>   
>> -call_properties+={"name(__builtin_unreachable)&&stmt(begin(any_exp(macro(name(ASSERT_UNREACHABLE)))))",
>>  {"noreturn(false)"}}
>>   -doc_end
>>   
>> +-doc_begin="Unreachability caused by the call to the 'PrintErrMesg()' 
>> function is deliberate, as it terminates execution, ensuring no control flow 
>> continues past this point."
>> +-config=MC3A2.R2.1,reports+={deliberate, "any_area(^.*PrintErrMesg.*$ && 
>> any_loc(file(^xen/common/efi/boot\\.c$)))"}
>> +-doc_end
> 
> I don't understand the description here, nor ...
> 
>> --- a/docs/misra/deviations.rst
>> +++ b/docs/misra/deviations.rst
>> @@ -97,6 +97,13 @@ Deviations related to MISRA C:2012 Rules:
>>          Xen expects developers to ensure code remains safe and reliable in 
>> builds,
>>          even when debug-only assertions like `ASSERT_UNREACHABLE() are 
>> removed.
>>   
>> +   * - R2.1
>> +     - Function `PrintErrMesg()` terminates execution (at the end it calls
>> +       `blexit()`, which, in turn, invokes `__builtin_unreachable()`), 
>> ensuring
>> +       no code beyond this point is ever reached. This guarantees that 
>> execution
>> +       won't incorrectly proceed or introduce unwanted behavior.
>> +     - Tagged as `deliberate` for ECLAIR.
> 
> .. the text here. PrintErrMesg() is noreturn. Why would anything need saying 
> about
> it? Isn't the problem here solely with the tail of read_file(), while other 
> uses
> of PrintErrMesg() are okay?
> 
> Jan

I'm a little bit confused.

As I understood you proposed to insert the SAF comment before the 
'return' statement (with proper justification).

And current Eclair configuration & descriptions are not good at all.

Am I right?

Dmytro.

 


Rackspace

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