From nobody Fri Nov 29 00:34:42 2024 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1653438938; cv=none; d=zohomail.com; s=zohoarc; b=bfzmBukBxKKpW+0pGVaRDo91DPdIP28XiLalhbP8XmV1cS53E+w+DSW8/BDG79QBLIZvwzBEPsVC4z7YmPuTIGT9BPxP/6eO7/2QTYxrHORGb8/vPn2vzrra9FmKsp72Dwks/4fY/XwF1GFQ0IuWwyeg+aXbV5iV9VMVoTojZH8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653438938; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NGueAwfvONdYOStsLWSzH/uRP+20eFZnqcWK7cWzasw=; b=D4L8VPZ1B15JMALFMjNu9wS78pH1ikIvpKBGCwIeHAKdVE/RVRvagCDunz/SZNvLeYBVSw9pgCjJupAfL+GYTF+F59NUFwBJIEXNU1PCyZAIGimH7KgWKf7pFTQR1IfWMHlGW/AnZVOQvmdUbUJSFBAXA+6taMszhpTcIwJ2NQA= 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 1653438938118390.1163875356068; Tue, 24 May 2022 17:35:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.336794.561219 (Exim 4.92) (envelope-from ) id 1ntezY-0001f4-EW; Wed, 25 May 2022 00:35:12 +0000 Received: by outflank-mailman (output) from mailman id 336794.561219; Wed, 25 May 2022 00:35:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ntezY-0001ex-Aw; Wed, 25 May 2022 00:35:12 +0000 Received: by outflank-mailman (input) for mailman id 336794; Wed, 25 May 2022 00:35:11 +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 1ntezX-0001N9-Gh for xen-devel@lists.xenproject.org; Wed, 25 May 2022 00:35:11 +0000 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 889b80e3-dbc2-11ec-837f-e5687231ffcc; Wed, 25 May 2022 02:35:10 +0200 (CEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CF817B81BBD; Wed, 25 May 2022 00:35:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7D1DC34100; Wed, 25 May 2022 00:35:07 +0000 (UTC) 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: 889b80e3-dbc2-11ec-837f-e5687231ffcc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653438908; bh=5xZ+kaGEO4k/xwRCqA5XePrkd+GNdWNbh3kA/sS07Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fVMx/qmcDeO5SD61bgr1oBWbp9f3tqdI/O1GT0MQWqmPDLJyMgq3gvAegR3lakIIa rvIcqCOnZuMyb2YtHRFyNdhGKPYXGcRTq4Zv0zgl0aH2L7szzYYjq1N+QzB7V2a/DZ ZJDhWyeDWv4qlsc4EnSoiEy07tIrhapgd2VVdni6C0dNBCE12+NMw8UJilVWmNR++o sMK/s9Gc1rSIuCtWY4X8OjZzoQfYjlKMDGduHIBTof/pdFdCmfTLU9dW6beZB8ujfG Z6cTDsYfQIwGM/7LfdCcCup6pELsRVl8HoH08d8HYRaskEaL7d/zcfb/AOTNzZQ5xA BkbDh+DK9btug== From: Stefano Stabellini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, andrew.cooper3@citrix.com, jbeulich@suse.com, roger.pau@citrix.com, julien@xen.org, Bertrand.Marquis@arm.com, George.Dunlap@citrix.com, Stefano Stabellini , Bertrand Marquis Subject: [PATCH 1/2] docs/misra: introduce rules.rst Date: Tue, 24 May 2022 17:35:04 -0700 Message-Id: <20220525003505.304617-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1653438939377100001 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini Introduce a list of MISRA C rules that apply to the Xen hypervisor. The list is in RST format. Add a mention of the new list to CODING_STYLE. Signed-off-by: Bertrand Marquis Signed-off-by: Stefano Stabellini --- CODING_STYLE | 6 ++++ docs/misra/rules.rst | 65 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 docs/misra/rules.rst diff --git a/CODING_STYLE b/CODING_STYLE index 9f50d9cec4..1ef35ee8d0 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -235,3 +235,9 @@ callstack between the initial function call and the fai= lure, no error is returned. Using domain_crash() requires careful inspection and documentation of the code to make sure all callers at the stack handle a newly-dead domain gracefully. + +MISRA C +------- + +The Xen Project hypervisor follows the MISRA C coding rules and +directives listed under docs/misra/rules.rst. diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst new file mode 100644 index 0000000000..c0ee58ab25 --- /dev/null +++ b/docs/misra/rules.rst @@ -0,0 +1,65 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +MISRA C rules for Xen +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +**IMPORTANT** All MISRA C rules, text, and examples are copyrighted by the +MISRA Consortium Limited and used with permission. + +Please refer to https://www.misra.org.uk/ to obtain a copy of MISRA C, or = for +licensing options for other use of the rules. + +The following is the list of MISRA C rules that apply to the Xen Project +hypervisor. + +- Rule: Dir 2.1 + - Severity: Required + - Summary: All source files shall compile without any compilation errors + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/D_02_01.c +- Rule: Dir 4.7 + - Severity: Required + - Summary: If a function returns error information then that error info= rmation shall be tested + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/D_04_07.c +- Rule: Dir 4.10 + - Severity: Required + - Summary: Precautions shall be taken in order to prevent the contents = of a header file being included more than once + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/D_04_10.c +- Rule: Dir 4.14 + - Severity: Required + - Summary: The validity of values received from external sources shall = be checked + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/D_04_14.c +- Rule: Rule 1.3 + - Severity: Required + - Summary: There shall be no occurrence of undefined or critical unspec= ified behaviour + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_01_03.c +- Rule: Rule 3.2 + - Severity: Required + - Summary: Line-splicing shall not be used in // comments + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_03_02.c +- Rule: Rule 6.2 + - Severity: Required + - Summary: Single-bit named bit fields shall not be of a signed type + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_06_02.c +- Rule: Rule 8.1 + - Severity: Required + - Summary: Types shall be explicitly specified + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_08_01.c +- Rule: Rule 8.4 + - Severity: Required + - Summary: A compatible declaration shall be visible when an object or = function with external linkage is defined + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_08_04.c +- Rule: Rule 8.5 + - Severity: Required + - Summary: An external object or function shall be declared once in one= and only one file + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_08_05_2.c +- Rule: Rule 8.6 + - Severity: Required + - Summary: An identifier with external linkage shall have exactly one e= xternal definition + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_08_06_2.c +- Rule: Rule 8.8 + - Severity: Required + - Summary: The static storage class specifier shall be used in all decl= arations of objects and functions that have internal linkage + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_08_08.c +- Rule: Rule 8.12 + - Severity: Required + - Summary: Within an enumerator list the value of an implicitly-specifi= ed enumeration constant shall be unique + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_08_12.c --=20 2.25.1 From nobody Fri Nov 29 00:34:42 2024 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1653438939; cv=none; d=zohomail.com; s=zohoarc; b=a+JjL1RvS1uk133N0RHWLYMiCmKSPsX/gCP6xxUXlDnZV5hvQ6R1sJjQGs7q1X3WJ3H0jMR9Xd31689Xe6MJB/M4nElaGYapG7y8OTc46TRI9bMPRfjv5CxmDS1gL44LbEB1a1/nE16pg9oVWsOL9MRIejD9bVrVBQ9BGVET1LY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653438939; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xDtQx0pf5On1+A00eyAsreyYTpOSLTeelr1enX1fmNM=; b=O4Cb/nz6zhDxH6nmkOofrpLTPqO8lwgsdrr36NA0PiMrxyc0WET/LoEx6kKVeRAkrGqj4fdZBKEgrlBzLo1jNOKyx+viD30agEIRBk0UKdPTuhEyDCvIeTnAyTNMuJCgC7FIQupHly/ZGIwfAgkqzKGIMz31AwIYkq5xfYOynYE= 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 1653438939529433.3654648824671; Tue, 24 May 2022 17:35:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.336795.561230 (Exim 4.92) (envelope-from ) id 1ntezZ-0001vY-S9; Wed, 25 May 2022 00:35:13 +0000 Received: by outflank-mailman (output) from mailman id 336795.561230; Wed, 25 May 2022 00:35:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ntezZ-0001vR-Of; Wed, 25 May 2022 00:35:13 +0000 Received: by outflank-mailman (input) for mailman id 336795; Wed, 25 May 2022 00:35:12 +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 1ntezY-0001N9-Gp for xen-devel@lists.xenproject.org; Wed, 25 May 2022 00:35:12 +0000 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 88d94eac-dbc2-11ec-837f-e5687231ffcc; Wed, 25 May 2022 02:35:10 +0200 (CEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6C75FB81BFC; Wed, 25 May 2022 00:35:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A360FC34118; Wed, 25 May 2022 00:35:08 +0000 (UTC) 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: 88d94eac-dbc2-11ec-837f-e5687231ffcc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653438909; bh=sjKpMtPk4Pg6387GmnH2YJdsLfcRs7y+YGW+mPOUkgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJdcQN7MwlXt9tsknTo8xOee3y5rmdsilSBNvEh/0YyNXk8MxoG7nV56eEeSSXox/ 9MUswDFQC5tFX+p+/vQrwxjdMTny7VeNBmtY/gl6eLpJDNyndUAGgWq9U+2tIMIfd/ eEY24rinh9YJKSwWYQgo0EXVQrgfzKKmPa25gBlLNR1NkZILAgKa6xGgbrek1LfqF4 XJexjMv+QiAM9rPx3e19xqi72uMH+4pxC1AQkvATQ2cQ2yw+HomsalX8RInPLP+jm/ guj3CjZxOqCIOO809mpE30nJ8/if5mL6o/Wy1gmzfuPoElKenu0Aq0kMUMFJTPIp8r ZqEnwlYUzGz6g== From: Stefano Stabellini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, andrew.cooper3@citrix.com, jbeulich@suse.com, roger.pau@citrix.com, julien@xen.org, Bertrand.Marquis@arm.com, George.Dunlap@citrix.com, Stefano Stabellini Subject: [PATCH 2/2] docs/misra: add Rule 5.1 Date: Tue, 24 May 2022 17:35:05 -0700 Message-Id: <20220525003505.304617-2-sstabellini@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1653438941087100003 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini Add Rule 5.1, with the additional note that the character limit for Xen is 63 characters. The max length identifiers found by ECLAIR are: __mitigate_spectre_bhb_clear_insn_start domain_pause_by_systemcontroller_nosync Both of them are 40 characters long. A limit of 63 characters work for the existing code. Signed-off-by: Stefano Stabellini Acked-by: Julien Grall --- docs/misra/rules.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst index c0ee58ab25..6052fc6309 100644 --- a/docs/misra/rules.rst +++ b/docs/misra/rules.rst @@ -35,6 +35,11 @@ hypervisor. - Severity: Required - Summary: Line-splicing shall not be used in // comments - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_03_02.c +- Rule: Rule 5.1 + - Severity: Required + - Summary: External identifiers shall be distinct + - Link: https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/b= lob/master/R_05_01_2.c + - Note: the Xen characters limit for identifiers is 63 - Rule: Rule 6.2 - Severity: Required - Summary: Single-bit named bit fields shall not be of a signed type --=20 2.25.1