diff options
author | Daniel Pinto <danielpinto52@gmail.com> | 2020-07-29 00:34:08 +0100 |
---|---|---|
committer | Daniel Pinto <danielpinto52@gmail.com> | 2020-07-29 00:34:08 +0100 |
commit | eab8e7af522d18620450003667579eebaa339896 (patch) | |
tree | f1c0175341d8f57ed4aaa5cfa4b754c96009f9ab /src/app/main | |
parent | d28bfb2cd5665c38bd14d6a72848209dcd66faf9 (diff) | |
download | tor-eab8e7af522d18620450003667579eebaa339896.tar.gz tor-eab8e7af522d18620450003667579eebaa339896.zip |
Fix startup crash with seccomp sandbox enabled #40072
Fix crash introduced in #40020. On startup, tor calls
check_private_dir on the data and key directories. This function
uses open instead of opendir on the received directory. Data and
key directoryes are only opened here, so the seccomp rule added
should be for open instead of opendir, despite the fact that they
are directories.
Diffstat (limited to 'src/app/main')
-rw-r--r-- | src/app/main/main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/app/main/main.c b/src/app/main/main.c index aceba78cfc..3f35d4d23f 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -1008,8 +1008,10 @@ sandbox_init_filter(void) OPEN_DATADIR2(name, name2 suffix); \ } while (0) +// KeyDirectory is a directory, but it is only opened in check_private_dir +// which calls open instead of opendir #define OPEN_KEY_DIRECTORY() \ - OPENDIR(options->KeyDirectory) + OPEN(options->KeyDirectory) #define OPEN_CACHEDIR(name) \ sandbox_cfg_allow_open_filename(&cfg, get_cachedir_fname(name)) #define OPEN_CACHEDIR_SUFFIX(name, suffix) do { \ @@ -1023,7 +1025,9 @@ sandbox_init_filter(void) OPEN_KEYDIR(name suffix); \ } while (0) - OPENDIR(options->DataDirectory); + // DataDirectory is a directory, but it is only opened in check_private_dir + // which calls open instead of opendir + OPEN(options->DataDirectory); OPEN_KEY_DIRECTORY(); OPEN_CACHEDIR_SUFFIX("cached-certs", ".tmp"); |