tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

52_surface_kPolMemPageCount_and_revert_to_14.patch (1961B)


      1 This surfaces the memory page count for the maximum policy size as a constant,
      2 so that we can rely on it in our code. It also reverts it to 14, the value
      3 it was set to before the latest chromium sandbox update.
      4 
      5 diff --git a/security/sandbox/chromium/sandbox/win/src/sandbox_policy.h b/security/sandbox/chromium/sandbox/win/src/sandbox_policy.h
      6 index 4d9d8f270890..bffab2fae890 100644
      7 --- a/security/sandbox/chromium/sandbox/win/src/sandbox_policy.h
      8 +++ b/security/sandbox/chromium/sandbox/win/src/sandbox_policy.h
      9 @@ -10,16 +10,19 @@
     10 
     11 #include "base/containers/span.h"
     12 #include "base/memory/scoped_refptr.h"
     13 #include "sandbox/win/src/sandbox_types.h"
     14 #include "sandbox/win/src/security_level.h"
     15 
     16 namespace sandbox {
     17 
     18 +// Number of memory pages to allow for the policy storage.
     19 +constexpr size_t kPolMemPageCount = 14;
     20 +
     21 class AppContainer;
     22 
     23 // Desktop used to launch child, controls GetDesktop().
     24 enum class Desktop {
     25   // Child is launched without changing the desktop.
     26   kDefault,
     27   // Child is launched using the alternate desktop.
     28   kAlternateDesktop,
     29 diff --git a/security/sandbox/chromium/sandbox/win/src/sandbox_policy_base.cc b/security/sandbox/chromium/sandbox/win/src/sandbox_policy_base.cc
     30 index 2559133d772b..3395e9cadc07 100644
     31 --- a/security/sandbox/chromium/sandbox/win/src/sandbox_policy_base.cc
     32 +++ b/security/sandbox/chromium/sandbox/win/src/sandbox_policy_base.cc
     33 @@ -44,17 +44,17 @@
     34 
     35 namespace sandbox {
     36 namespace {
     37 
     38 // The standard windows size for one memory page.
     39 constexpr size_t kOneMemPage = 4096;
     40 // The IPC and Policy shared memory sizes.
     41 constexpr size_t kIPCMemSize = kOneMemPage * 2;
     42 -constexpr size_t kPolMemSize = kOneMemPage * 6;
     43 +constexpr size_t kPolMemSize = kOneMemPage * kPolMemPageCount;
     44 
     45 // Offset of pShimData in ntdll!_PEB.
     46 #if defined(_WIN64)
     47 // This is the same on x64 and arm64.
     48 constexpr ptrdiff_t kShimDataOffset = 0x2d8;
     49 #else
     50 constexpr ptrdiff_t kShimDataOffset = 0x1e8;
     51 #endif