[debug] show dump.log on criu_dump error#2030
[debug] show dump.log on criu_dump error#2030kolyshkin wants to merge 1 commit intocontainers:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the debugging process for CRIU checkpointing failures by automatically printing critical error information from the CRIU log file directly to the console upon an unsuccessful dump. This enhancement provides immediate diagnostic feedback, streamlining the identification and resolution of issues, especially those encountered on CentOS Stream 9. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a debugging feature to show the CRIU log on dump errors. However, the implementation uses system() with a potentially user-controlled path, which introduces a critical command injection vulnerability. My review includes a suggestion to replace this with a safer fork() and execvp() pattern to mitigate the security risk.
src/libcrun/criu.c
Outdated
| cleanup_free char *cmd = NULL; | ||
| xasprintf(&cmd, "grep -n -B5 Error %s/%s", cr_options->work_path, CRIU_CHECKPOINT_LOG_FILE); | ||
| system(cmd); |
There was a problem hiding this comment.
Using system() with a command string constructed from cr_options->work_path introduces a command injection vulnerability. If work_path contains shell metacharacters, it could lead to arbitrary command execution. It is much safer to use fork() and execvp() to avoid invoking a shell.
pid_t pid = fork();
if (pid == 0) {
cleanup_free char *path = NULL;
xasprintf(&path, "%s/%s", cr_options->work_path, CRIU_CHECKPOINT_LOG_FILE);
char *const args[] = {"grep", "-n", "-B5", "Error", path, NULL};
execvp(args[0], args);
_exit(127);
}
if (pid > 0) {
waitpid(pid, NULL, 0);
}|
Ephemeral COPR build failed. @containers/packit-build please check. |
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
3c8e457 to
119f93e
Compare
This is to debug CentOS Stream 9 C/R failures.