From nobody Wed Feb 5 17:01:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=bugseng.com ARC-Seal: i=1; a=rsa-sha256; t=1733915158; cv=none; d=zohomail.com; s=zohoarc; b=LAAqt4v3tY/l/zxLT5U70usw3z1xmzVq2AgkV81Jd0guyQVnRXkil7i7gX5k2m5qAteDKxLfQRNJwLJX/vdMDZn446F/JGhV3IGZk/SxUkKNzxHe11THOfxNXX373dOIe8CNP2PfIjiS1osADghx7VSSip3pu9Q2Os86jtHm0Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733915158; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qGoRYaa6hW+RjxEGED1UKcXYVCNKYdAfFazf+LxXB7k=; b=cSS7PGE5jDuSFPWvpprsn/vJOjFAokNBnCEz92MAx5PR3oYXZRkRR23Xlm6kR3U/Nb1g0E/G2lvj+4tMfOrAIYHaKqm9wYGRu1/+A3Mmd3m8VgW5jRpMpud+BMtWq1BZ41DYkspe5yh3eImPA+hlELwr7s3y2augipaMtCG0l6E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1733915158329139.5013035255813; Wed, 11 Dec 2024 03:05:58 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.854572.1267743 (Exim 4.92) (envelope-from ) id 1tLKXH-0001rf-AD; Wed, 11 Dec 2024 11:05:43 +0000 Received: by outflank-mailman (output) from mailman id 854572.1267743; Wed, 11 Dec 2024 11:05:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tLKXH-0001rY-7Z; Wed, 11 Dec 2024 11:05:43 +0000 Received: by outflank-mailman (input) for mailman id 854572; Wed, 11 Dec 2024 11:05:42 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tLKXG-0001rS-Ai for xen-devel@lists.xenproject.org; Wed, 11 Dec 2024 11:05:42 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d8c71119-b7af-11ef-99a3-01e77a169b0f; Wed, 11 Dec 2024 12:05:35 +0100 (CET) Received: from delta.homenet.telecomitalia.it (host-82-59-161-229.retail.telecomitalia.it [82.59.161.229]) by support.bugseng.com (Postfix) with ESMTPSA id EC8894EE073C; Wed, 11 Dec 2024 12:05:37 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d8c71119-b7af-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bugseng.com; s=mail; t=1733915140; bh=wC1Aqf8BmRMuPcItSpajMDm16p7p3y9cXkXxpzBiXb8=; h=From:To:Cc:Subject:Date:From; b=UPepWeu0m+YZOoIkElhcQJtmaZTv0b+ceOJm8GfXRT5aYk6qRcWkpGXlYwE7pMlB3 bMIca0SpMChJrsRBubNrujQb3DDGFff2AyszPoeXfCyiajWtUlzERvKqJiMTfdlqfU kahtfVxQnoQXv1FuSSxeAdgsEbIrZKAJc0rirz1pcur4ptvRPvz0XFr4m0KbUdKcsH d6EQRCBSFUex0HySXIFdo0SCNxb4YJt+X+nsuPODKOPDFduBp31Ot0z826fRogEEyK 1sCtxtamwLio71S/iqSkbv2R1LQXBx9Lvht9Hjlt4x75osfsfpV+1BMdAdIhLcuDDb WFBLuBuQCu+AA== From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Alessandro Zucchelli , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH] misra: add deviation for MISRA C Rule R11.1. Date: Wed, 11 Dec 2024 12:05:30 +0100 Message-ID: <8db58416ce215a3c5fdba8074dc21f32116e8a41.1733915076.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @bugseng.com) X-ZM-MESSAGEID: 1733915159640116600 Content-Type: text/plain; charset="utf-8" Rule 11.1 states as following: "Conversions shall not be performed between a pointer to a function and any other type". In "xen/common/bug.c", in order to get additional debug information, pointer "bug_fn_t *fn" in the data section is converted to a function pointer, which is then used to get such information. This specific conversion has been reviewed and found to have no undefined behaviour associated to it, therefore it can be exempted from compliance. Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- As this patch introduces a deviation for service MC3A2.R11.1, it depends on the following patch and shall not be applied prior to its application. https://lore.kernel.org/xen-devel/cf13be4779f15620e94b99b3b91f9cb040319989.= 1733826952.git.alessandro.zucchelli@bugseng.com/T/#u --- docs/misra/safe.json | 8 ++++++++ xen/common/bug.c | 1 + 2 files changed, 9 insertions(+) diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 684346386e..d80fb3a48f 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -92,6 +92,14 @@ }, { "id": "SAF-11-safe", + "analyser": { + "eclair": "MC3A2.R11.1" + }, + "name": "Rule 11.1: conversion for debugging purposes", + "text": "conversion of selected pointers to function pointers = for debugging purposes are safe." + }, + { + "id": "SAF-12-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/common/bug.c b/xen/common/bug.c index 75cb35fcfa..2d08bb3d41 100644 --- a/xen/common/bug.c +++ b/xen/common/bug.c @@ -44,6 +44,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, unsign= ed long pc) =20 if ( id =3D=3D BUGFRAME_run_fn ) { + /* SAF-11-safe conversion for debugging purposes */ bug_fn_t *fn =3D bug_ptr(bug); =20 fn(regs); --=20 2.43.0