TOP-unrestricted-comm-build-and-sandbox-dllblklstoop.patch 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # HG changeset patch
  2. # User Matt A. Tobin <email@mattatobin.com>
  3. # Date 1722343983 0
  4. No Bug - Unrestrict comm apps and account for them
  5. diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py
  6. --- a/python/mozbuild/mozbuild/base.py
  7. +++ b/python/mozbuild/mozbuild/base.py
  8. @@ -968,16 +968,25 @@ class MachCommandConditions(object):
  9. @staticmethod
  10. def is_jsshell(cls):
  11. """Must have a jsshell build."""
  12. if hasattr(cls, "substs"):
  13. return cls.substs.get("MOZ_BUILD_APP") == "js"
  14. return False
  15. @staticmethod
  16. + def is_other_comm_app(cls):
  17. + """Must have a non-Thunderbird comm build"""
  18. + if hasattr(cls, "substs"):
  19. + build_app = cls.substs.get("MOZ_BUILD_APP")
  20. + if build_app.startswith("comm/") and not MachCommandConditions.is_thunderbird(cls):
  21. + return True
  22. + return False
  23. +
  24. + @staticmethod
  25. def is_thunderbird(cls):
  26. """Must have a Thunderbird build."""
  27. if hasattr(cls, "substs"):
  28. return cls.substs.get("MOZ_BUILD_APP") == "comm/mail"
  29. return False
  30. @staticmethod
  31. def is_firefox_or_thunderbird(cls):
  32. @@ -1007,17 +1016,19 @@ class MachCommandConditions(object):
  33. cls
  34. ) or MachCommandConditions.is_android(cls)
  35. @staticmethod
  36. def has_build(cls):
  37. """Must have a build."""
  38. return MachCommandConditions.is_firefox_or_android(
  39. cls
  40. - ) or MachCommandConditions.is_thunderbird(cls)
  41. + ) or MachCommandConditions.is_thunderbird(
  42. + cls
  43. + ) or MachCommandConditions.is_other_comm_app(cls)
  44. @staticmethod
  45. def has_build_or_shell(cls):
  46. """Must have a build or a shell build."""
  47. return MachCommandConditions.has_build(cls) or MachCommandConditions.is_jsshell(
  48. cls
  49. )
  50. diff --git a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
  51. --- a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
  52. +++ b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
  53. @@ -360,25 +360,25 @@ Result<Ok, mozilla::ipc::LaunchError> Sa
  54. return Err(mozilla::ipc::LaunchError::FromWin32Error("SB::LA::SpawnTarget",
  55. last_error));
  56. } else if (sandbox::SBOX_ALL_OK != last_warning) {
  57. // If there was a warning (but the result was still ok), log it and proceed.
  58. LOG_W("Warning on SpawnTarget with last_error=%lu, last_warning=%d",
  59. last_error, last_warning);
  60. }
  61. -#ifdef MOZ_THUNDERBIRD
  62. - // In Thunderbird, mInitDllBlocklistOOP is null, so InitDllBlocklistOOP would
  63. +#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SANDBOX_NULL_BLOCKLIST_OOP)
  64. + // In Thunderbird and other comm apps, mInitDllBlocklistOOP is null, so InitDllBlocklistOOP would
  65. // hit MOZ_RELEASE_ASSERT.
  66. - constexpr bool isThunderbird = true;
  67. + constexpr bool hasNullDllBlocklistOOP = true;
  68. #else
  69. - constexpr bool isThunderbird = false;
  70. + constexpr bool hasNullDllBlocklistOOP = false;
  71. #endif
  72. - if (!isThunderbird &&
  73. + if (!hasNullDllBlocklistOOP &&
  74. XRE_GetChildProcBinPathType(aProcessType) == BinPathType::Self) {
  75. RefPtr<DllServices> dllSvc(DllServices::Get());
  76. LauncherVoidResultWithLineInfo blocklistInitOk =
  77. dllSvc->InitDllBlocklistOOP(aPath, targetInfo.hProcess,
  78. aCachedNtdllThunk, aProcessType);
  79. if (blocklistInitOk.isErr()) {
  80. dllSvc->HandleLauncherError(blocklistInitOk.unwrapErr(),
  81. XRE_GeckoProcessTypeToString(aProcessType));