Task #51898 - fixed.err

back to task #51898
download
Error: GCC_ANALYZER_WARNING (CWE-775):
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):
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...
<unknown>: 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):
crun-1.20/src/libcrun/error.c:308:5: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'priority'
<unknown>: 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):
crun-1.20/src/libcrun/error.c:310:5: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'priority'
<unknown>: 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):
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):
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):
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):
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|