Task #51898 - added.err

back to task #51898
download
Error: GCC_ANALYZER_WARNING (CWE-401):
crun-1.21/src/libcrun/cgroup-utils.c:308:13: warning[-Wanalyzer-malloc-leak]: leak of 'fdopendir(dfd)'
crun-1.21/src/libcrun/cgroup-utils.c:992:1: enter_function: entry to 'libcrun_migrate_all_pids_to_cgroup'
crun-1.21/src/libcrun/cgroup-utils.c:1002:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: branch_false: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: call_function: calling 'libcrun_cgroup_pause_unpause_path' from 'libcrun_migrate_all_pids_to_cgroup'
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: return_function: returning to 'libcrun_migrate_all_pids_to_cgroup' from 'libcrun_cgroup_pause_unpause_path'
crun-1.21/src/libcrun/cgroup-utils.c:1006:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1009:9: branch_false: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1009:9: call_function: calling 'libcrun_cgroup_read_pids_from_path' from 'libcrun_migrate_all_pids_to_cgroup'
#  306|         struct dirent *de;
#  307|   
#  308|->       dir = fdopendir (dfd);
#  309|         if (UNLIKELY (dir == NULL))
#  310|           return crun_make_error (err, errno, "open cgroup sub-directory");

Error: GCC_ANALYZER_WARNING (CWE-775):
crun-1.21/src/libcrun/cgroup-utils.c:444:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(cgroup_path, 589824)'
crun-1.21/src/libcrun/cgroup-utils.c:992:1: enter_function: entry to 'libcrun_migrate_all_pids_to_cgroup'
crun-1.21/src/libcrun/cgroup-utils.c:1002:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: branch_false: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: call_function: calling 'libcrun_cgroup_pause_unpause_path' from 'libcrun_migrate_all_pids_to_cgroup'
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: return_function: returning to 'libcrun_migrate_all_pids_to_cgroup' from 'libcrun_cgroup_pause_unpause_path'
crun-1.21/src/libcrun/cgroup-utils.c:1006:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1009:9: branch_false: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1009:9: call_function: calling 'libcrun_cgroup_read_pids_from_path' from 'libcrun_migrate_all_pids_to_cgroup'
#  442|       }
#  443|   
#  444|->   dirfd = open (cgroup_path, O_DIRECTORY | O_CLOEXEC);
#  445|     if (dirfd < 0)
#  446|       return crun_make_error (err, errno, "open `%s`", cgroup_path);

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-1.21/src/libcrun/utils.h:83:7: warning[-Wanalyzer-malloc-leak]: leak of 'xrealloc(*pids, (*n_pids + n_new_pids + 1) * 4)'
crun-1.21/src/libcrun/cgroup-utils.c:992:1: enter_function: entry to 'libcrun_migrate_all_pids_to_cgroup'
crun-1.21/src/libcrun/cgroup-utils.c:1002:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: branch_false: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: call_function: calling 'libcrun_cgroup_pause_unpause_path' from 'libcrun_migrate_all_pids_to_cgroup'
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: return_function: returning to 'libcrun_migrate_all_pids_to_cgroup' from 'libcrun_cgroup_pause_unpause_path'
crun-1.21/src/libcrun/cgroup-utils.c:1006:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1009:9: branch_false: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1009:9: call_function: calling 'libcrun_cgroup_read_pids_from_path' from 'libcrun_migrate_all_pids_to_cgroup'
#   81|   {
#   82|     void *res = realloc (ptr, size);
#   83|->   if (UNLIKELY (res == NULL))
#   84|       OOM ();
#   85|     return res;

Error: GCC_ANALYZER_WARNING (CWE-1341):
crun-1.21/src/libcrun/utils.h:108:5: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'tasksfd'
crun-1.21/src/libcrun/cgroup-utils.c:992:1: enter_function: entry to 'libcrun_migrate_all_pids_to_cgroup'
crun-1.21/src/libcrun/cgroup-utils.c:1002:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: branch_false: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: call_function: calling 'libcrun_cgroup_pause_unpause_path' from 'libcrun_migrate_all_pids_to_cgroup'
crun-1.21/src/libcrun/cgroup-utils.c:1005:9: return_function: returning to 'libcrun_migrate_all_pids_to_cgroup' from 'libcrun_cgroup_pause_unpause_path'
crun-1.21/src/libcrun/cgroup-utils.c:1006:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1009:9: branch_false: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1009:9: call_function: calling 'libcrun_cgroup_read_pids_from_path' from 'libcrun_migrate_all_pids_to_cgroup'
#  106|     int *pp = (int *) p;
#  107|     if (*pp >= 0)
#  108|->     TEMP_FAILURE_RETRY (close (*pp));
#  109|   }
#  110|   

