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

Re: [PATCH 10/14] ELF/notes: use pointer-to-const by default in ELFNOTE_...()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Tue, 22 Sep 2026 11:01:21 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=V3W5tUjS+MCwugElpeUBsmEcQeNOhcCMCJZ7r4GSvwY=; b=fN+q7pf8XcB0VQLosIdXzXmCt0RfYSyksXcCsNtjr5uGoOUXDpP3UiH31/k3DwEfkrfv8rpWZS0BIVMxsf9WJdHRoaxzSlEFbVxrtEIxbFGE1LynV52dFeAS4j8rqctjcWHn8oyoRLJHwBC5gv4W8K5ztAM7scG7MToGg9afq8mYnWVxphw4B82++WhbnY2KKkOzBxzwwUHIaYHTbrOA8PXsGwI93CrEpfPjYLiSlHPwM8sbttKzvyTFOTNRv8Gge2op0JsKlEI/t1mpoAvZK2bsCgwjXixAerNoZIGc2sIMduJRsevU2GWex7e5Q46jOP7N6x174emChb1tNZeSPw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b3tpahzainPqapkGEh7njg4BaCpLABpZpT7tH4S3NgEWao/c7JbIVVvhnomRCIezWoEb6PjuDmrwwx5zmq+nUSFAPT4NMe0PhNkEhCOj5m+YYX12pDi7DolpL/Sa+Z8tCQnoz0LrVjXOo4KDexcb0IQaGQWImgsfsnaXlE65CP++U812tpVCd7y6UF+uOjeCcp8vK8PEwxVRmHylaUBCP5/BAtFQxt+kIY2pN9hAvxdn5oxnzfHkdQtJM8VWR+KYYat/DARDLgTGRg0+8cxYQtVowGXDdON/mVfrPm72K0AWRWwF2sOLd60Osos9F6gRLh81DzpPKwoOXu1aMa1S3g==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>
  • Delivery-date: Tue, 22 Sep 2026 11:01:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdOqU2Vkz5DOI+4USs/ahFyLHJfA==
  • Thread-topic: [PATCH 10/14] ELF/notes: use pointer-to-const by default in ELFNOTE_...()

Hi Jan,

Jan Beulich <jbeulich@xxxxxxxx> writes:

> On 22.09.2026 03:45, Volodymyr Babchuk wrote:
>> Jan Beulich <jbeulich@xxxxxxxx> writes:
>>> Not doing so results in a number of Misra rule 11.8 (casting away of
>>> const-ness) violations. We need to allow kexec to use pointer to non-
>>> const though, so provide a means to override the default.
>>>
>>> For ELFNOTE_NEXT() we can do better and simply re-apply the type of the
>>> incoming pointer.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>>
>>> --- a/xen/common/kexec.c
>>> +++ b/xen/common/kexec.c
>>> @@ -6,6 +6,9 @@
>>>   * - Magnus Damm <magnus@xxxxxxxxxxxxx>
>>>   */
>>>  
>>> +/* We're producing ELF notes here. */
>>> +#define ELFNOTE_CONST
>> 
>> Frankly, it feels backwards. When reading this line of code I am
>> assuming that you are adding constness to ELF notes because you are
>> defining ELFNOTE_CONST. And I had to check the elf.h to understand that
>> you are doing exactly opposite. I am pretty sure that other people will
>> confused by this as well.
>
> Well, that's certainly possible. Yet then you or them are asked to make
> an alternative suggestion. An option I could think of would be to merely
> rename what is ELFNOTE_CONST right now, to no longer have the word
> "CONST" in it. ELFNOTE_MODIFIER maybe, albeit that reads a little clumsy
> to me.

Taking into account that we need 'const' to be enabled by default, maybe
something like that?

#ifndef ELFNOTE_NO_CONST
#define __ELFNOTE_CONST const
#else
#define __ELFNOTE_CONST
#endif

?

And then use

#define ELFNOTE_NO_CONST

in this hunk

-- 
WBR, Volodymyr


 


Rackspace

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