automation/eclair: update ECL configurations and builds
cover automation/eclair: update ECL configurations and builds
This series contains new ECL configurations and adds some build options in the ARM64 build.
Simone Ballarin (3):
automation/eclair: update clean guidelines
automation/eclair: add ECL deviations
automation/eclair: update analyzed builds
.../eclair_analysis/ECLAIR/deviations.ecl | 34 ++++++++----------- automation/eclair_analysis/ECLAIR/tagging.ecl | 17 ++++++++-- automation/eclair_analysis/xen_arm_config | 14 +++----- automation/eclair_analysis/xen_x86_config | 9 ----- 4 files changed, 34 insertions(+), 40 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 automation/eclair: update clean guidelines
This patch splits the former list in two separate selectors clean_guidelines_common and additional_clean_guidelines.
clean_guidelines_common contains the guidelines that are clean in both the analyzed builds, instead additional_clean_guidelines is popolated depending on the current one.
The following clean guidelines have been added:
- MC3R1.R1.1;
- MC3R1.R1.3;
- MC3R1.R3.1;
- MC3R1.R4.1;
- MC3R1.R17.4;
- MC3R1.R22.6;
- MC3R1.D4.3 (just x86_64);
- MC3R1.R5.3 (just arm64);
- MC3R1.R7.2 (just arm64);
- MC3R1.R8.6 (just arm64);
- MC3R1.R9.3 (just arm64).
--- automation/eclair_analysis/ECLAIR/tagging.ecl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
automation/eclair_analysis/ECLAIR/tagging.ecl +15 -2
@@ -28,7 +28,20 @@ #################### -doc_begin="Clean guidelines: new violations for these guidelines are not accepted." --service_selector={clean_guidelines,"^(MC3R1\\.D1\\.1|MC3R1\\.D2\\.1|MC3R1\\.D4\\.11|MC3R1\\.D4\\.14|MC3R1\\.R1\\.4|MC3R1\\.R2\\.2|MC3R1\\.R3\\.2|MC3R1\\.R5\\.1|MC3R1\\.R5\\.2|MC3R1\\.R5\\.4|MC3R1\\.R6\\.1|MC3R1\\.R6\\.2|MC3R1\\.R7\\.1|MC3R1\\.R8\\.1|MC3R1\\.R8\\.5|MC3R1\\.R8\\.8|MC3R1\\.R8\\.10|MC3R1\\.R8\\.12|MC3R1\\.R8\\.14|MC3R1\\.R9\\.2|MC3R1\\.R9\\.4|MC3R1\\.R9\\.5|MC3R1\\.R12\\.5|MC3R1\\.R17\\.3|MC3R1\\.R17\\.6|MC3R1\\.R21\\.13|MC3R1\\.R21\\.19|MC3R1\\.R21\\.21|MC3R1\\.R22\\.2|MC3R1\\.R22\\.4|MC3R1\\.R22\\.5)$" + +-service_selector={clean_guidelines_common,"^(MC3R1\\.D1\\.1|MC3R1\\.D2\\.1|MC3R1\\.D4\\.11|MC3R1\\.D4\\.14|MC3R1\\.R1\\.1|MC3R1\\.R1\\.3|MC3R1\\.R1\\.4|MC3R1\\.R2\\.2|MC3R1\\.R3\\.1|MC3R1\\.R3\\.2|MC3R1\\.R4\\.1|MC3R1\\.R5\\.1|MC3R1\\.R5\\.2|MC3R1\\.R5\\.4|MC3R1\\.R6\\.1|MC3R1\\.R6\\.2|MC3R1\\.R7\\.1|MC3R1\\.R8\\.1|MC3R1\\.R8\\.5|MC3R1\\.R8\\.8|MC3R1\\.R8\\.10|MC3R1\\.R8\\.12|MC3R1\\.R8\\.14|MC3R1\\.R9\\.2|MC3R1\\.R9\\.4|MC3R1\\.R9\\.5|MC3R1\\.R12\\.5|MC3R1\\.R17\\.3|MC3R1\\.R17\\.4|MC3R1\\.R17\\.6|MC3R1\\.R21\\.13|MC3R1\\.R21\\.19|MC3R1\\.R21\\.21|MC3R1\\.R22\\.2|MC3R1\\.R22\\.4|MC3R1\\.R22\\.5|MC3R1\\.R22\\.6)$" } --reports+={clean:added,"service(clean_guidelines)"} + +-setq=target,getenv("XEN_TARGET_ARCH") + +if(string_equal(target,"x86_64"), + service_selector({"additional_clean_guidelines","^(MC3R1\\.D4\\.3)$"}) +) + +if(string_equal(target,"arm64"), + service_selector({"additional_clean_guidelines","^(MC3R1\\.R5\\.3|MC3R1\\.R7\\.2|MC3R1\\.R8\\.6|MC3R1\\.R9\\.3)$"}) +) + +-reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"} + -doc_end
Signature · 1 line
2.34.1
Re: [XEN PATCH 1/3] automation/eclair: update clean guidelines
Quoted 20 lines · Simone Ballarin
This patch splits the former list in two separate selectors
clean_guidelines_commonandadditional_clean_guidelines.
clean_guidelines_commoncontains the guidelines that are clean in both the analyzed builds, insteadadditional_clean_guidelinesis popolated depending on the current one.The following clean guidelines have been added:
- MC3R1.R1.1;
- MC3R1.R1.3;
- MC3R1.R3.1;
- MC3R1.R4.1;
- MC3R1.R17.4;
- MC3R1.R22.6;
- MC3R1.D4.3 (justx86_64);
- MC3R1.R5.3 (just arm64);
- MC3R1.R7.2 (just arm64);
- MC3R1.R8.6 (just arm64);
- MC3R1.R9.3 (just arm64).
Quoted 1 line
Signed-off-by Simone Ballarin <[email protected]>
Quoted 34 lines
--- automation/eclair_analysis/ECLAIR/tagging.ecl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)automation/eclair_analysis/ECLAIR/tagging.ecl +15
-2@@ -28,7 +28,20 @@ #################### -doc_begin="Clean guidelines: new violations for these guidelines are not accepted." --service_selector={clean_guidelines,"^(MC3R1\\.D1\\.1|MC3R1\\.D2\\.1|MC3R1\\.D4\\.11|MC3R1\\.D4\\.14|MC3R1\\.R1\\.4|MC3R1\\.R2\\.2|MC3R1\\.R3\\.2|MC3R1\\.R5\\.1|MC3R1\\.R5\\.2|MC3R1\\.R5\\.4|MC3R1\\.R6\\.1|MC3R1\\.R6\\.2|MC3R1\\.R7\\.1|MC3R1\\.R8\\.1|MC3R1\\.R8\\.5|MC3R1\\.R8\\.8|MC3R1\\.R8\\.10|MC3R1\\.R8\\.12|MC3R1\\.R8\\.14|MC3R1\\.R9\\.2|MC3R1\\.R9\\.4|MC3R1\\.R9\\.5|MC3R1\\.R12\\.5|MC3R1\\.R17\\.3|MC3R1\\.R17\\.6|MC3R1\\.R21\\.13|MC3R1\\.R21\\.19|MC3R1\\.R21\\.21|MC3R1\\.R22\\.2|MC3R1\\.R22\\.4|MC3R1\\.R22\\.5)$" + +-service_selector={clean_guidelines_common,"^(MC3R1\\.D1\\.1|MC3R1\\.D2\\.1|MC3R1\\.D4\\.11|MC3R1\\.D4\\.14|MC3R1\\.R1\\.1|MC3R1\\.R1\\.3|MC3R1\\.R1\\.4|MC3R1\\.R2\\.2|MC3R1\\.R3\\.1|MC3R1\\.R3\\.2|MC3R1\\.R4\\.1|MC3R1\\.R5\\.1|MC3R1\\.R5\\.2|MC3R1\\.R5\\.4|MC3R1\\.R6\\.1|MC3R1\\.R6\\.2|MC3R1\\.R7\\.1|MC3R1\\.R8\\.1|MC3R1\\.R8\\.5|MC3R1\\.R8\\.8|MC3R1\\.R8\\.10|MC3R1\\.R8\\.12|MC3R1\\.R8\\.14|MC3R1\\.R9\\.2|MC3R1\\.R9\\.4|MC3R1\\.R9\\.5|MC3R1\\.R12\\.5|MC3R1\\.R17\\.3|MC3R1\\.R17\\.4|MC3R1\\.R17\\.6|MC3R1\\.R21\\.13|MC3R1\\.R21\\.19|MC3R1\\.R21\\.21|MC3R1\\.R22\\.2|MC3R1\\.R22\\.4|MC3R1\\.R22\\.5|MC3R1\\.R22\\.6)$" } --reports+={clean:added,"service(clean_guidelines)"} + +-setq=target,getenv("XEN_TARGET_ARCH") + +if(string_equal(target,"x86_64"), + service_selector({"additional_clean_guidelines","^(MC3R1\\.D4\\.3)$"}) +) + +if(string_equal(target,"arm64"), + service_selector({"additional_clean_guidelines","^(MC3R1\\.R5\\.3|MC3R1\\.R7\\.2|MC3R1\\.R8\\.6|MC3R1\\.R9\\.3)$"}) +) + +-reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"} + -doc_endSignature · 1 line
2.34.1
PATCH 2/3 automation/eclair: add ECL deviations
In reply to Simone BallarinThis patch adds some deviations for the following guidelines:
Rule 2.1, Rule 5.3 and Rule 8.2.
--- .../eclair_analysis/ECLAIR/deviations.ecl | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-)
automation/eclair_analysis/ECLAIR/deviations.ecl +15 -19
@@ -14,8 +14,13 @@ Constant expressions and unreachable branches of if and switch statements are ex -config=MC3R1.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"} -doc_end --doc_begin="Unreachability in the following macros are expected and safe." --config=MC3R1.R2.1,statements+={safe,"macro(name(BUG||assert_failed||ERROR_EXIT||ERROR_EXIT_DOM||PIN_FAIL))"} +-doc_begin="Unreachability caused by calls to the following functions or macros is deliberate and there is no risk of code being unexpectedly left out." +-config=MC3R1.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed||ERROR_EXIT||ERROR_EXIT_DOM||PIN_FAIL))"} +-config=MC3R1.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||maybe_reboot)))"} +-doc_end + +-doc_begin="Unreachability of an ASSERT_UNREACHABLE() and analogous macro calls is deliberate and safe." +-config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"} -doc_end -doc_begin="Proving compliance with respect to Rule 2.2 is generally impossible:
@@ -93,25 +98,11 @@ conform to the directive." -doc_begin="The project adopted the rule with an exception listed in 'docs/misra/rules.rst'" -config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"} --config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max_t$))&&any_exp(macro(^min_t$))))"} +-config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"} -config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"} -config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"} --doc_end - --doc_begin="The identifier 'fdt' is a widely-used name, for which no suitable -substitute can be found. It is understood in 'xen/arch/arm/efi-boot.h' that the -static variable 'fdt' cannot be confused with parameter names of the function -declarations that are present in the file." --file_tag+={efi_boot_h, "^xen/arch/arm/efi/efi-boot\\.h$"} --config=MC3R1.R5.3,reports+={deliberate, "any_area(decl(kind(var)&&static_storage()&&^fdt$)&&any_loc(file(efi_boot_h)))"} --doc_end - --doc_begin="The identifier 'start' is a widely-used name, for which no suitable -substitute can be found. It is understood in 'xen/include/xen/kernel.h' that the -extern variable 'start' cannot be confused with omonymous parameter names of the -function declarations where that variable is visible." --file_tag+={kernel_h, "^xen/include/xen/kernel\\.h$"} --config=MC3R1.R5.3,reports+={deliberate, "any_area(decl(kind(var)&&linkage(external)&&^start$)&&any_loc(file(kernel_h)))"} +-config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"} +-config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"} -doc_end -doc_begin="Function-like macros cannot be confused with identifiers that are
@@ -179,6 +170,11 @@ const-qualified." # Series 8. # +-doc_begin="The following file is imported from Linux: ignore for now." +-file_tag+={adopted_r8_2,"^xen/common/inflate\\.c$"} +-config=MC3R1.R8.2,reports+={deliberate,"any_area(any_loc(file(adopted_r8_2)))"} +-doc_end + -doc_begin="The following variables are compiled in multiple translation units belonging to different executables and therefore are safe." -config=MC3R1.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}
Signature · 1 line
2.34.1
Re: [XEN PATCH 2/3] automation/eclair: add ECL deviations
Quoted 4 lines · Simone Ballarin
This patch adds some deviations for the following guidelines:
Rule 2.1, Rule 5.3 and Rule 8.2.Signed-off-by Simone Ballarin <[email protected]>
Looking at the below, is there anything we should add to docs/misra/rules.rst to specify that we are adopting the MISRA rule but in a slightly different way?
I am happy to make any necessary changes to docs/misra/rules.rst myself, but I would like to keep docs/misra/rules.rst consistent with deviations.ecl.
It seems to me that maybe we should add a note about ASSERT_UNREACHABLE() and BUG() and similar for Rule 2.1. What do you think? Anything else that I am missing?
Quoted 68 lines
--- .../eclair_analysis/ECLAIR/deviations.ecl | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-)automation/eclair_analysis/ECLAIR/deviations.ecl +15
-19@@ -14,8 +14,13 @@ Constant expressions and unreachable branches of if and switch statements are ex -config=MC3R1.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"} -doc_end --doc_begin="Unreachability in the following macros are expected and safe." --config=MC3R1.R2.1,statements+={safe,"macro(name(BUG||assert_failed||ERROR_EXIT||ERROR_EXIT_DOM||PIN_FAIL))"} +-doc_begin="Unreachability caused by calls to the following functions or macros is deliberate and there is no risk of code being unexpectedly left out." +-config=MC3R1.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed||ERROR_EXIT||ERROR_EXIT_DOM||PIN_FAIL))"} +-config=MC3R1.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||maybe_reboot)))"} +-doc_end + +-doc_begin="Unreachability of an ASSERT_UNREACHABLE() and analogous macro calls is deliberate and safe." +-config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"} -doc_end -doc_begin="Proving compliance with respect to Rule 2.2 is generally impossible:@@ -93,25 +98,11 @@ conform to the directive." -doc_begin="The project adopted the rule with an exception listed in 'docs/misra/rules.rst'" -config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"} --config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max_t$))&&any_exp(macro(^min_t$))))"} +-config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"} -config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"} -config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"} --doc_end - --doc_begin="The identifier 'fdt' is a widely-used name, for which no suitable -substitute can be found. It is understood in 'xen/arch/arm/efi-boot.h' that the -static variable 'fdt' cannot be confused with parameter names of the function -declarations that are present in the file." --file_tag+={efi_boot_h, "^xen/arch/arm/efi/efi-boot\\.h$"} --config=MC3R1.R5.3,reports+={deliberate, "any_area(decl(kind(var)&&static_storage()&&^fdt$)&&any_loc(file(efi_boot_h)))"} --doc_end - --doc_begin="The identifier 'start' is a widely-used name, for which no suitable -substitute can be found. It is understood in 'xen/include/xen/kernel.h' that the -extern variable 'start' cannot be confused with omonymous parameter names of the -function declarations where that variable is visible." --file_tag+={kernel_h, "^xen/include/xen/kernel\\.h$"} --config=MC3R1.R5.3,reports+={deliberate, "any_area(decl(kind(var)&&linkage(external)&&^start$)&&any_loc(file(kernel_h)))"} +-config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"} +-config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"} -doc_end -doc_begin="Function-like macros cannot be confused with identifiers that are@@ -179,6 +170,11 @@ const-qualified." # Series 8. # +-doc_begin="The following file is imported from Linux: ignore for now." +-file_tag+={adopted_r8_2,"^xen/common/inflate\\.c$"} +-config=MC3R1.R8.2,reports+={deliberate,"any_area(any_loc(file(adopted_r8_2)))"} +-doc_end + -doc_begin="The following variables are compiled in multiple translation units belonging to different executables and therefore are safe." -config=MC3R1.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}Signature · 1 line
2.34.1
PATCH 3/3 automation/eclair: update analyzed builds
In reply to Simone BallarinThe xen build for ARM64 now has new configuration options which require to be defined: this patch defines them.
In both configuration files some no longer true comments have been removed.
--- automation/eclair_analysis/xen_arm_config | 14 ++++---------- automation/eclair_analysis/xen_x86_config | 9 --------- 2 files changed, 4 insertions(+), 19 deletions(-)
automation/eclair_analysis/xen_arm_config +4 -10
@@ -1,12 +1,3 @@ -# File provided in -# Re: Xen MISRA C: Source files in scope and out of scope -# from: Stefano Stabellini <[email protected]> -# date: 6 giu 2023, 02:53 - -# -# Automatically generated file; DO NOT EDIT. -# Xen/arm 4.18-unstable Configuration -# CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=90400 CONFIG_CLANG_VERSION=0
@@ -34,7 +25,9 @@ CONFIG_HVM=y CONFIG_SBSA_VUART_CONSOLE=y CONFIG_ARM_SSBD=y CONFIG_HARDEN_BRANCH_PREDICTOR=y -# CONFIG_TEE is not set +CONFIG_TEE=n +CONFIG_OPTEE=n +CONFIG_FFA=n # CONFIG_STATIC_SHM is not set # end of Architecture Features
@@ -47,6 +40,7 @@ CONFIG_ARM64_ERRATUM_819472=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_ERRATUM_832075=y CONFIG_ARM64_ERRATUM_834220=y +CONFIG_ARM64_ERRATUM_1508412=y CONFIG_ARM_ERRATUM_858921=y CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y CONFIG_ARM64_ERRATUM_1286807=y
automation/eclair_analysis/xen_x86_config +0 -9
@@ -1,12 +1,3 @@ -# File provided in -# Re: Xen MISRA C: Source files in scope and out of scope -# from: Stefano Stabellini <[email protected]> -# date: 6 giu 2023, 02:53 - -# -# Automatically generated file; DO NOT EDIT. -# Xen/x86 4.18-unstable Configuration -# CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=90400 CONFIG_CLANG_VERSION=0
Signature · 1 line
2.34.1
Re: [XEN PATCH 3/3] automation/eclair: update analyzed builds
Quoted 6 lines · Simone Ballarin
The xen build for ARM64 now has new configuration options which require to be defined: this patch defines them.
In both configuration files some no longer true comments have been removed.
Signed-off-by Simone Ballarin <[email protected]>
(By the way, there is a way to start a Xen default kconfig from a seed config so that we don't necessarely need to specify all the options. The missing options are filled with default values.)
Quoted 61 lines
--- automation/eclair_analysis/xen_arm_config | 14 ++++---------- automation/eclair_analysis/xen_x86_config | 9 --------- 2 files changed, 4 insertions(+), 19 deletions(-)automation/eclair_analysis/xen_arm_config +4
-10@@ -1,12 +1,3 @@ -# File provided in -# Re: Xen MISRA C: Source files in scope and out of scope -# from: Stefano Stabellini <[email protected]> -# date: 6 giu 2023, 02:53 - -# -# Automatically generated file; DO NOT EDIT. -# Xen/arm 4.18-unstable Configuration -# CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=90400 CONFIG_CLANG_VERSION=0@@ -34,7 +25,9 @@ CONFIG_HVM=y CONFIG_SBSA_VUART_CONSOLE=y CONFIG_ARM_SSBD=y CONFIG_HARDEN_BRANCH_PREDICTOR=y -# CONFIG_TEE is not set +CONFIG_TEE=n +CONFIG_OPTEE=n +CONFIG_FFA=n # CONFIG_STATIC_SHM is not set # end of Architecture Features@@ -47,6 +40,7 @@ CONFIG_ARM64_ERRATUM_819472=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_ERRATUM_832075=y CONFIG_ARM64_ERRATUM_834220=y +CONFIG_ARM64_ERRATUM_1508412=y CONFIG_ARM_ERRATUM_858921=y CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y CONFIG_ARM64_ERRATUM_1286807=yautomation/eclair_analysis/xen_x86_config +0
-9@@ -1,12 +1,3 @@ -# File provided in -# Re: Xen MISRA C: Source files in scope and out of scope -# from: Stefano Stabellini <[email protected]> -# date: 6 giu 2023, 02:53 - -# -# Automatically generated file; DO NOT EDIT. -# Xen/x86 4.18-unstable Configuration -# CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=90400 CONFIG_CLANG_VERSION=0Signature · 1 line
2.34.1