Error: GCC_ANALYZER_WARNING (CWE-1341):
crun-1.21/src/libcrun/utils.h:210:13: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor '*fd'
crun-1.21/src/libcrun/container.c:4272:1: enter_function: entry to 'restore_proxy_process'
crun-1.21/src/libcrun/container.c:4282:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:4285:3: branch_false: ...to here
crun-1.21/src/libcrun/container.c:4285:3: call_function: calling 'close_and_reset' from 'restore_proxy_process'
#  208|     if (*fd >= 0)
#  209|       {
#  210|->       ret = TEMP_FAILURE_RETRY (close (*fd));
#  211|         if (LIKELY (ret == 0))
#  212|           *fd = -1;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-1.21/src/libcrun/utils.h:225:6: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(*process_199(D)->args)'
crun-1.21/src/libcrun/container.c:3374:1: enter_function: entry to 'exec_process_entrypoint'
crun-1.21/src/libcrun/container.c:3407:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:3410:9: branch_false: ...to here
crun-1.21/src/libcrun/container.c:3411:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:3414:7: branch_false: ...to here
crun-1.21/src/libcrun/container.c:3443:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:3446:9: branch_false: ...to here
crun-1.21/src/libcrun/container.c:3447:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:3450:7: branch_false: ...to here
crun-1.21/src/libcrun/container.c:3450:6: branch_true: following 'true' branch...
crun-1.21/src/libcrun/container.c:3477:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:3480:9: branch_false: ...to here
crun-1.21/src/libcrun/container.c:3502:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:3505:9: branch_false: ...to here
crun-1.21/src/libcrun/container.c:3505:9: call_function: calling 'maybe_chown_std_streams' from 'exec_process_entrypoint'
crun-1.21/src/libcrun/container.c:3505:9: return_function: returning to 'exec_process_entrypoint' from 'maybe_chown_std_streams'
crun-1.21/src/libcrun/container.c:3506:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:3509:7: branch_false: ...to here
crun-1.21/src/libcrun/container.c:3515:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:3518:7: branch_false: ...to here
crun-1.21/src/libcrun/container.c:3518:6: branch_true: following 'true' branch...
crun-1.21/src/libcrun/container.c:3520:60: branch_true: ...to here
crun-1.21/src/libcrun/container.c:3521:10: branch_true: following 'true' branch...
crun-1.21/src/libcrun/container.c:3523:14: branch_true: ...to here
crun-1.21/src/libcrun/container.c:3523:14: branch_false: following 'false' branch (when 'custom_handler' is non-NULL)...
crun-1.21/src/libcrun/container.c:3523:58: branch_false: ...to here
crun-1.21/src/libcrun/container.c:3528:23: call_function: calling 'xstrdup' from 'exec_process_entrypoint'
crun-1.21/src/libcrun/container.c:3528:23: return_function: returning to 'exec_process_entrypoint' from 'xstrdup'
crun-1.21/src/libcrun/utils.h:225:6: danger: 'xstrdup(*process_199(D)->args)' leaks here; was allocated at [(41)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/40)
#  223|   
#  224|     ret = strdup (str);
#  225|->   if (ret == NULL)
#  226|       OOM ();
#  227|   

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-1.21/src/libcrun/utils.h:225:6: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(cgroup_path + 14)'
crun-1.21/src/libcrun/cgroup-utils.c:1044:1: enter_function: entry to 'get_cgroup_dirfd_path'
crun-1.21/src/libcrun/cgroup-utils.c:1050:3: call_function: inlined call to 'get_proc_self_fd_path' from 'get_cgroup_dirfd_path'
crun-1.21/src/libcrun/cgroup-utils.c:1050:3: call_function: inlined call to 'get_proc_self_fd_path' from 'get_cgroup_dirfd_path'
crun-1.21/src/libcrun/cgroup-utils.c:1053:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1056:7: branch_false: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1056:6: branch_true: following 'true' branch...
crun-1.21/src/libcrun/cgroup-utils.c:1058:24: branch_true: ...to here
crun-1.21/src/libcrun/cgroup-utils.c:1058:15: call_function: calling 'xstrdup' from 'get_cgroup_dirfd_path'
crun-1.21/src/libcrun/cgroup-utils.c:1058:15: return_function: returning to 'get_cgroup_dirfd_path' from 'xstrdup'
crun-1.21/src/libcrun/utils.h:225:6: danger: 'xstrdup(cgroup_path + 14)' leaks here; was allocated at [(19)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/18)
#  223|   
#  224|     ret = strdup (str);
#  225|->   if (ret == NULL)
#  226|       OOM ();
#  227|   

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-1.21/src/libcrun/utils.h:225:6: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(own_cgroup)'
crun-1.21/src/libcrun/container.c:4272:1: enter_function: entry to 'restore_proxy_process'
crun-1.21/src/libcrun/container.c:4282:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:4285:3: branch_false: ...to here
crun-1.21/src/libcrun/container.c:4299:6: branch_false: following 'false' branch...
crun-1.21/src/libcrun/container.c:4302:21: branch_false: ...to here
crun-1.21/src/libcrun/container.c:4302:21: call_function: calling 'xstrdup' from 'restore_proxy_process'
crun-1.21/src/libcrun/container.c:4302:21: return_function: returning to 'restore_proxy_process' from 'xstrdup'
crun-1.21/src/libcrun/utils.h:225:6: danger: 'xstrdup(own_cgroup)' leaks here; was allocated at [(10)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/9)
#  223|   
#  224|     ret = strdup (str);
#  225|->   if (ret == NULL)
#  226|       OOM ();
#  227|