Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmake/sca/eclair/ECL/adopted_code.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-doc_begin="This header file is automatically generated by Autoconf."
-file_tag+={adopted,"^zephyr/build/zephyr/include/generated/autoconf\\.h$"}
-doc_end

-doc_begin="These files are automatically generated by gperf."
-file_tag+={adopted,"^zephyr/build/zephyr/kobject_.*\\.c$"}
-doc_end
43 changes: 43 additions & 0 deletions cmake/sca/eclair/ECL/adopted_deviations.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-setq=CPP_MANUAL,"https://gcc.gnu.org/onlinedocs/gcc-10.3.0/cpp.pdf"

-doc="Selection for reports that are fully contained in adopted code."
-report_selector+={adopted_report,"all_area(!kind(culprit||evidence)||all_loc(all_exp(adopted||pseudo)))"}

-doc_begin="Adopted code is not meant to be read, reviewed or modified by human programmers:no developers' confusion is not possible. In addition, adopted code is assumed to work as is. Reports that are fully contained in adopted code are hidden/tagged with the 'adopted' tag."
-config=MC3R1.R7.2,reports+={relied,adopted_report}
-config=MC3R1.R10.3,reports+={relied,adopted_report}
-config=MC3R1.R10.6,reports+={relied,adopted_report}
-config=MC3R1.R12.1,reports+={relied,adopted_report}
-doc_end

-doc_begin="Macro LOAPIC_BASE_ADDRESS, automatically generated by Autoconf, expands to an implicitly unsigned literal lacking the 'u' or 'U' suffix."
-config=MC3R1.R7.2,reports+={safe,"all_area(all_loc(any_exp(macro(^assert$))))"}
-doc_end

-doc="#include_next is a documented GNU preprocessing directive. See section \"2.7 Wrapper Headers\" of "CPP_MANUAL""
-config=STD.prepdirc,directives+={safe,"^include_next$"}
-doc="#warning is a documented GNU preprocessing directive. See section \"5 Diagnostics\" of "CPP_MANUAL""
-config=STD.prepdirc,directives+={safe,"^warning$"}

-doc="The declarations in files tagged with api:public define a public API of Zephyr.
Declarations in these files not necessarily have to be referenced."
-config=MC3R1.R2.3,declarations+={safe,"loc(top(public()))"}

-doc="Library entry points not necessarily have to be referenced."
-config=MC3R1.R2.1,declarations+={safe,"loc(top(public()))"}

-doc="Library entry points not necessarily have to be referenced in more than one translation units."
-config=MC3R1.R8.7,declarations+={safe,"loc(top(public()))"}

-doc="Syscall declarations are automatically generated all with the extern qualifier. For the ones with internal linkage the use of the extern qualifier is a violation of rule 8.8."
-config=MC3R1.R8.8,declarations={relied, "^z_vrfy_.*$||^z_impl_.*$"}

-doc="Function hash, that is automatically generated, does not use the parameter \"len\" in all its definitions."
-config=MC3R1.R2.7,declarations+={relied,"context(^hash\\(const char\\*, size_t\\)$)&&name(len)"}

-doc="Function \"z_object_lookup\", that is automatically generated, uses single-statement bodies not enclosed in braces."
-config=MC3R1.R15.6,reports={relied, "all_area(context(^z_object_lookup\\(const char\\*, size_t\\)$))"}

-doc="The following declarations are in generated files: not in all configuration they are implemented.
Chainging the generators could be dangerous and the advantages in enforcing the rule do not outweight these dangers."
-config=MC3R1.R8.6,declarations+={safe, "loc(top(file(^zephyr/build/zephyr/include/generated/.*$)))"}
11 changes: 11 additions & 0 deletions cmake/sca/eclair/ECL/analysis.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-setq=data_dir,getenv("ECLAIR_DATA_DIR")
-setq=set,getenv("ECLAIR_RULESET")

-enable=B.REPORT.ECB
-config=B.REPORT.ECB,output=join_paths(data_dir,"FRAME.@[email protected]")
-config=B.REPORT.ECB,preprocessed=show
-config=B.REPORT.ECB,macros=10

