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

[XEN PATCH] misra: deviate violations of Rule 21.6


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Tue, 1 Jul 2025 19:50:53 +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=AK9RY5BMGQQPbiULiN7ngcIXmj6sxM6MiJfpvUXN/N0=; b=ZKSAus+sjVEZD2TFdD9ueL3eIZ0sNKN8XM9RARrQzkiftVaso2cukd1R8MYLivtBn89aeiwB/ZEAm4umRXl7Pa5PFk+RPLljNqU6au8wA5Y321qvWN2kmGLlUZMuC1/TM+6+DxIepQp7j0R2wEKJZYs0Q4tpShNhhyk10w9NcmwPWOi4KNkt6DAqI0fBrcez/VeRbXF8axdQVO5OeY0udXD3VfqLViyQUvLRq8L6Tj4/EdTbSxsJLnwS4+2HTj7Jrte+lc6eumfDcANh1WFB2XGiGfmDoLExfcn9YTTtr3VjTiCkZxiMLg6Cip4sBjRlBIDowGvRM+gKL5P2anYENg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bI6fTInhpfQeWqSvjUqgtmp/W0vjmWN7EDvCZRmSg9mZ7W3p9rBDXZyWAHJazDhuz4g2PwSUtUHoZTHWkkEve3Q02wQoMT3jNrznesQmN3L2K2n7brjxYHVgHLSJA210i5T1iMeVOPTa3v/Rys8WrxJ85YKQWAGZ8NJh81+HnSI9etQI6Gs2FaU6tGqzztK/eWDOY/BAwMCjBRttn+9MsuXpASzm2KxI78FAsLZ3/GeY4Q9BkW6yFcwCfxxpndTMxltwQE+rqLRfh1PEqAEzZQGI9BmEjDliBCKU3msi6lIRGrFXfYpXuLpKfcfLA7UllIOr5gJr8Kkn56L7NphqaA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Federico Serafini <federico.serafini@xxxxxxxxxxx>, 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>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Delivery-date: Tue, 01 Jul 2025 19:51:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHb6sFzLVXZNQ9kcU6nwe5F2wXIFg==
  • Thread-topic: [XEN PATCH] misra: deviate violations of Rule 21.6

From: Federico Serafini <federico.serafini@xxxxxxxxxxx>

MISRA C Rule 21.6 states that "The Standard Library input/output
functions shall not be used".

Xen does not use the functions provided by the Standard Library,
uses -nostdlib to ensure this.
Xen implements a set of functions that share the same names as their
Standard Library equivalent. The implementation of these functions is
available in source form: if some undefined or unspecified behavior
does arise in the implementation, it falls under the jurisdiction of
other MISRA guidelines.

Update ECLAIR configuration to deviate violations of the rule,
tag it as clean and add it to the monitored set.

Updated docs/misra/deviations.rst accordingly.

Signed-off-by: Federico Serafini <federico.serafini@xxxxxxxxxxx>
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
---

The latest Eclair analysis shows 20 violations (ARM64 and X86_64) of the rule 
MC3A2.R21.6.
In details:
14 violations - use of function `snprintf(char*, size_t, const char*, ...)' 
(<stdio.h>)
6  violations - use of function `vsnprintf(char*, size_t, const char*, 
va_list)' (<stdio.h>)
As mentioned before Xen doen't use Standard Library input/output functions.
It implements its own functions in the common/vsprintf.c.
So this Rule can be deviated.

 automation/eclair_analysis/ECLAIR/deviations.ecl |  3 ++-
 automation/eclair_analysis/ECLAIR/monitored.ecl  |  1 +
 automation/eclair_analysis/ECLAIR/tagging.ecl    |  1 +
 docs/misra/deviations.rst                        | 11 ++++++++++-
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl 
b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 9c67358d46..3a4d9ee3c0 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -650,7 +650,8 @@ implements a set of functions that share the same names as 
their Standard Librar
 The implementation of these functions is available in source form, so the 
undefined, unspecified
 or implementation-defined behaviors contemplated by the C Standard do not 
apply.
 If some undefined or unspecified behavior does arise in the implementation, it
-falls under the jurisdiction of other MISRA rules."
+falls under the jurisdiction of other MISRA guidelines."
+-config=MC3A2.R21.6,reports+={deliberate, "any()"}
 -config=MC3A2.R21.9,reports+={deliberate, "any()"}
 -config=MC3A2.R21.10,reports+={deliberate, "any()"}
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl 
b/automation/eclair_analysis/ECLAIR/monitored.ecl
index ca2f5e3c7f..e2ad224d79 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -82,6 +82,7 @@
 -enable=MC3A2.R20.14
 -enable=MC3A2.R21.3
 -enable=MC3A2.R21.4
+-enable=MC3A2.R21.6
 -enable=MC3A2.R21.5
 -enable=MC3A2.R21.7
 -enable=MC3A2.R21.8
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl 
b/automation/eclair_analysis/ECLAIR/tagging.ecl
index f9da5d5f4d..5bf214f480 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -93,6 +93,7 @@ MC3A2.R20.14||
 MC3A2.R21.3||
 MC3A2.R21.4||
 MC3A2.R21.5||
+MC3A2.R21.6||
 MC3A2.R21.7||
 MC3A2.R21.8||
 MC3A2.R21.9||
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index fe0b1e10a2..6cd8f48c91 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -587,7 +587,16 @@ Deviations related to MISRA C:2012 Rules:
        construct is deviated only in Translation Units that present a violation
        of the Rule due to uses of this macro.
      - Tagged as `deliberate` for ECLAIR.
-     
+
+   * - R21.6
+     - Xen does not use the input/output functions provided by the C
+       Standard Library, but provides in source form its own implementation,
+       therefore any unspecified or undefined behavior associated to the
+       functions provided by the Standard Library does not apply. Any such
+       behavior that may exist in such functions is therefore under the
+       jurisdiction of other MISRA C guidelines.
+     - Tagged as `deliberate` for ECLAIR.
+
    * - R21.9
      - Xen does not use the `bsearch` and `qsort` functions provided by the C
        Standard Library, but provides in source form its own implementation,
-- 
2.43.0



 


Rackspace

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