Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-775): [#def1]
crun-1.20/src/libcrun/cgroup-utils.c:968:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(path_to_cgroup, 2818048)'
crun-1.20/src/libcrun/cgroup-utils.c:944:1: enter_function: entry to 'libcrun_get_cgroup_dirfd'
crun-1.20/src/libcrun/cgroup-utils.c:952:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/cgroup-utils.c:955:6: branch_false: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:955:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/cgroup-utils.c:958:6: branch_false: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:958:6: branch_false: following 'false' branch (when 'status' is non-NULL)...
crun-1.20/src/libcrun/cgroup-utils.c:961:24: branch_false: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:965:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/cgroup-utils.c:968:17: branch_false: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:968:17: acquire_resource: opened here
crun-1.20/src/libcrun/cgroup-utils.c:968:17: danger: 'open(path_to_cgroup, 2818048)' leaks here; was opened at [(13)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/12)
#  966|       return ret;
#  967|   
#  968|->   cgroupdirfd = open (path_to_cgroup, O_CLOEXEC | O_NOFOLLOW | O_DIRECTORY | O_PATH);
#  969|     if (UNLIKELY (cgroupdirfd < 0))
#  970|       return crun_make_error (err, errno, "open `%s`", path_to_cgroup);

Error: GCC_ANALYZER_WARNING (CWE-1341): [#def2]
crun-1.20/src/libcrun/container.c:3748:3: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'pipefd1'
crun-1.20/src/libcrun/container.c:3559:1: enter_function: entry to 'libcrun_container_exec_with_options'
crun-1.20/src/libcrun/container.c:3588:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3591:9: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3592:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3596:9: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3597:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3600:9: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3601:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3604:15: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3604:15: call_function: calling 'libcrun_container_load_from_file' from 'libcrun_container_exec_with_options'
crun-1.20/src/libcrun/container.c:3604:15: return_function: returning to 'libcrun_container_exec_with_options' from 'libcrun_container_load_from_file'
crun-1.20/src/libcrun/container.c:3605:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3608:3: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3610:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3616:21: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3619:8: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3614:57: call_function: inlined call to 'cgroup_status_freep' from 'libcrun_container_exec_with_options'
crun-1.20/src/libcrun/container.c:3623:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3626:9: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3631:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3634:9: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3635:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3638:3: call_function: inlined call to 'libcrun_seccomp_gen_ctx_init' from 'libcrun_container_exec_with_options'
crun-1.20/src/libcrun/container.c:3641:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3644:7: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3653:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3656:7: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3656:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3693:9: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3694:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3697:9: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3698:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3700:13: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3721:9: call_function: calling 'initialize_security' from 'libcrun_container_exec_with_options'
crun-1.20/src/libcrun/container.c:3721:9: return_function: returning to 'libcrun_container_exec_with_options' from 'initialize_security'
crun-1.20/src/libcrun/container.c:3722:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3725:9: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3726:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3730:40: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3731:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/container.c:3735:6: branch_false: ...to here
crun-1.20/src/libcrun/container.c:3735:6: branch_false: following 'false' branch...
 branch_false: ...to here
crun-1.20/src/libcrun/container.c:3748:3: release_resource: first 'close' here
crun-1.20/src/libcrun/container.c:3748:3: branch_true: following 'true' branch...
crun-1.20/src/libcrun/container.c:3748:3: danger: second 'close' here; first 'close' was at [(66)](sarif:/runs/0/results/32/codeFlows/0/threadFlows/0/locations/65)
# 3746|       }
# 3747|   
# 3748|->   TEMP_FAILURE_RETRY (close (pipefd1));
# 3749|     pipefd1 = -1;
# 3750|   

Error: GCC_ANALYZER_WARNING (CWE-457): [#def3]
crun-1.20/src/libcrun/error.c:308:5: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'priority'
 branch_false: following 'false' branch...
crun-1.20/src/libcrun/error.c:307:6: branch_false: ...to here
crun-1.20/src/libcrun/error.c:307:6: branch_true: following 'true' branch (when 'errno_ == 0')...
crun-1.20/src/libcrun/error.c:308:5: branch_true: ...to here
crun-1.20/src/libcrun/error.c:308:5: danger: use of uninitialized value 'priority' here
#  306|       }
#  307|     if (errno_ == 0)
#  308|->     syslog (priority, "%s", msg);
#  309|     else
#  310|       syslog (priority, "%s: %s", msg, strerror (errno_));

Error: GCC_ANALYZER_WARNING (CWE-457): [#def4]
crun-1.20/src/libcrun/error.c:310:5: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'priority'
 branch_false: following 'false' branch...
crun-1.20/src/libcrun/error.c:307:6: branch_false: ...to here
crun-1.20/src/libcrun/error.c:307:6: branch_false: following 'false' branch (when 'errno_ != 0')...
crun-1.20/src/libcrun/error.c:310:5: branch_false: ...to here
crun-1.20/src/libcrun/error.c:310:5: danger: use of uninitialized value 'priority' here
#  308|       syslog (priority, "%s", msg);
#  309|     else
#  310|->     syslog (priority, "%s: %s", msg, strerror (errno_));
#  311|   }
#  312|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
crun-1.20/src/libcrun/utils.h:65:7: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(controllers_len + 1)'
crun-1.20/src/libcrun/cgroup-utils.c:758:1: enter_function: entry to 'write_controller_file'
crun-1.20/src/libcrun/cgroup-utils.c:773:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/cgroup-utils.c:775:9: branch_false: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:776:6: branch_true: following 'true' branch...
crun-1.20/src/libcrun/cgroup-utils.c:778:45: branch_true: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:778:45: call_function: calling 'xmalloc' from 'write_controller_file'
crun-1.20/src/libcrun/cgroup-utils.c:778:45: return_function: returning to 'write_controller_file' from 'xmalloc'
crun-1.20/src/libcrun/utils.h:65:7: danger: 'xmalloc(controllers_len + 1)' leaks here; was allocated at [(8)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/7)
#   63|   {
#   64|     void *res = malloc (size);
#   65|->   if (UNLIKELY (res == NULL))
#   66|       OOM ();
#   67|     return res;

Error: GCC_ANALYZER_WARNING (CWE-415): [#def6]
crun-1.20/src/libcrun/utils.h:92:3: warning[-Wanalyzer-double-free]: double-'free' of '*(void **)&cgroup_path_type'
crun-1.20/src/libcrun/cgroup-utils.c:873:1: enter_function: entry to 'enable_controllers'
crun-1.20/src/libcrun/cgroup-utils.c:881:9: call_function: calling 'read_available_controllers' from 'enable_controllers'
crun-1.20/src/libcrun/cgroup-utils.c:881:9: return_function: returning to 'enable_controllers' from 'read_available_controllers'
crun-1.20/src/libcrun/cgroup-utils.c:882:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/cgroup-utils.c:888:9: branch_false: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:888:9: call_function: calling 'write_controller_file' from 'enable_controllers'
crun-1.20/src/libcrun/cgroup-utils.c:888:9: return_function: returning to 'enable_controllers' from 'write_controller_file'
crun-1.20/src/libcrun/cgroup-utils.c:889:6: branch_true: following 'true' branch...
crun-1.20/src/libcrun/cgroup-utils.c:892:11: branch_true: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:892:10: branch_true: following 'true' branch...
crun-1.20/src/libcrun/cgroup-utils.c:896:17: call_function: calling 'write_controller_file' from 'enable_controllers'
#   90|   {
#   91|     void **pp = (void **) p;
#   92|->   free (*pp);
#   93|   }
#   94|   

Error: GCC_ANALYZER_WARNING (CWE-415): [#def7]
crun-1.20/src/libcrun/utils.h:92:3: warning[-Wanalyzer-double-free]: double-'free' of '*(void **)&content'
crun-1.20/src/libcrun/cgroup-utils.c:873:1: enter_function: entry to 'enable_controllers'
crun-1.20/src/libcrun/cgroup-utils.c:881:9: call_function: calling 'read_available_controllers' from 'enable_controllers'
crun-1.20/src/libcrun/cgroup-utils.c:881:9: return_function: returning to 'enable_controllers' from 'read_available_controllers'
crun-1.20/src/libcrun/cgroup-utils.c:882:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/cgroup-utils.c:888:9: branch_false: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:888:9: call_function: calling 'write_controller_file' from 'enable_controllers'
crun-1.20/src/libcrun/cgroup-utils.c:888:9: return_function: returning to 'enable_controllers' from 'write_controller_file'
crun-1.20/src/libcrun/cgroup-utils.c:889:6: branch_true: following 'true' branch...
crun-1.20/src/libcrun/cgroup-utils.c:892:11: branch_true: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:892:10: branch_true: following 'true' branch...
crun-1.20/src/libcrun/cgroup-utils.c:896:17: call_function: calling 'write_controller_file' from 'enable_controllers'
#   90|   {
#   91|     void **pp = (void **) p;
#   92|->   free (*pp);
#   93|   }
#   94|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
crun-1.20/src/libcrun/utils.h:225:6: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(t)'
crun-1.20/src/libcrun/cgroup-utils.c:758:1: enter_function: entry to 'write_controller_file'
crun-1.20/src/libcrun/cgroup-utils.c:773:6: branch_false: following 'false' branch...
crun-1.20/src/libcrun/cgroup-utils.c:775:9: branch_false: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:776:6: branch_true: following 'true' branch...
crun-1.20/src/libcrun/cgroup-utils.c:778:45: branch_true: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:778:45: call_function: calling 'xmalloc' from 'write_controller_file'
crun-1.20/src/libcrun/cgroup-utils.c:778:45: return_function: returning to 'write_controller_file' from 'xmalloc'
crun-1.20/src/libcrun/cgroup-utils.c:807:10: branch_true: following 'true' branch...
crun-1.20/src/libcrun/cgroup-utils.c:809:17: branch_true: ...to here
crun-1.20/src/libcrun/cgroup-utils.c:809:17: call_function: calling 'maybe_make_cgroup_threaded' from 'write_controller_file'
#  223|   
#  224|     ret = strdup (str);
#  225|->   if (ret == NULL)
#  226|       OOM ();
#  227|   

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.86.0
diffbase-analyzer-version-cppcheck2.17.1
diffbase-analyzer-version-gcc15.0.1
diffbase-analyzer-version-gcc-analyzer15.0.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-199.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namecrun-1.21-1.fc43
diffbase-store-results-to/tmp/tmpm9xjdw6e/crun-1.21-1.fc43.tar.xz
diffbase-time-created2025-04-25 12:18:09
diffbase-time-finished2025-04-25 12:20:55
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpm9xjdw6e/crun-1.21-1.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpm9xjdw6e/crun-1.21-1.fc43.src.rpm'
diffbase-tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-199.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namecrun-1.20-2.fc42
store-results-to/tmp/tmp70cigg6s/crun-1.20-2.fc42.tar.xz
time-created2025-04-25 12:14:23
time-finished2025-04-25 12:17:40
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmp70cigg6s/crun-1.20-2.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp70cigg6s/crun-1.20-2.fc42.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9