projects
/
project
/
procd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9a6f83d
)
jail: call chdir(/) after pivot_root()
author
Etienne CHAMPETIER
<champetier.etienne@gmail.com>
Sun, 29 May 2016 23:39:12 +0000
(23:39 +0000)
committer
John Crispin
<john@phrozen.org>
Wed, 1 Jun 2016 08:27:34 +0000
(10:27 +0200)
pivot_root(2) man page recommend calling chdir(/), so do it
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
jail/jail.c
patch
|
blob
|
history
diff --git
a/jail/jail.c
b/jail/jail.c
index 541363aab4632daed080188b8b461a2de072ba75..8157a8ff6f0ccc77434c26e45dded40549a8ff14 100644
(file)
--- a/
jail/jail.c
+++ b/
jail/jail.c
@@
-162,6
+162,10
@@
static int build_jail_fs(void)
ERROR("pivot_root failed: %s\n", strerror(errno));
return -1;
}
+ if (chdir("/")) {
+ ERROR("chdir(/) failed: %s\n", strerror(errno));
+ return -1;
+ }
snprintf(dirbuf, sizeof(dirbuf), "/old%s", jail_root);
rmdir(dirbuf);