diff options
author | smitsohu <smitsohu@gmail.com> | 2021-03-03 16:01:04 +0100 |
---|---|---|
committer | smitsohu <smitsohu@gmail.com> | 2021-03-03 16:42:39 +0100 |
commit | 62e34d2601616313a676ca9dec78cf925b960f23 (patch) | |
tree | 10f8122a115ad486fa103d9330e3f6153cad0125 | |
parent | Merge pull request #4035 from Tomin1/few_fixes (diff) | |
download | firejail-62e34d2601616313a676ca9dec78cf925b960f23.tar.gz firejail-62e34d2601616313a676ca9dec78cf925b960f23.tar.zst firejail-62e34d2601616313a676ca9dec78cf925b960f23.zip |
private-etc: minor timetrace fix
fixes reversed /etc and /usr/etc timetraces
-rw-r--r-- | src/firejail/fs_etc.c | 6 | ||||
-rw-r--r-- | src/firejail/sandbox.c | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/firejail/fs_etc.c b/src/firejail/fs_etc.c index d093d5637..abec25d45 100644 --- a/src/firejail/fs_etc.c +++ b/src/firejail/fs_etc.c | |||
@@ -152,8 +152,6 @@ void fs_private_dir_copy(const char *private_dir, const char *private_run_dir, c | |||
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | 154 | ||
155 | timetrace_start(); | ||
156 | |||
157 | // create /run/firejail/mnt/etc directory | 155 | // create /run/firejail/mnt/etc directory |
158 | mkdir_attr(private_run_dir, 0755, 0, 0); | 156 | mkdir_attr(private_run_dir, 0755, 0, 0); |
159 | selinux_relabel_path(private_run_dir, private_dir); | 157 | selinux_relabel_path(private_run_dir, private_dir); |
@@ -211,11 +209,11 @@ void fs_private_dir_mount(const char *private_dir, const char *private_run_dir) | |||
211 | if (mount("tmpfs", private_run_dir, "tmpfs", MS_NOSUID | MS_NODEV | MS_STRICTATIME, "mode=755,gid=0") < 0) | 209 | if (mount("tmpfs", private_run_dir, "tmpfs", MS_NOSUID | MS_NODEV | MS_STRICTATIME, "mode=755,gid=0") < 0) |
212 | errExit("mounting tmpfs"); | 210 | errExit("mounting tmpfs"); |
213 | fs_logger2("tmpfs", private_run_dir); | 211 | fs_logger2("tmpfs", private_run_dir); |
214 | |||
215 | fmessage("Private %s installed in %0.2f ms\n", private_dir, timetrace_end()); | ||
216 | } | 212 | } |
217 | 213 | ||
218 | void fs_private_dir_list(const char *private_dir, const char *private_run_dir, const char *private_list) { | 214 | void fs_private_dir_list(const char *private_dir, const char *private_run_dir, const char *private_list) { |
215 | timetrace_start(); | ||
219 | fs_private_dir_copy(private_dir, private_run_dir, private_list); | 216 | fs_private_dir_copy(private_dir, private_run_dir, private_list); |
220 | fs_private_dir_mount(private_dir, private_run_dir); | 217 | fs_private_dir_mount(private_dir, private_run_dir); |
218 | fmessage("Private %s installed in %0.2f ms\n", private_dir, timetrace_end()); | ||
221 | } | 219 | } |
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index a97ca0abb..058cdafbc 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c | |||
@@ -971,21 +971,24 @@ int sandbox(void* sandbox_arg) { | |||
971 | * 2. unmount bind mounts from /etc | 971 | * 2. unmount bind mounts from /etc |
972 | * 3. mount RUN_ETC_DIR at /etc | 972 | * 3. mount RUN_ETC_DIR at /etc |
973 | */ | 973 | */ |
974 | timetrace_start(); | ||
974 | fs_private_dir_copy("/etc", RUN_ETC_DIR, cfg.etc_private_keep); | 975 | fs_private_dir_copy("/etc", RUN_ETC_DIR, cfg.etc_private_keep); |
975 | fs_private_dir_copy("/usr/etc", RUN_USR_ETC_DIR, cfg.etc_private_keep); // openSUSE | ||
976 | 976 | ||
977 | if (umount2("/etc/group", MNT_DETACH) == -1) | 977 | if (umount2("/etc/group", MNT_DETACH) == -1) |
978 | fprintf(stderr, "/etc/group: unmount: %s\n", strerror(errno)); | 978 | fprintf(stderr, "/etc/group: unmount: %s\n", strerror(errno)); |
979 | |||
980 | if (umount2("/etc/passwd", MNT_DETACH) == -1) | 979 | if (umount2("/etc/passwd", MNT_DETACH) == -1) |
981 | fprintf(stderr, "/etc/passwd: unmount: %s\n", strerror(errno)); | 980 | fprintf(stderr, "/etc/passwd: unmount: %s\n", strerror(errno)); |
982 | 981 | ||
983 | fs_private_dir_mount("/etc", RUN_ETC_DIR); | 982 | fs_private_dir_mount("/etc", RUN_ETC_DIR); |
984 | fs_private_dir_mount("/usr/etc", RUN_USR_ETC_DIR); | 983 | fmessage("Private /etc installed in %0.2f ms\n", timetrace_end()); |
985 | 984 | ||
986 | // create /etc/ld.so.preload file again | 985 | // create /etc/ld.so.preload file again |
987 | if (need_preload) | 986 | if (need_preload) |
988 | fs_trace_preload(); | 987 | fs_trace_preload(); |
988 | |||
989 | // openSUSE configuration is split between /etc and /usr/etc | ||
990 | // process private-etc a second time | ||
991 | fs_private_dir_list("/usr/etc", RUN_USR_ETC_DIR, cfg.etc_private_keep); | ||
989 | } | 992 | } |
990 | } | 993 | } |
991 | 994 | ||