[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] misra: deviate MISRA C Rule 18.3 for linker symbols
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
- Date: Thu, 3 Dec 2026 12:52:28 +0200
- 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=m5F9S+e3mSA4pceE/2+XVWuDR0VKZ5/vdBCI1FJJhcA=; b=qBcd54wNyrwmSOZuftYbrlyv48JiQTTD0l/6sei+U5gNuVf15+SucGhPcCgVkjOqrDLSmmOcO4VTwTzpqxWJAmfAwmTDGGtFffifemLrbOEs435cKL0V3HajFA2+NTlHL96u7wYbBtbbW4wp+aEmZu2tmCFtZ4MLo4K/hJKOvIg8pBKE5B0lN4/z0hcc8/Hcewg2PfxGPOfdT+8ojRVsECyMKIldRRVxGlLjiQxVdFafYD+B1U4pZCWKGCH2Kb+IIp6ykM858ZD4ev2KCF+j3SlcvH/VwjvD82jUA0HDLAtGV8wJ6l0LIlRA6yayJsqZl/A+gy4mPs3563/6BEhWaA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IgcJpLoliFMUrkf1OwBujZGPuenTAJ+yjze9CVpKKg/Ig1IU4csdvSAq1cqFdIw8g0RTVKww7wF2jj2ZgEwyzujVOK4J/fqJTbokOLUQNEZk1zKZlKSdzexvDtSy2YpDxTEn4tmVYhUxdzENuphx5Mb91xKrGITvqlTBJjCldOhVTAztSE5NeliOIBOG72hTsbQqeJYLdNYtJW3fxP4vWmZpthSJl1jenHE/YLjtImnf8DGiFnSCFWUrLgvHXlNHyOSidUFU/enxp7PamHCNyP5+XVGd96dEqve69+YEV+WR9Ejy1RatLxugG0ZuHqfEQZEyFiD31dStqxSQaD8+xQ==
- 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: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, 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>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Client-request-id: 8cf8020c-5850-45b8-8e3e-38de33d76ac5
- Delivery-date: Thu, 03 Dec 2026 10:52:48 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Request-id: d6a454d8-6b67-4170-e591-08df512b86a4
On 12/3/26 09:51, Jan Beulich wrote:
On 02.12.2026 19:08, Dmytro Prokopchuk wrote:
On 12/2/26 09:46, Jan Beulich wrote:
On 01.12.2026 21:24, Dmytro Prokopchuk1 wrote:
MISRA C Rule 18.3 states: "The relational operators >, >=, < and <= shall
not be applied to objects of pointer type except where they point into
the same object".
Comparisons against symbols defined by the linker (e.g. _stext/_etext
in is_kernel_text()) are used to check whether an address lies within
a given section. Such comparisons are safe, as section boundaries are
laid out by the linker.
Deviate the rule for relational operators where at least one operand
refers to a linker symbol, in the same way as already done for
Rule 18.2.
Imo covering all linker symbols goes too far. We have a number of cases
where linker symbols denote array boundaries. I think those would better
not be deviated.
Agreed.
Deviating all linker symbols was too broad. For array boundaries (e.g.
__setup_start/__setup_end, __initcall_*, etc.) the pointer being
compared is expected to point into the same array, so Eclair must show
such violations (if would be).
For v2 I'd like to restrict the deviation to these is_kernel*() macros
only. Would that be acceptable?
I think so. Question is what, if any, violations then remain.
Jan
With v2 applied the remaining R18.3 violations (ARM64 and x86_64) are
all unrelated to linker symbols, and they weren't covered by v1 either.
They should be addressed separately.
Dmytro.
|