-enable=B.EXPLAIN

-eval_file=toolchain.ecl
21 changes: 21 additions & 0 deletions cmake/sca/eclair/ECL/analysis_HIS.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file must be named analyze_<RULESET>.ecl, where <RULESET> is the first
# argument of analyze.sh.
#
# The aim of this file is to define the analysis configuration for <RULESET>.
#
# The essential portions of this file are marked with "# NEEDED":
# they may be adapted of course.

# Enable the desired metrics.
-enable=MET.HIS.COMF
-enable=MET.HIS.PATH
-enable=MET.HIS.GOTO
-enable=MET.HIS.v_G
-enable=MET.HIS.CALLING
-enable=MET.HIS.CALLS
-enable=MET.HIS.PARAM
-enable=MET.HIS.STMT
-enable=MET.HIS.LEVEL
-enable=MET.HIS.RETURN
-enable=MET.HIS.VOCF
-enable=MET.HIS.ap_cg_cycle
115 changes: 115 additions & 0 deletions cmake/sca/eclair/ECL/analysis_STU.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# This file must be named analyze_<RULESET>.ecl, where <RULESET> is the first
# argument of analyze.sh.
#
# The aim of this file is to define the analysis configuration for <RULESET>.
#
# The essential portions of this file are marked with "# NEEDED":
# they may be adapted of course.

-eval_file=zephyr_common_config.ecl

-doc_begin="Selection of guidelines from
https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html"
-enable=MC3R1.D4.13
-enable=MC3R1.D4.2
-enable=MC3R1.D4.4
-enable=MC3R1.D4.5
-enable=MC3R1.D4.8
-enable=MC3R1.D4.11
-enable=MC3R1.D4.12
-enable=MC3R1.D4.14
-enable=MC3R1.D4.7
-enable=MC3R1.R10.5
-enable=MC3R1.R10.2
-enable=MC3R1.R10.6
-enable=MC3R1.R10.7
-enable=MC3R1.R10.8
-enable=MC3R1.R1.2
-enable=MC3R1.R1.3
-enable=MC3R1.R12.4
-enable=MC3R1.R12.5
-enable=MC3R1.R12.2
-enable=MC3R1.R13.4
-enable=MC3R1.R13.1
-enable=MC3R1.R13.2
-enable=MC3R1.R13.5
-enable=MC3R1.R13.6
-enable=MC3R1.R18.5
-enable=MC3R1.R18.1
-enable=MC3R1.R18.2
-enable=MC3R1.R18.3
-enable=MC3R1.R18.6
-enable=MC3R1.R18.8
-enable=MC3R1.R21.11
-enable=MC3R1.R21.13
-enable=MC3R1.R21.17
-enable=MC3R1.R21.18
-enable=MC3R1.R21.19
-enable=MC3R1.R21.20
-enable=MC3R1.R2.7
-enable=MC3R1.R2.2
-enable=MC3R1.R4.2
-enable=MC3R1.R4.1
-enable=MC3R1.R17.3
-enable=MC3R1.R17.4
-enable=MC3R1.R17.6
-enable=MC3R1.R17.1
-enable=MC3R1.R17.5
-enable=MC3R1.R19.1
-enable=MC3R1.R22.2
-enable=MC3R1.R22.5
-enable=MC3R1.R22.6
-enable=MC3R1.R9.1
-enable=MC3R1.R9.2
-enable=MC3R1.R9.3
-enable=MC3R1.R9.4
-enable=MC3R1.R9.5
-enable=MC3R1.D2.1
-enable=MC3R1.R11.2
-enable=MC3R1.R11.6
-enable=MC3R1.R11.7
-enable=MC3R1.R11.8
-enable=MC3R1.R11.9
-enable=MC3R1.R14.1
-enable=MC3R1.R14.2
-enable=MC3R1.R14.3
-enable=MC3R1.R15.2
-enable=MC3R1.R15.3
-enable=MC3R1.R15.6
-enable=MC3R1.R15.7
-enable=MC3R1.R16.1
-enable=MC3R1.R16.2
-enable=MC3R1.R16.3
-enable=MC3R1.R16.4
-enable=MC3R1.R16.5
-enable=MC3R1.R16.6
-enable=MC3R1.R16.7
-enable=MC3R1.R20.11
-enable=MC3R1.R20.12
-enable=MC3R1.R20.13
-enable=MC3R1.R20.14
-enable=MC3R1.R20.2
-enable=MC3R1.R20.3
-enable=MC3R1.R20.4
-enable=MC3R1.R20.8
-enable=MC3R1.R20.9
-enable=MC3R1.R3.1
-enable=MC3R1.R3.2
-enable=MC3R1.R5.2
-enable=MC3R1.R5.3
-enable=MC3R1.R5.4
-enable=MC3R1.R5.5
-enable=MC3R1.R6.1
-enable=MC3R1.R6.2
-enable=MC3R1.R7.1
-enable=MC3R1.R7.2
-enable=MC3R1.R7.3
-enable=MC3R1.R7.4
-enable=MC3R1.R8.1
-enable=MC3R1.R8.10
-enable=MC3R1.R8.12
-enable=MC3R1.R8.14
-enable=MC3R1.R8.2
-enable=MC3R1.R8.4
-enable=MC3R1.R8.8
-doc_end
32 changes: 32 additions & 0 deletions cmake/sca/eclair/ECL/analysis_WP.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file must be named analyze_<RULESET>.ecl, where <RULESET> is the first
# argument of analyze.sh.
#
# The aim of this file is to define the analysis configuration for <RULESET>.
#
# The essential portions of this file are marked with "# NEEDED":
# they may be adapted of course.

