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

Re: [PATCH] automation/eclair: generalize the noreturn function-pointer deviation


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 13 Oct 2026 14:37:11 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:Content-Type:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Doug Goldstein <cardoe@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Delivery-date: Tue, 13 Oct 2026 12:37:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.10.2026 13:46, Nicola Vetrini wrote:
> On 2026-10-12 08:52, Jan Beulich wrote:
>> On 09.10.2026 17:37, Nicola Vetrini wrote:
>>> On 2026-10-05 20:56, Dmytro Prokopchuk1 wrote:
>>>> The R11.1 safe cast only matched void noreturn (*)(void *). Accept 
>>>> any
>>>> noreturn function pointer converted to a compatible function pointer.
>>>> canonical() covers typeof destinations, and 
>>>> compatible_deep_unqualified
>>>> keeps the parameter and return types aligned.
>>>>
>>>> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
>>>> ---
>>>>
>>>> This patch tries to cover both of these:
>>>>
>>>> 1. eclair: widen R11.1 noreturn cast deviation
>>>> https://patchew.org/Xen/c6632dd805a119aca54b9d1ae2eea68ef9c1334c.1790674358.git.dmytro._5Fprokopchuk1@xxxxxxxx/
>>>>
>>>> 2. Eclair: relax "noreturn" function-pointer conversion deviation
>>>> https://patchew.org/Xen/6d212d60-5c0b-4909-996d-5d6a4906b7e1@xxxxxxxx/4cca58b6-b555-4064-aa26-5204dc4b99cc@xxxxxxxx/
>>>>
>>>> Test CI pipeline:
>>>> https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/2914802667
>>>>
>>>> The only one Rule11.1 violation remains, which is covered by this 
>>>> Jan's
>>>> patch:
>>>> x86/kexec: address Misra rule 11.1 violation in machine_kexec_load()
>>>>
>>>
>>> The change itself is fine, but the aspect I'm concerned with is the
>>> following: if you have a function marked noreturn, the compiler is
>>> entitled to
>>> essentially remove any code following it, so in principle this could 
>>> be
>>> the case also when invoking a function pointer (i.e. the compiler has 
>>> no
>>> obligation to retain code after a call to a function pointer that is
>>> actually a noreturn function). While this in practice may not happen
>>> often (e.g., the analysis done by a compiler is probably too shallow 
>>> to
>>> actually infer paths where the function pointer is only ever assigned 
>>> to
>>> noreturn functions when it is called), it is still not completely true
>>> to say that the behavior is not altered by casting away noreturn.
>>
>> With "behavior" here you mean that of the compiler? Because Xen's 
>> behavior
>> won't change if the code following such an indirect call isn't 
>> eliminated.
>> It will "just" be unreachable code then.
>>
>> That said, ...
> 
> I was more worried about the other direction: code that is expected to 
> be executed by the developer that is instead removed by the compiler, 
> with (rightfully) no diagnostic. Clearly if code is not removed it would 
> be unreachable, but such that a static analysis tool or compiler will 
> likely not diagnose, precisely because the attribute is dropped, so 
> there may be missing diagnostics.

Hmm, interesting. The noreturn attribute isn't visible at call sites
anyway, so I don't quite see how that would be any more unexpected than
for a normal (direct) function call.

Jan



 


Rackspace

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