From patchwork Wed Dec 11 11:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Zucchelli X-Patchwork-Id: 13903358 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D37C4E7717D for ; Wed, 11 Dec 2024 11:05:51 +0000 (UTC) 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 X-Outflank-Mailman: Message body and most headers restored to incoming version 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-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 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 --- 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, unsigned long pc) if ( id == BUGFRAME_run_fn ) { + /* SAF-11-safe conversion for debugging purposes */ bug_fn_t *fn = bug_ptr(bug); fn(regs);