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

Re: [PATCH 1/4] x86/domain: address Misra rule 11.1 violation in reset_stack_and_call_ind()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Date: Sat, 12 Sep 2026 17:09:04 +0200
  • Arc-authentication-results: i=1; bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Arc-message-signature: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; c=relaxed/relaxed; t=1789225744; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:X-Sender:Organization:Content-Type: Content-Transfer-Encoding; bh=ejPTY9h43ECeayBtlQG6CqAEIQZT5Y2gmubrHLJQH+M=; b=417MyG5HjfeqkAlSV9uyMZmU5bUrY4HF2/kRZxo535W3w9fkwXJeZ12dZB+Jf944ZCJX ehFdlpEUasQWdAvAKbyrU/sXKYfFJwevUK8kaptjOHBJkZ8lswtsT6MBPUVJ2kGGQEsyQ wTKOadBapvaCHA3efHCK1/0tli/dy/q2dbJEdLaYWSr6GtUxnf/TDJZ913G0ohZOeAiwX Zdo9qr0snHsoXFXnKdnCYK+O9UjMopdFr84ZbBzUs/cjOTgHFgDPWoMbmB+88WwXtctal hBnUfnePbmmSZIt5mlADuN9scCTK7qPYZl587m3XJEL9BvpxNkn4HKvKTnAq8YtIhhNjX bGc9ElqWspObrNx6aN7YubJwiiLMnYGNywZjcGNyPzj/epULqwvVLatfccOP8OqnycdOH pzCDDkz15Y0VnESiaurHcz66DucBk2etHgDpOFPEVByu4C3pnECPSCXGnpttUOaTJMCeo JxwAwiTph15Ybqa/+lG6DpDaOzWIJVish1EqTws8hDo2sHpv/dIBmeO0G6ddV6KC6U+8c c20DsohYGtA/gtTjS85t52vgYtERypB6ta1PL5Q1CZj0T0bS5SG5HweJW08SfvtHldMSZ PKATo8sASDQ9PQDvrACY5QGCxOHbkE/NYNnzfVpTHfZqqJbR5k2JGPq/ZPWqPs8=
  • Arc-seal: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; cv=none; t=1789225744; b=LJYESk4J4p+XnQTbNXqgJGilJi312ySvRVaXS2sIk7mVZMqluWb/UlH8HVj70u4k408B +gHytz7aqKfvSCg4g6ORBAkpL3PBi1gBIyexuxu+CTgVd0aY4qVr1KmgyLKXfHrMq5HBz KPjUX6fyyGgxorZTc8QsNxEkodjkayxBReEPK3zmllu2M5yGWZ4Uv09ZitnhC4t5r9giq xPG61BoAa18lvgKMhy66UNHfoOhS5COY8NFQN825GjKLA6AIhBL1n/wyiUPXULbLSX1TB uvL5knFivPXA1c+fakh1Xh3jFTR8b+D1L20eQW4G2jIt3SODK72/wEtH3z1GT3bJz+sIR gC/lXMCJenlzTBdTQdbKGhHHcpGZ+upBE0FoaNKenXLWJ4lZGrPxHrUzWlwE4vjRVoeOE +uVXYgrPmkn+dB070HE5xvjAxnPXpEtJ+nYxrLFCc918eWhv++oy+x4tMD/mdFZyNie9r uF7X9b1/CsRn+ZpUgOnsRKF8cyIGl2zunS3pGi74tRMKm/goHRGnNqrz6rsxf814lekki ocsWMMxS8Nw6kLEa6IzNB8jM62FdMSMr6P1JfmZJS/rJn0ip6BJDb5buhU32WeG6hRdcf f0N+EocVjCyNKFf53JkY6UoFso5HcNSiAcLku2FWH1+y08UqBBnmcas0E/nGC0w=
  • Authentication-results: eu.smtp.expurgate.cloud; none
  • Authentication-results: bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>
  • Delivery-date: Sat, 12 Sep 2026 15:09:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>

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

---
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



 


Rackspace

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