mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-19 09:35:12 +00:00
sk-unix: ignore coverity chroot() warning
criu/sk-unix.c:1173: chroot_call: Calling chroot: "chroot(".")".
criu/sk-unix.c:1175: chroot: Calling function "close_safe" after chroot() but before calling chdir("/").
criu/sk-unix.c:1251: chroot_call: Calling chroot: "chroot(".")".
criu/sk-unix.c:1263: chroot: Calling function "print_on_level" after chroot() but before calling chdir("/").
Coverity also says:
175312, 175313 Insecure chroot
If a call to chroot is not followed by a call to chdir("/") the chroot jail confinement can be violated.
Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
cfeb9c10ff
commit
04d7b71570
1 changed files with 2 additions and 0 deletions
|
|
@ -1170,6 +1170,7 @@ static int revert_unix_sk_cwd(struct unix_sk_info *ui, int *prev_cwd_fd, int *ro
|
|||
if (*ns_fd >= 0 && restore_ns(*ns_fd, &mnt_ns_desc))
|
||||
ret = -1;
|
||||
if (*root_fd >= 0) {
|
||||
/* coverity[chroot_call] */
|
||||
if (fchdir(*root_fd) || chroot("."))
|
||||
pr_perror("Can't revert root directory");
|
||||
close_safe(root_fd);
|
||||
|
|
@ -1248,6 +1249,7 @@ static int prep_unix_sk_cwd(struct unix_sk_info *ui, int *prev_cwd_fd,
|
|||
goto err;
|
||||
}
|
||||
close(fd);
|
||||
/* coverity[chroot_call] */
|
||||
if (chroot(".")) {
|
||||
pr_perror("Unable to change root directory");
|
||||
goto err;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue