From 09e1adb883639325aa8115dc1fc3e8f5088a2438 Mon Sep 17 00:00:00 2001 From: Kevin Kofler <Kevin@tigcc.ticalc.org> Date: Fri, 22 Jan 2021 19:13:51 +0100 Subject: [PATCH] -#1904652 patch: Fail more gracefully on bad fstatat. Do not crash if an fstatat is not allowed, but fail in the way documented by the fstatat manpage (set errno to EACCES and return -1). Otherwise, QtWebEngine always crashes. --- qtwebengine-everywhere-src-5.15.2-#1904652.patch | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qtwebengine-everywhere-src-5.15.2-#1904652.patch b/qtwebengine-everywhere-src-5.15.2-#1904652.patch index 49281f1..28a60ad 100644 --- a/qtwebengine-everywhere-src-5.15.2-#1904652.patch +++ b/qtwebengine-everywhere-src-5.15.2-#1904652.patch @@ -22,16 +22,17 @@ diff -ur qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/s return Error(fs_denied_errno); diff -ur qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc --- qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc 2020-11-07 02:22:36.000000000 +0100 -+++ qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc 2021-01-20 02:44:06.132477575 +0100 -@@ -6,6 +6,7 @@ ++++ qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc 2021-01-22 19:02:55.651668257 +0100 +@@ -6,6 +6,8 @@ #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" ++#include <errno.h> +#include <fcntl.h> #include <stddef.h> #include <stdint.h> #include <sys/syscall.h> -@@ -353,6 +354,32 @@ +@@ -353,6 +355,35 @@ return -ENOSYS; } @@ -49,6 +50,9 @@ diff -ur qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/s + && args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) { + return sandbox::sys_fstat64(static_cast<int>(args.args[0]), + reinterpret_cast<struct stat64 *>(args.args[2])); ++ } else { ++ errno = EACCES; ++ return -1; + } + break; +#endif @@ -64,7 +68,7 @@ diff -ur qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/s bpf_dsl::ResultExpr CrashSIGSYS() { return bpf_dsl::Trap(CrashSIGSYS_Handler, NULL); } -@@ -385,6 +412,10 @@ +@@ -385,6 +416,10 @@ return bpf_dsl::Trap(SIGSYSSchedHandler, NULL); }