Xen-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: xen-devel@lists.xenproject.org,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Teddy Astie" <teddy.astie@vates.tech>,
	"Roger Pau Monné" <roger@xenproject.org>
Subject: Re: [PATCH 1/4] x86/domain: address Misra rule 11.1 violation in reset_stack_and_call_ind()
Date: Sat, 12 Sep 2026 17:09:04 +0200	[thread overview]
Message-ID: <bddc66b1fc0936a9a85365969f17254c@bugseng.com> (raw)
In-Reply-To: <be5f65cc-332e-4292-9b63-33196cc8ce81@suse.com>

On 2026-09-03 13:43, Jan Beulich wrote:
> Eclair dislikes both sides of the comparison to differ in noreturn
> attributes, thus deeming this a violation of "Conversions shall not be
> performed between a pointer to a function and any other type". Since 
> gcc
> doesn't permit use of "noreturn" types used in a typecast, resort to
> typeof().
> 
> No functional change intended.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

> ---
> Really Eclair's diagnosis is misleading here, and not only because of 
> the
> missing "noreturn" there, making both sides be identical: There are no
> implicit conversions performed on this kind of pointer operands of an
> equality expression. A diagnosis of "comparison of pointers to 
> different
> types", along the lines of what compilers use, would be more to the 
> point.
> 

The point here is that the types are not identical, if you consider 
noreturn as part of the function type (as clang does) or not (as GCC 
does). This is the reason why we err on the side of caution and diagnose 
this, and it's not likely to change in the near future. Perhaps we could 
make the violation message more explicit about the motivation of the 
mismatch.

> --- a/xen/arch/x86/include/asm/current.h
> +++ b/xen/arch/x86/include/asm/current.h
> @@ -208,7 +208,7 @@ unsigned long get_stack_dump_bottom (uns
>  /* The constraint may only specify non-call-clobbered registers. */
>  #define reset_stack_and_call_ind(fn)                                   
>  \
>      ({                                                                 
>  \
> -        (void)((fn) == (void (*)(void))NULL);                          
>  \
> +        (void)((fn) == (typeof(dom_xen->arch.ctxt_switch->tail))NULL); 
>  \
>          switch_stack_and_jump(fn, "INDIRECT_CALL %", "b");             
>  \
>      })

-- 
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253


  reply	other threads:[~2026-09-12 15:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 11:42 [PATCH 0/4] address most remaining rule 11.1 violations Jan Beulich
2026-09-03 11:43 ` [PATCH 1/4] x86/domain: address Misra rule 11.1 violation in reset_stack_and_call_ind() Jan Beulich
2026-09-12 15:09   ` Nicola Vetrini [this message]
2026-09-14  6:21     ` Jan Beulich
2026-09-03 11:43 ` [PATCH 2/4] Eclair: relax long <-> function-pointer conversion deviation Jan Beulich
2026-09-12 15:19   ` Nicola Vetrini
2026-09-14  6:23     ` Jan Beulich
2026-09-14 10:51       ` Nicola Vetrini
2026-09-03 11:44 ` [PATCH 3/4] Eclair: relax "noreturn" " Jan Beulich
2026-09-12 16:04   ` Nicola Vetrini
2026-09-14  6:27     ` Jan Beulich
2026-10-05 19:05       ` Dmytro Prokopchuk1
2026-09-03 11:44 ` [PATCH 4/4] x86/kexec: address Misra rule 11.1 violation in machine_kexec_load() Jan Beulich
2026-09-12 16:06   ` Nicola Vetrini
2026-10-05 20:05   ` Dmytro Prokopchuk1
2026-09-03 11:45 ` [PATCH 0/4] address most remaining rule 11.1 violations Jan Beulich

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=bddc66b1fc0936a9a85365969f17254c@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger@xenproject.org \
    --cc=teddy.astie@vates.tech \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox