[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/6] x86/Viridian: annotate Eclair false-positives for rule 18.2
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
- Date: Wed, 09 Sep 2026 15:13:14 +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=1788959594; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:X-Sender:Organization:Content-Type: Content-Transfer-Encoding; bh=N45BUT9bQLoOghpSgU8eM6kYG4cRMsUb3+R1YEfzTmw=; b=o9Cx/eci/4ZwjzPT9HCbJl4VQeuwBPTASDgcz2hxDZtc4H5kZnAQj1GV2hY1xacX29H6 ZnLihVPRfhUWxFEvgROIvUye1GzAnJhuTdPXKVXGpBHuuverKCP3QER4J3NcEWopmFcR9 r3gyLhiUPdpF10SNygRe8GcQ6lK3otWW3GNfNLMujZqee1yYJgVf1R4+rGpvCvrRyqdsf lECZIh+LHR3vfQLB7eekeRs6pf0YHFtS1odb3GqN7X4xT5sE1j/jc0yprCC2hougjheSv PngNmwWJkG/xXYvWAj3zDG90UM7WnOfrQk55rtrjgStm5Mx0jmomHOYINTZzPJz/AxhwN B7j+rpC+Z+vtw1OGTAZlG1jpI9nK01Mwl+jP/5ityZvl2U9akBF9PdMYlKjU6Di4aEBWs XGgpK/teOMfrF/cMGDtDD8LhiXvGUGWrGf1e9G5HIioIw/GJrpl0wFmB9kY53p94li6gD ti6IhmYf0pm6amJxCQcfFgbIM9g0WN6LSOq4mQwoJunZ3Wdq1YWU8Er0m34XqCPfJEKF4 MbvFjM5AvJXkO+rT+xY18un0sMDKSBKLyEBvH01mCcE5OeWJf2YvRx9S/BAb7rhl0yZdG F7+PwwPF25aqF1O3x2NfW4hAYjFZ/pa8XjbUX5HNSMDJGXu4kgp/GeHJC/3BClE=
- Arc-seal: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; cv=none; t=1788959594; b=hixid/nfu0DeRYxpIsUpAiRXT5SrL/MUPtnaebYcpk2lR8OpTMcw36XASYvZ9hu60ff4 w6MM3Aoq6CO46VugUnNss5dLiX2uj9CcLMD3MFDfY4C+t7yf7QPLsAjUUjucMSAHUgTeh YgETkrIvyYPf8I5hKQspJcuMO/nvc99MeFuyiWqg/57EsoP4/k761CmzYhH9Bia3vXWeE G+EDwXrPT1xY0t6MjgPi+ym3D7pUqug36ksqAplLqoAjdvEm4W/qpUliJi53pAUpgO8Nv SU23N1KH6fEak9pp6tQ2e7hEJBYNUqJjPTuRj0f14yRtZUDRsa5eZLg47r+50J4X8aLfG rbtIm5XqfzIUCWLWRN1ecyIulS5hNHxU6TcasBlfu/yFGdGwt2A1EKmEAlPrCM3KBniXw Qi9BPxthyDl/NpgTv4CQ4E6uJcUqKZ26+FYLRDg5vBTuJsBU3QWkCbmepc1pK/LiznKXO CBElrFJnaNnfKsubSLMmZYmmR3u9ETop39cc175ZM7AGSU9yzj6UXeNq7q9CTqJyB1pjc UBRevfXD316L9fOEt79XgyrloPBg0dsgD9YN7K+O6IeHSti0fc4dgNrL3LaHXCKRSezUn em4lrbHLbHZG9l/ZLUu7CjX9xm1K9gtFRqikv2uKMyM7qiBwobTcfILdg/kUDrY=
- 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: Wed, 09 Sep 2026 13:13:17 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2026-09-09 15:01, Jan Beulich wrote:
"Subtraction between pointers shall only be applied to pointers that
address elements of the same array" is not violated here:
start_stimer()
is only ever passed a sane argument, and stimer_expire() is either
called
from start_stimer() (using its parameter as argument) or as a callback,
where a sane callback argument is also guaranteed to be set up.
Suggested-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
As per Nicola Eclair 16.0.0 has this fixed.
Perhaps I didn't express clearly that the remark was about the violation
annotated in patch 4/6. Here instead, a suitable reproducer is not yet
available. Nevertheless, if the claim is true the approach to address
the violation is still ok.
--- a/docs/misra/false-positive-eclair.json
+++ b/docs/misra/false-positive-eclair.json
@@ -10,6 +10,13 @@
},
{
"id": "SAF-1-false-positive-eclair",
+ "violation-id": "MC3A2.R18.2",
+ "tool-version": "3.14.0",
+ "name": "Rule 18.2: pointer subtraction",
+ "text": "Viridian stimer index calculations use sane
pointers"
+ },
+ {
+ "id": "SAF-2-false-positive-eclair",
"violation-id": "",
"tool-version": "",
"name": "Sentinel",
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -136,6 +136,7 @@ static void cf_check stimer_expire(void
struct viridian_stimer *vs = data;
struct vcpu *v = vs->v;
struct viridian_vcpu *vv = v->arch.hvm.viridian;
+ /* SAF-1-false-positive-eclair vs is always sane */
unsigned int stimerx = vs - &vv->stimer[0];
set_bit(stimerx, &vv->stimer_pending);
@@ -146,6 +147,7 @@ static void start_stimer(struct viridian
{
const struct vcpu *v = vs->v;
struct viridian_vcpu *vv = v->arch.hvm.viridian;
+ /* SAF-1-false-positive-eclair vs is always sane */
unsigned int stimerx = vs - &vv->stimer[0];
int64_t now = time_ref_count(v->domain);
int64_t expiration;
--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
|