-eval_file=zephyr_common_config.ecl

-doc_begin="Selection of guidelines from
https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html"
-enable=MC3R1.R2.3
-enable=MC3R1.R2.1
-enable=MC3R1.R5.9
-enable=MC3R1.R5.1
-enable=MC3R1.R5.6
-enable=MC3R1.R5.7
-enable=MC3R1.R5.8
-enable=MC3R1.R8.9
-enable=MC3R1.R8.3
-enable=MC3R1.R8.5
-enable=MC3R1.R8.6
-enable=MC3R1.R22.4
-enable=MC3R1.R22.3
-enable=MC3R1.D1.1
-enable=MC3R1.D3.1
-enable=MC3R1.D4.1
-enable=MC3R1.D4.10
-enable=MC3R1.R17.2
-enable=MC3R1.R17.7
-doc_end
21 changes: 21 additions & 0 deletions cmake/sca/eclair/ECL/analysis_first_analysis.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file must be named analyze_<RULESET>.ecl, where <RULESET> is the first
# argument of analyze.sh.
#
# The aim of this file is to define the analysis configuration for <RULESET>.
#
# The essential portions of this file are marked with "# NEEDED":
# they may be adapted of course.

-eval_file=zephyr_common_config.ecl

-doc_begin="Selection of guidelines from
https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html"
-enable=MC3R1.R8.2
-enable=MC3R1.R10.2
-enable=MC3R1.R10.5
-enable=MC3R1.R10.6
-enable=MC3R1.R11.2
-enable=MC3R1.R12.4
-enable=MC3R1.R13.4
-enable=MC3R1.R16.1
-doc_end
23 changes: 23 additions & 0 deletions cmake/sca/eclair/ECL/analysis_heavy_STU.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file must be named analyze_<RULESET>.ecl, where <RULESET> is the first
# argument of analyze.sh.
#
# The aim of this file is to define the analysis configuration for <RULESET>.
#
# The essential portions of this file are marked with "# NEEDED":
# they may be adapted of course.

-eval_file=zephyr_common_config.ecl

