Log Message
Merge r289369 - [GTK][WPE] Crash at WebKit::bindA11y() in WebKitGTK 2.35.2 https://bugs.webkit.org/show_bug.cgi?id=236144
Patch by Carlos Garcia Campos <[email protected]> on 2022-02-08 Reviewed by Adrian Perez de Castro. ATSPI stopped using an abstract socket but we are still assuming the a11y bus address is an abstract socket, even when the path is not really used after all. However, just handling the case of the socket being a normal unix socket is not enough, because the actual socket path is not mounted in the xdg-dbus-proxy sandbox, so it fails to connect to the original a11y bus. * UIProcess/Launcher/ProcessLauncher.h: Rename extraWebProcessSandboxPaths as extraSandboxPaths. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::XDGDBusProxyLauncher::setAddress): Remove the DBusAddressType parameter. Check the address looks valid and just store the result of dbusAddressToPath() in m_path. (WebKit::XDGDBusProxyLauncher::launch): Do not require m_path to be non-null and add it to the sanbox. (WebKit::XDGDBusProxyLauncher::dbusAddressToPath): Only return the path for normal unix sockets. (WebKit::bindDBusSession): Remove the DBusAddressType parameter passed to dbusAddressToPath(). (WebKit::bindA11y): Check proxy path is not null before setting a11y bus address in display. (WebKit::addExtraPaths): Helper to add extra paths to the sandbox. (WebKit::bubblewrapSpawn): Call addExtraPaths() for WebProcess and DBusProxy types. * UIProcess/Launcher/glib/FlatpakLauncher.cpp: (WebKit::flatpakSpawn): Use extraSandboxPaths. * UIProcess/glib/WebProcessProxyGLib.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): Ditto.
Modified Paths
- releases/WebKitGTK/webkit-2.34/Source/WebKit/ChangeLog
- releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h
- releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
- releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/glib/FlatpakLauncher.cpp
- releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp
Diff
Modified: releases/WebKitGTK/webkit-2.34/Source/WebKit/ChangeLog (289429 => 289430)
--- releases/WebKitGTK/webkit-2.34/Source/WebKit/ChangeLog 2022-02-08 22:25:12 UTC (rev 289429)
+++ releases/WebKitGTK/webkit-2.34/Source/WebKit/ChangeLog 2022-02-08 22:25:21 UTC (rev 289430)
@@ -1,3 +1,30 @@
+2022-02-08 Carlos Garcia Campos <[email protected]>
+
+ [GTK][WPE] Crash at WebKit::bindA11y() in WebKitGTK 2.35.2
+ https://bugs.webkit.org/show_bug.cgi?id=236144
+
+ Reviewed by Adrian Perez de Castro.
+
+ ATSPI stopped using an abstract socket but we are still assuming the a11y bus address is an abstract socket,
+ even when the path is not really used after all. However, just handling the case of the socket being a normal
+ unix socket is not enough, because the actual socket path is not mounted in the xdg-dbus-proxy sandbox, so it
+ fails to connect to the original a11y bus.
+
+ * UIProcess/Launcher/ProcessLauncher.h: Rename extraWebProcessSandboxPaths as extraSandboxPaths.
+ * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
+ (WebKit::XDGDBusProxyLauncher::setAddress): Remove the DBusAddressType parameter. Check the address looks valid
+ and just store the result of dbusAddressToPath() in m_path.
+ (WebKit::XDGDBusProxyLauncher::launch): Do not require m_path to be non-null and add it to the sanbox.
+ (WebKit::XDGDBusProxyLauncher::dbusAddressToPath): Only return the path for normal unix sockets.
+ (WebKit::bindDBusSession): Remove the DBusAddressType parameter passed to dbusAddressToPath().
+ (WebKit::bindA11y): Check proxy path is not null before setting a11y bus address in display.
+ (WebKit::addExtraPaths): Helper to add extra paths to the sandbox.
+ (WebKit::bubblewrapSpawn): Call addExtraPaths() for WebProcess and DBusProxy types.
+ * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
+ (WebKit::flatpakSpawn): Use extraSandboxPaths.
+ * UIProcess/glib/WebProcessProxyGLib.cpp:
+ (WebKit::WebProcessProxy::platformGetLaunchOptions): Ditto.
+
2022-02-04 Alexander Mikhaylenko <[email protected]>
[GTK] Crash when starting DND on touchscreen
Modified: releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h (289429 => 289430)
--- releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h 2022-02-08 22:25:12 UTC (rev 289429)
+++ releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h 2022-02-08 22:25:21 UTC (rev 289430)
@@ -93,7 +93,7 @@
CString customWebContentServiceBundleIdentifier;
#if PLATFORM(GTK) || PLATFORM(WPE)
- HashMap<CString, SandboxPermission> extraWebProcessSandboxPaths;
+ HashMap<CString, SandboxPermission> extraSandboxPaths;
#if ENABLE(DEVELOPER_MODE)
String processCmdPrefix;
#endif
Modified: releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp (289429 => 289430)
--- releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp 2022-02-08 22:25:12 UTC (rev 289429)
+++ releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp 2022-02-08 22:25:21 UTC (rev 289430)
@@ -166,17 +166,11 @@
return createSealedMemFdWithData("flatpak-info", data->get(), size);
}
-enum class DBusAddressType {
- Normal,
- Abstract,
-};
-
class XDGDBusProxyLauncher {
public:
- void setAddress(const char* dbusAddress, DBusAddressType addressType)
+ void setAddress(const char* dbusAddress)
{
- CString dbusPath = dbusAddressToPath(dbusAddress, addressType);
- if (dbusPath.isNull())
+ if (!dbusAddress || !g_str_has_prefix(dbusAddress, "unix:"))
return;
GUniquePtr<char> appRunDir(g_build_filename(g_get_user_runtime_dir(), BASE_DIRECTORY, nullptr));
@@ -183,7 +177,7 @@
m_proxyPath = makeProxyPath(appRunDir.get());
m_socket = dbusAddress;
- m_path = WTFMove(dbusPath);
+ m_path = dbusAddressToPath(dbusAddress);
}
bool isRunning() const { return m_isRunning; };
@@ -200,7 +194,7 @@
{
RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!isRunning());
- if (m_socket.isNull() || m_path.isNull() || m_proxyPath.isNull())
+ if (m_socket.isNull() || m_proxyPath.isNull())
return;
int syncFds[2];
@@ -248,6 +242,8 @@
ProcessLauncher::LaunchOptions launchOptions;
launchOptions.processType = ProcessLauncher::ProcessType::DBusProxy;
+ if (!m_path.isNull())
+ launchOptions.extraSandboxPaths.add(m_path, SandboxPermission::ReadOnly);
GUniqueOutPtr<GError> error;
GRefPtr<GSubprocess> process = bubblewrapSpawn(launcher.get(), launchOptions, argv, &error.outPtr());
if (!process.get())
@@ -281,30 +277,24 @@
return CString(proxySocketTemplate.get());
};
- static CString dbusAddressToPath(const char* address, DBusAddressType addressType = DBusAddressType::Normal)
+ static CString dbusAddressToPath(const char* address)
{
- if (!address)
- return { };
-
- if (!g_str_has_prefix(address, "unix:"))
- return { };
-
- const char* path = strstr(address, addressType == DBusAddressType::Abstract ? "abstract=" : "path=");
+ const char* path = strstr(address, "path=");
if (!path)
return { };
- path += strlen(addressType == DBusAddressType::Abstract ? "abstract=" : "path=");
+ path += strlen("path=");
const char* pathEnd = path;
while (*pathEnd && *pathEnd != ',')
pathEnd++;
return CString(path, pathEnd - path);
-}
+ }
CString m_socket;
CString m_path;
CString m_proxyPath;
- bool m_isRunning;
+ bool m_isRunning { false };
Vector<CString> m_permissions;
};
@@ -332,9 +322,9 @@
static void bindDBusSession(Vector<CString>& args, XDGDBusProxyLauncher& proxy)
{
if (!proxy.isRunning())
- proxy.setAddress(g_getenv("DBUS_SESSION_BUS_ADDRESS"), DBusAddressType::Normal);
+ proxy.setAddress(g_getenv("DBUS_SESSION_BUS_ADDRESS"));
- if (proxy.proxyPath().data()) {
+ if (!proxy.proxyPath().isNull() && !proxy.path().isNull()) {
args.appendVector(Vector<CString>({
"--bind", proxy.proxyPath(), proxy.path(),
}));
@@ -503,7 +493,7 @@
} else {
GUniqueOutPtr<char> a11yAddress;
g_variant_get(g_dbus_message_get_body(reply.get()), "(s)", &a11yAddress.outPtr());
- proxy.setAddress(a11yAddress.get(), DBusAddressType::Abstract);
+ proxy.setAddress(a11yAddress.get());
}
}
@@ -521,7 +511,7 @@
proxy.launch(!g_strcmp0(g_getenv("WEBKIT_ENABLE_A11Y_DBUS_PROXY_LOGGING"), "1"));
}
- if (proxy.proxyPath().data()) {
+ if (!proxy.proxyPath().isNull()) {
GUniquePtr<char> proxyAddress(g_strdup_printf("unix:path=%s", proxy.proxyPath().data()));
args.appendVector(Vector<CString>({
"--ro-bind", proxy.proxyPath(), proxy.proxyPath(),
@@ -802,6 +792,16 @@
return true;
}
+static void addExtraPaths(const HashMap<CString, SandboxPermission>& paths, Vector<CString>& args)
+{
+ for (const auto& pathAndPermission : paths) {
+ args.appendVector(Vector<CString>({
+ pathAndPermission.value == SandboxPermission::ReadOnly ? "--ro-bind-try": "--bind-try",
+ pathAndPermission.key, pathAndPermission.key
+ }));
+ }
+}
+
GRefPtr<GSubprocess> bubblewrapSpawn(GSubprocessLauncher* launcher, const ProcessLauncher::LaunchOptions& launchOptions, char** argv, GError **error)
{
ASSERT(launcher);
@@ -866,6 +866,8 @@
// is where we mount our proxy socket.
"--bind", runDir, runDir,
}));
+
+ addExtraPaths(launchOptions.extraSandboxPaths, sandboxArgs);
}
if (shouldUnshareNetwork(launchOptions.processType))
@@ -914,12 +916,7 @@
bindX11(sandboxArgs);
#endif
- for (const auto& pathAndPermission : launchOptions.extraWebProcessSandboxPaths) {
- sandboxArgs.appendVector(Vector<CString>({
- pathAndPermission.value == SandboxPermission::ReadOnly ? "--ro-bind-try": "--bind-try",
- pathAndPermission.key, pathAndPermission.key
- }));
- }
+ addExtraPaths(launchOptions.extraSandboxPaths, sandboxArgs);
Vector<String> extraPaths = { "applicationCacheDirectory", "mediaKeysDirectory", "waylandSocket", "webSQLDatabaseDirectory" };
for (const auto& path : extraPaths) {
Modified: releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/glib/FlatpakLauncher.cpp (289429 => 289430)
--- releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/glib/FlatpakLauncher.cpp 2022-02-08 22:25:12 UTC (rev 289429)
+++ releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/Launcher/glib/FlatpakLauncher.cpp 2022-02-08 22:25:21 UTC (rev 289430)
@@ -59,7 +59,7 @@
"--sandbox-flag=allow-dbus", // Note that this only allows portals and $appid.Sandbox.* access
}));
- for (const auto& pathAndPermission : launchOptions.extraWebProcessSandboxPaths) {
+ for (const auto& pathAndPermission : launchOptions.extraSandboxPaths) {
const char* formatString = pathAndPermission.value == SandboxPermission::ReadOnly ? "--sandbox-expose-path-ro=%s": "--sandbox-expose-path=%s";
GUniquePtr<gchar> pathArg(g_strdup_printf(formatString, pathAndPermission.key.data()));
flatpakArgs.append(pathArg.get());
Modified: releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp (289429 => 289430)
--- releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp 2022-02-08 22:25:12 UTC (rev 289429)
+++ releases/WebKitGTK/webkit-2.34/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp 2022-02-08 22:25:21 UTC (rev 289430)
@@ -53,7 +53,7 @@
launchOptions.extraInitializationData.set("mediaKeysDirectory", dataStore->resolvedMediaKeysDirectory());
launchOptions.extraInitializationData.set("applicationCacheDirectory", dataStore->resolvedApplicationCacheDirectory());
- launchOptions.extraWebProcessSandboxPaths = m_processPool->sandboxPaths();
+ launchOptions.extraSandboxPaths = m_processPool->sandboxPaths();
}
}
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
