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

Re: [XEN PATCH][for-4.19 v2] xen: Add SAF deviations for MISRA C:2012 Rule 7.1


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 19 Oct 2023 17:57:36 +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=paUzkZg44djMz3PJhmxQsfRLR+/UqD5sbLMmziOv8bs=; b=asF95lK4ARMXdSqnXq9X++7lZBFphTgzw09zF7YutW3FxtxJAkXQeWkLOOGM4eYEwR+re6KO+vLAzxJrOrbH19GC7xh5SO+BLiyw5kr3AXAoFHugdpjuc3YGDFkaxt7F9gEl1RuNOVQ9hmOooilVaowtiBv0yHxXUtzD9vHKtrUkUWkZOI7XqBYlEJ0jjpiw5SQCQdJ4vFTF+uymo493x+ezKWge93b4mEqNByUFFeCgeMomzQ1XjihMryGNZFKxPG/sqQjJFz0t2AnE0oI6mxclp6HiDQfYdY78qOiTXOv7hgQPgYdcjmv+pWXa3YH0iht4sWh/PyXki9FSKs95Vg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oCXIDnGCcUqMnj88Cp+ryPIigWFsvFzpA7roB9tD8jXEGgTehYMM5fnegAUJLYQga6m7bJR+ONVH6yeNPUXm1Etr1Ji3nwd8+oq8qztNvg1DosJx01wTsfZ0IdXoVtvrBMjMRLx1WUlCdC2+/rQ8odqqwmFuLrk5IcW80dUTMpQBsVyg1eOkfwKsN2TyWZrmIHuxJktFQySptXWjJzEm+ZUR3mFYV+uc9zGNRNiGTHOSuEPkz2EcfkuJ/CmOaP9hiJw4KFH1ZsC941Idr772ScmFdxVyLHeISqm7x5glGNdXu/vH5FA9gNkVXahAGIMAXsVc1H6sfbDgHSBlZWQHhw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Simone Ballarin <simone.ballarin@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 19 Oct 2023 15:57:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.10.2023 13:04, Nicola Vetrini wrote:
> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
> @@ -85,10 +85,10 @@ conform to the directive."
>  # Series 7.
>  #
> 
> --doc_begin="Usage of the following constants is safe, since they are given 
> as-is
> -in the inflate algorithm specification and there is therefore no risk of them
> -being interpreted as decimal constants."
> --config=MC3R1.R7.1,literals={safe, 
> "^0(007|37|070|213|236|300|321|330|331|332|333|334|335|337|371)$"}
> +-doc_begin="Octal constants used as arguments to macro INSTR_ENC or MASK_EXTR
> +can be used, because they appear as is in specifications, manuals, and
> +algorithm descriptions."
> +-config=MC3R1.R7.1,reports+={safe, 
> "any_area(any_loc(any_exp(macro(^(INSTR_ENC|MASK_EXTR)$))))"}

INSTR_ENC() is a local macro in x86'es AMD SVM code. A macro of the same
name could imo be introduced without issues in, say, Arm code. The above
would then needlessly suppress findings there, aiui.

MASK_EXTR() otoh is a global macro which ise used for various purposes.
Excluding checking there is imo going too far, too.

> --- a/docs/misra/deviations.rst
> +++ b/docs/misra/deviations.rst
> @@ -90,6 +90,12 @@ Deviations related to MISRA C:2012 Rules:
>           - __emulate_2op and __emulate_2op_nobyte
>           - read_debugreg and write_debugreg
> 
> +   * - R7.1
> +     - It is safe to use certain octal constants the way they are defined in
> +       specifications, manuals, and algorithm descriptions as arguments to
> +       macros 'INSTR_ENC' and 'MASK_EXTR'.
> +     - Tagged as `safe` for ECLAIR.

Similarly this wording is imo inappropriate, while ...

> --- a/docs/misra/safe.json
> +++ b/docs/misra/safe.json
> @@ -20,6 +20,14 @@
>          },
>          {
>              "id": "SAF-2-safe",
> +            "analyser": {
> +                "eclair": "MC3R1.R7.1"
> +            },
> +            "name": "Rule 7.1: constants defined in specifications, manuals, 
> and algorithm descriptions",
> +            "text": "It is safe to use certain octal constants the way they 
> are defined in specifications, manuals, and algorithm descriptions."
> +        },

... this reads good to me.

Jan



 


Rackspace

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