-doc_begin="Selection of guidelines from
https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html"
-enable=MC3R1.D4.6
-enable=MC3R1.D4.9
-enable=MC3R1.R12.1
-enable=MC3R1.R13.3
-enable=MC3R1.R2.6
-enable=MC3R1.R10.1
-enable=MC3R1.R10.3
-enable=MC3R1.R10.4
-enable=MC3R1.R14.4
-enable=MC3R1.R20.7
-doc_end
28 changes: 28 additions & 0 deletions cmake/sca/eclair/ECL/analysis_std_lib.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file must be named analyze_<RULESET>.ecl, where <RULESET> is the first
# argument of analyze.sh.
#
# The aim of this file is to define the analysis configuration for <RULESET>.
#
# The essential portions of this file are marked with "# NEEDED":
# they may be adapted of course.
-eval_file=zephyr_common_config.ecl

-doc_begin="Selection of guidelines from
https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html"
-enable=MC3R1.R21.1
-enable=MC3R1.R21.12
-enable=MC3R1.R21.14
-enable=MC3R1.R21.15
-enable=MC3R1.R21.16
-enable=MC3R1.R21.2
-enable=MC3R1.R21.3
-enable=MC3R1.R21.4
-enable=MC3R1.R21.6
-enable=MC3R1.R21.7
-enable=MC3R1.R21.9
-enable=MC3R1.R22.1
-enable=MC3R1.R22.10
-enable=MC3R1.R22.7
-enable=MC3R1.R22.8
-enable=MC3R1.R22.9
-doc_end
81 changes: 81 additions & 0 deletions cmake/sca/eclair/ECL/call_properties.ecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

-call_properties+={"name(z_phys_map)", {"pointee_read(1=never)","pointee_write(1=always)","taken()"}}
-call_properties+={"name(pcie_get_mbar)", {"pointee_read(3=never)","pointee_write(3=maybe)","taken()"}}
-call_properties+={"name(k_mem_region_align)", {
"pointee_read(1..2=never)",
"pointee_write(1..2=always)","taken()"
}}
-call_properties+={"name(pentry_get)", {
"pointee_read(1..2=never&&3..4=always)",
"pointee_write(1..2=maybe&&3..4=never)"
}}
-call_properties+={"name(z_phys_unmap)", {"pointee_read(1=never)","pointee_write(1=never)"}}
-call_properties+={"name(check_sum)", {"pointee_read(1=always)","pointee_write(1=never)"}}
-call_properties+={"name(z_impl_device_get_binding)", {"pointee_read(1=maybe)","pointee_write(1=maybe)","taken()"}}
-call_properties+={"name(z_setup_new_thread)", {"pointee_read(10=maybe)","pointee_write(10=never)","taken()"}}
-call_properties+={"name(mbox_message_put)", {"pointee_read(3=always)","pointee_write(3=always)"}}
-doc_begin="The functions can be implemented using the GCC built-in functions.
See Section \"6.62.13 6.56 Built-in Functions to Perform Arithmetic with Overflow Checking\" of "GCC_MANUAL"."
-call_properties+={"name(size_mul_overflow)", {"pointee_read(3=never)","pointee_write(3=always)","taken()"}}
-call_properties+={"name(size_add_overflow)", {"pointee_read(3=never)","pointee_write(3=always)","taken()"}}
-call_properties+={"name(__builtin_mul_overflow)", {"pointee_read(3=never)","pointee_write(3=always)","taken()"}}
-call_properties+={"name(__builtin_add_overflow)", {"pointee_read(3=never)","pointee_write(3=always)","taken()"}}
-doc_end

