diff options
| author | Daniel Golle | 2021-07-15 01:49:23 +0000 |
|---|---|---|
| committer | Daniel Golle | 2021-07-15 17:08:08 +0000 |
| commit | 0114c6fc8beae0334e7e2f924e64ab09af046702 (patch) | |
| tree | 525cd2dc26d431e82a06b71ca54455975730d7ee | |
| parent | 15997e67a559d3477d34613062725689fbfeab93 (diff) | |
| download | procd-0114c6fc8beae0334e7e2f924e64ab09af046702.tar.gz | |
jail: open() extroot folder before mounting
Use open() to trigger autofs mount and check extroot folder exists
before mount-binding it.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
| -rw-r--r-- | jail/jail.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/jail/jail.c b/jail/jail.c index dca3992..4cc16c8 100644 --- a/jail/jail.c +++ b/jail/jail.c @@ -641,6 +641,14 @@ static int build_jail_fs(void) } if (opts.extroot) { + /* use stat to trigger autofs mount */ + DEBUG("mounting extroot from %s\n", opts.extroot); + int rootdirfd = open(opts.extroot, O_RDONLY | O_DIRECTORY); + if (rootdirfd == -1) { + ERROR("extroot %s open failed %m\n", opts.extroot); + return -1; + } + close(rootdirfd); if (mount(opts.extroot, jail_root, "bind", MS_BIND, NULL)) { ERROR("extroot mount failed %m\n"); return -1; |