All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Luca Fancellu <luca.fancellu@arm.com>
Cc: xen-devel@lists.xenproject.org, bertrand.marquis@arm.com,
	wei.chen@arm.com,  Andrew Cooper <andrew.cooper3@citrix.com>,
	 George Dunlap <george.dunlap@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,  Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	 Wei Liu <wl@xen.org>
Subject: Re: [PATCH 4/4] xen: Justify linker script defined symbols in include/xen/kernel.h
Date: Mon, 28 Nov 2022 17:55:31 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2211281755210.1049131@ubuntu-linux-20-04-desktop> (raw)
In-Reply-To: <20221128141006.8719-5-luca.fancellu@arm.com>

On Mon, 28 Nov 2022, Luca Fancellu wrote:
> Eclair and Coverity found violation of the MISRA rule 8.6 for the
> symbols _start, _end, start, _stext, _etext, _srodata, _erodata,
> _sinittext, _einittext which are declared in
> xen/include/xen/kernel.h.
> All those symbols are defined by the liker script so we can deviate
> from the rule 8.6 for these cases.
> 
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  docs/misra/safe.json     | 9 +++++++++
>  xen/include/xen/kernel.h | 4 ++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/docs/misra/safe.json b/docs/misra/safe.json
> index e079d3038120..e3c8a1d8eb36 100644
> --- a/docs/misra/safe.json
> +++ b/docs/misra/safe.json
> @@ -3,6 +3,15 @@
>      "content": [
>          {
>              "id": "SAF-0-safe",
> +            "analyser": {
> +                "eclair": "MC3R1.R8.6",
> +                "coverity": "misra_c_2012_rule_8_6_violation"
> +            },
> +            "name": "Rule 8.6: linker script defined symbols",
> +            "text": "It is safe to declare this symbol because it is defined in the linker script."
> +        },
> +        {
> +            "id": "SAF-1-safe",
>              "analyser": {},
>              "name": "Sentinel",
>              "text": "Next ID to be used"
> diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
> index 8cd142032d3b..f1a7713784fc 100644
> --- a/xen/include/xen/kernel.h
> +++ b/xen/include/xen/kernel.h
> @@ -65,24 +65,28 @@
>  	1;                                      \
>  })
>  
> +/* SAF-0-safe */
>  extern char _start[], _end[], start[];
>  #define is_kernel(p) ({                         \
>      char *__p = (char *)(unsigned long)(p);     \
>      (__p >= _start) && (__p < _end);            \
>  })
>  
> +/* SAF-0-safe */
>  extern char _stext[], _etext[];
>  #define is_kernel_text(p) ({                    \
>      char *__p = (char *)(unsigned long)(p);     \
>      (__p >= _stext) && (__p < _etext);          \
>  })
>  
> +/* SAF-0-safe */
>  extern const char _srodata[], _erodata[];
>  #define is_kernel_rodata(p) ({                  \
>      const char *__p = (const char *)(unsigned long)(p);     \
>      (__p >= _srodata) && (__p < _erodata);      \
>  })
>  
> +/* SAF-0-safe */
>  extern char _sinittext[], _einittext[];
>  #define is_kernel_inittext(p) ({                \
>      char *__p = (char *)(unsigned long)(p);     \
> -- 
> 2.17.1
> 


  parent reply	other threads:[~2022-11-29  1:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 14:10 [PATCH 0/4] Static analyser finding deviation Luca Fancellu
2022-11-28 14:10 ` [PATCH 1/4] xen/scripts: add xen-analysis.py for coverity and eclair analysis Luca Fancellu
2022-11-29  1:39   ` Stefano Stabellini
2022-11-28 14:10 ` [PATCH 2/4] xen/scripts: add cppcheck tool to the xen-analysis.py script Luca Fancellu
2022-11-28 15:19   ` Jan Beulich
2022-11-28 15:37     ` Luca Fancellu
2022-11-29  9:42       ` Jan Beulich
2022-11-29  9:49         ` Luca Fancellu
2022-11-30  1:05   ` Stefano Stabellini
2022-11-30 11:59     ` Luca Fancellu
2022-11-30 20:26       ` Stefano Stabellini
2022-12-01  8:33         ` Jan Beulich
2022-12-01 11:18           ` Luca Fancellu
2022-12-01 11:20             ` Jan Beulich
2022-12-01 15:15               ` Stefano Stabellini
2022-12-01 15:34         ` Luca Fancellu
2022-12-01 20:23           ` Stefano Stabellini
2022-12-02 13:09             ` Luca Fancellu
2022-12-03  0:41               ` Stefano Stabellini
2022-11-28 14:10 ` [PATCH 3/4] tools/misra: fix skipped rule numbers Luca Fancellu
2022-11-29 23:51   ` Stefano Stabellini
2022-11-30  8:53     ` Luca Fancellu
2022-11-30 23:34       ` Stefano Stabellini
2022-12-01 11:27         ` Luca Fancellu
2022-12-01 15:16           ` Stefano Stabellini
2022-11-28 14:10 ` [PATCH 4/4] xen: Justify linker script defined symbols in include/xen/kernel.h Luca Fancellu
2022-11-28 15:19   ` Jan Beulich
2022-11-29  1:55   ` Stefano Stabellini [this message]
2022-11-29  1:55 ` [PATCH 0/4] Static analyser finding deviation Stefano Stabellini
2022-11-29  9:46   ` Luca Fancellu
2022-11-29 13:02     ` Luca Fancellu

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=alpine.DEB.2.22.394.2211281755210.1049131@ubuntu-linux-20-04-desktop \
    --to=sstabellini@kernel.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=luca.fancellu@arm.com \
    --cc=wei.chen@arm.com \
    --cc=wl@xen.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.