diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2021-08-21 15:46:27 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2021-09-01 07:14:44 +0100 |
commit | d1ae5a8fb734d34a57b17bd22e95d2b961748758 (patch) | |
tree | 68eef2041161fe6fca4e34b9b323b6e8a6049392 /wsd | |
parent | Status bar: Add readonly class and hide inactive items (diff) | |
download | online-d1ae5a8fb734d34a57b17bd22e95d2b961748758.tar.gz online-d1ae5a8fb734d34a57b17bd22e95d2b961748758.zip |
Valgrind support for tracing the forkit & kits.
Change-Id: Ie9dd69598bd408ae1994d8cdd6f886224890ad23
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'wsd')
-rw-r--r-- | wsd/LOOLWSD.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 99054428c8..8062365ec9 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -2013,15 +2013,28 @@ bool LOOLWSD::createForKit() std::unique_lock<std::mutex> newChildrenLock(NewChildrenMutex); StringVector args; -#ifdef STRACE_LOOLFORKIT - // if you want to use this, you need to setcap cap_fowner,cap_chown,cap_mknod,cap_sys_chroot=ep /usr/bin/strace + std::string parentPath = Path(Application::instance().commandPath()).parent().toString(); + +#if STRACE_LOOLFORKIT + // if you want to use this, you need to sudo setcap cap_fowner,cap_chown,cap_mknod,cap_sys_chroot=ep /usr/bin/strace args.push_back("-o"); args.push_back("strace.log"); args.push_back("-f"); args.push_back("-tt"); args.push_back("-s"); args.push_back("256"); - args.push_back(Path(Application::instance().commandPath()).parent().toString() + "loolforkit"); + args.push_back(parentPath + "loolforkit"); +#elif VALGRIND_LOOLFORKIT + NoCapsForKit = true; + NoSeccomp = true; +// args.push_back("--log-file=valgrind.log"); +// args.push_back("--track-fds=all"); + args.push_back("--trace-children=yes"); + args.push_back("--error-limit=no"); + args.push_back("--num-callers=128"); + std::string nocapsCopy = parentPath + "loolforkit-nocaps"; + FileUtil::copy(parentPath + "loolforkit", nocapsCopy, true, true); + args.push_back(nocapsCopy); #endif args.push_back("--losubpath=" + std::string(LO_JAIL_SUBPATH)); args.push_back("--systemplate=" + SysTemplate); @@ -2059,10 +2072,12 @@ bool LOOLWSD::createForKit() args.push_back("--singlekit"); #endif -#ifdef STRACE_LOOLFORKIT - std::string forKitPath = "strace"; +#if STRACE_LOOLFORKIT + std::string forKitPath = "/usr/bin/strace"; +#elif VALGRIND_LOOLFORKIT + std::string forKitPath = "/usr/bin/valgrind"; #else - std::string forKitPath = Path(Application::instance().commandPath()).parent().toString() + "loolforkit"; + std::string forKitPath = parentPath + "loolforkit"; #endif // Always reap first, in case we haven't done so yet. |