-call_properties+={"name(__builtin_va_end)", {"taken()"}} # Not documented in gcc.pdf
-call_properties+={"name(arch_page_phys_get)", {"pointee_read(2=never)","pointee_write(2=maybe)","taken()"}}
-call_properties+={"name(cbvprintf)", {"taken()"}}
-call_properties+={"name(cbvprintf)", {"taken()"}}
-call_properties+={"name(char2hex)", {"pointee_read(2=never)","pointee_write(2=maybe)"}}
-call_properties+={"name(find_and_stack)", {"pointee_read(3=never)","pointee_write(3=always)"}}
-call_properties+={"name(fix_missing_black)", {"pointee_read(1=always)","pointee_write(1=maybe)"}}
-call_properties+={"name(__get_cpuid)", {"pointee_read(2..5=never)","pointee_write(2..5=always)"}}
-call_properties+={"name(k_mutex_init)", {"pointee_read(1=never)","pointee_write(1=always)"}}
-call_properties+={"name(k_sem_init)", {"pointee_read(1=never)","pointee_write(1=maybe)"}}
-call_properties+={"name(k_work_init)", {"pointee_read(1=never)","pointee_write(1=always)"}}
-call_properties+={"name(k_work_init_delayable)", {"pointee_read(1=never)","pointee_write(1=always)"}}
-call_properties+={"name(k_work_queue_start)", {"taken()"}}
-call_properties+={"name(log_from_user)", {"pointee_write(1..=never)", "taken()"}}
-call_properties+={"name(log_n)", {"taken()"}}
-call_properties+={"name(log_string_sync)", {"pointee_write(1..=never)", "taken()"}}
-call_properties+={"name(match_region)", {"pointee_read(5..6=never)","pointee_write(5=always&&6=maybe)"}}
-call_properties+={"name(mbox_async_alloc)", {"pointee_read(1=never)","pointee_write(1=maybe)"}}
-call_properties+={"name(pipe_xfer_prepare)", {"pointee_read(2=never)","pointee_write(2=always)"}}
-call_properties+={"name(printk)", {"pointee_write(1..=never)", "taken()"}}
-call_properties+={"name(snprintk)", {"pointee_read(1=never)","pointee_write(1=always)", "taken()"}} # to check
-call_properties+={"name(snprintk)", {"taken()"}}
-call_properties+={"name(sys_bitarray_alloc)", {"pointee_read(3=never)","pointee_write(3=maybe)","taken()"}}
-call_properties+={"name(sys_slist_init)", {"pointee_read(1=never)","pointee_write(1=always)"}}
-call_properties+={"name(vprintk)", {"taken()"}}
-call_properties+={"name(z_dummy_thread_init)", {"pointee_read(1=never)","pointee_write(1=always)"}} # the function does not initialize all the fields
-call_properties+={"name(z_impl_k_stack_pop)", {"taken()"}}
-call_properties+={"name(z_impl_z_log_msg2_runtime_vcreate)", {"taken()"}}
-call_properties+={"name(z_log_minimal_printk)", {"pointee_write(1..=never)", "taken()"}}
-call_properties+={"name(z_log_msg2_runtime_create)", {"pointee_write(1..=never)", "taken()"}}
-call_properties+={"name(z_log_printk)", {"taken()"}}
-call_properties+={"name(z_log_printf_arg_checker)", {"pointee_write(1..=never)", "taken()"}}
-call_properties+={"name(z_log_strdup)", {"taken()"}}
-call_properties+={"name(z_rb_foreach_next)", {"taken()"}}
-call_properties+={"name(z_user_string_copy)", {"pointee_read(1=never)","pointee_write(1=maybe)","taken()"}}

-doc_begin="These macros are designed to evaluate to either 0 or 1."
-call_properties+={"macro(name(UTIL_NOT))",{"data_kind(0=int_bool)"}}
-call_properties+={"macro(name(IS_ENABLED))",{"data_kind(0=int_bool)"}}
-call_properties+={"decl(name(isspace))",{"data_kind(0=int_bool)"}}
-call_properties+={"macro(name(isdigit))",{"data_kind(0=int_bool)"}}
-call_properties+={"decl(name(isdigit))",{"data_kind(0=int_bool)"}}
-call_properties+={"macro(name(isalpha))",{"data_kind(0=int_bool)"}}
-call_properties+={"decl(name(isalpha))",{"data_kind(0=int_bool)"}}
-call_properties+={"macro(name(isupper))",{"data_kind(0=int_bool)"}}
-call_properties+={"decl(name(isupper))",{"data_kind(0=int_bool)"}}
-doc_end

-doc="__builtin_alloca cannot interfere with other effects."
-call_properties+={"decl(name(__builtin_alloca))",{"noeffect"}}

-doc="log_strdup cannot interfere with other effects."
-call_properties+={"decl(name(log_strdup))",{"noeffect"}}


# Not documented functions
# device_map
Loading
Loading