Skip to content

Commit

Permalink
Patch for newer revision of M122.
Browse files Browse the repository at this point in the history
  • Loading branch information
win32ss committed Apr 1, 2024
1 parent e684a8e commit 6d16c0e
Show file tree
Hide file tree
Showing 411 changed files with 13,296 additions and 1,538 deletions.
5 changes: 5 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# These are supported funding model platforms

#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: win32
custom: ['http://paypal.me/win32420']
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to fix an issue in the Supermium web browser
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. Windows Vista SP2 x64]
- Bitness of browser

**Additional context**
Add any other context about the problem here.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ vs-chromium-project.txt
/chrome/android/profiles/arm.local.txt
/chrome/android/profiles/local.txt
/chrome/angle_unittests_run.xml
/chrome/app/resources
/chrome/build/pgo_profiles/
/chrome/gl_tests_run.xml
/chrome/gles2_conform_test_run.xml
Expand Down Expand Up @@ -189,6 +190,7 @@ vs-chromium-project.txt
/components/history_clusters/internal
/components/leveldb_proto_test_support.xml
/components/search_engines/prepopulated_engines.xml
/components/strings
/components/suggestions.xml
/components/variations.xml
/components/vector_icons/google_chrome/
Expand Down
13 changes: 12 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@ declare_args() {
if (is_official_build) {
# An official (maximally optimized!) component (optimized for build times)
# build doesn't make sense and usually doesn't work.
assert(!is_component_build)
assert(!is_component_build)
}

# Supermium target that simply pulls in the chrome target as a dependency
group("supermium") {
if (is_win || is_linux || is_mac) {
deps = [ "//chrome:chrome" ]
}

if (is_win) {
deps += [ "//chrome:chrome_dll" ]
}
}

# The `gn_all` target is used to list all of the main targets in the build, so
Expand Down
27 changes: 0 additions & 27 deletions LICENSE.chromium_os

This file was deleted.

54 changes: 40 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,47 @@
# ![Logo](chrome/app/theme/chromium/product_logo_64.png) Chromium

Chromium is an open-source browser project that aims to build a safer, faster,
and more stable way for all users to experience the web.
![supermium logo + wordmark fw](https://github.com/win32ss/supermium/assets/68521531/f34ceb1c-15b2-4818-af1f-c0251c77af2f)

The project's web site is https://www.chromium.org.
# Supermium

To check out the source code locally, don't use `git clone`! Instead,
follow [the instructions on how to get the code](docs/get_the_code.md).
**Latest progwrp.dll (version 1.1.0.5000)**
This Supermium component sees enhancements and improvements from time to time, mostly for operating systems before Windows Vista.

Documentation in the source is rooted in [docs/README.md](docs/README.md).
x86: [progwrp_32.zip](https://github.com/win32ss/supermium/files/14752565/progwrp_32.zip)

Learn how to [Get Around the Chromium Source Code Directory
Structure](https://www.chromium.org/developers/how-tos/getting-around-the-chrome-source-code).
x64: [progwrp_64.zip](https://github.com/win32ss/supermium/files/14752572/progwrp_64.zip)

For historical reasons, there are some small top level directories. Now the
guidance is that new top level directories are for product (e.g. Chrome,
Android WebView, Ash). Even if these products have multiple executables, the
code should be in subdirectories of the product.
An up-to-date Chromium-based web browser compatible with Windows XP, 2003, Vista, 7 and 8.x.

If you found a bug, please file it at https://crbug.com/new.
The Supermium web browser also provides the following features:

-Aero Glass and Aero Glass-style titlebars instead of Windows 10-style ones (#force-xp-theme in chrome://flags for the latter)

-Turnaround for major vulnerability patches generally less than one week from upstream disclosure

-A functional sandbox for enhanced security

-Google Sync

-On Windows 7 and up, Widevine CDM support for viewing DRM content

-GDI font rendering, using #force-gdi in chrome://flags

-Persistent dark mode on the browser's UI elements, using #force-dark-mode in chrome://flags

-Custom tab options including trapezoidal tabs, transparent tabs, and outlined tabs

-Many flags from ungoogled-chromium

-Support for SSE2-only processors in the 32 bit build

**Future support for:**

-Windows 2000

-Ungoogled Chromium features (in progress)

-WebGPU for D3D9 renderer

-Manifest V2 (once removed by Google)

...and more! If there's a feature you want, which cannot be replicated by a Manifest v2/v3 extension, please ask!
6 changes: 0 additions & 6 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ if (is_win) {
ldflags = [
# Linking with shcore.lib causes the shcore api forwarder dll to load.
"/DELAYLOAD:api-ms-win-shcore-scaling-l1-1-1.dll",

# Linking with OneCore.lib causes the next three dlls to load.
"/DELAYLOAD:api-ms-win-core-realtime-l1-1-1.dll",
"/DELAYLOAD:api-ms-win-power-base-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-power-setting-l1-1-0.dll",
"/DELAYLOAD:cfgmgr32.dll",
"/DELAYLOAD:powrprof.dll",
"/DELAYLOAD:setupapi.dll",
Expand Down Expand Up @@ -1921,7 +1916,6 @@ component("base") {
libs += [
"cfgmgr32.lib",
"ntdll.lib",
"onecore.lib",
"pdh.lib",
"powrprof.lib",
"propsys.lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@

namespace partition_alloc::internal {

namespace {

// On Windows, discarded pages are not returned to the system immediately and
// not guaranteed to be zeroed when returned to the application.
using DiscardVirtualMemoryFunction = DWORD(WINAPI*)(PVOID virtualAddress,
SIZE_T size);
DiscardVirtualMemoryFunction s_discard_virtual_memory =
reinterpret_cast<DiscardVirtualMemoryFunction>(-1);

} // namespace

// |VirtualAlloc| will fail if allocation at the hint address is blocked.
constexpr bool kHintIsAdvisory = false;
std::atomic<int32_t> s_allocPageErrorCode{ERROR_SUCCESS};
Expand Down Expand Up @@ -226,12 +237,20 @@ bool TryRecommitSystemPagesInternal(
}

void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
if (s_discard_virtual_memory ==
reinterpret_cast<DiscardVirtualMemoryFunction>(-1)) {
s_discard_virtual_memory =
reinterpret_cast<DiscardVirtualMemoryFunction>(GetProcAddress(
GetModuleHandle(L"Kernel32.dll"), "DiscardVirtualMemory"));
}

void* ptr = reinterpret_cast<void*>(address);
// Use DiscardVirtualMemory when available because it releases faster than
// MEM_RESET.
DWORD ret = DiscardVirtualMemory(ptr, length);
// DiscardVirtualMemory is buggy in Win10 SP0, so fall back to MEM_RESET on
// failure.
DWORD ret = 1;
if (s_discard_virtual_memory) {
ret = s_discard_virtual_memory(ptr, length);
}
if (ret) {
PA_CHECK(VirtualAllocWithRetry(ptr, length, MEM_RESET, PAGE_READWRITE));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,34 @@ namespace {

#if BUILDFLAG(IS_WIN)

#if PA_CONFIG(DYNAMICALLY_SELECT_POOL_SIZE)
bool IsLegacyWindowsVersion() {
// Use ::RtlGetVersion instead of ::GetVersionEx or helpers from
// VersionHelpers.h because those alternatives change their behavior depending
// on whether or not the calling executable has a compatibility manifest
// resource. It's better for the allocator to not depend on that to decide the
// pool size.
// Assume legacy if ::RtlGetVersion is not available or it fails.
using RtlGetVersion = LONG(WINAPI*)(OSVERSIONINFOEX*);
const RtlGetVersion rtl_get_version = reinterpret_cast<RtlGetVersion>(
::GetProcAddress(::GetModuleHandle(L"ntdll.dll"), "RtlGetVersion"));
if (!rtl_get_version) {
return true;
}

OSVERSIONINFOEX version_info = {};
version_info.dwOSVersionInfoSize = sizeof(version_info);
if (rtl_get_version(&version_info) != ERROR_SUCCESS) {
return true;
}

// Anything prior to Windows 8.1 is considered legacy for the allocator.
// Windows 8.1 is major 6 with minor 3.
return version_info.dwMajorVersion < 6 ||
(version_info.dwMajorVersion == 6 && version_info.dwMinorVersion < 3);
}
#endif // PA_CONFIG(DYNAMICALLY_SELECT_POOL_SIZE)

PA_NOINLINE void HandlePoolAllocFailureOutOfVASpace() {
PA_NO_CODE_FOLDING();
PA_CHECK(false);
Expand All @@ -67,9 +95,9 @@ PA_NOINLINE void HandlePoolAllocFailure() {
HandlePoolAllocFailureOutOfVASpace();
} else if (alloc_page_error_code == ERROR_COMMITMENT_LIMIT ||
alloc_page_error_code == ERROR_COMMITMENT_MINIMUM) {
// Should not happen, since as of Windows 8.1+, reserving address space
// should not be charged against the commit limit, aside from a very small
// amount per 64kiB block. Keep this path anyway, to check in crash reports.
// On Windows <8.1, MEM_RESERVE increases commit charge to account for
// not-yet-committed PTEs needed to cover that VA space, if it was to be
// committed (see crbug.com/1101421#c16).
HandlePoolAllocFailureOutOfCommitCharge();
} else
#endif // BUILDFLAG(IS_WIN)
Expand All @@ -88,10 +116,7 @@ std::ptrdiff_t PartitionAddressSpace::brp_pool_shadow_offset_ = 0;
#endif

#if PA_CONFIG(DYNAMICALLY_SELECT_POOL_SIZE)
#if !BUILDFLAG(IS_IOS)
#error Dynamic pool size is only supported on iOS.
#endif

#if BUILDFLAG(IS_IOS)
namespace {
bool IsIOSTestProcess() {
// On iOS, only applications with the extended virtual addressing entitlement
Expand Down Expand Up @@ -133,6 +158,15 @@ PA_ALWAYS_INLINE size_t PartitionAddressSpace::RegularPoolSize() {
PA_ALWAYS_INLINE size_t PartitionAddressSpace::BRPPoolSize() {
return IsIOSTestProcess() ? kBRPPoolSizeForIOSTestProcess : kBRPPoolSize;
}
#else
PA_ALWAYS_INLINE size_t PartitionAddressSpace::RegularPoolSize() {
return IsLegacyWindowsVersion() ? kRegularPoolSizeForLegacyWindows
: kRegularPoolSize;
}
PA_ALWAYS_INLINE size_t PartitionAddressSpace::BRPPoolSize() {
return IsLegacyWindowsVersion() ? kBRPPoolSizeForLegacyWindows : kBRPPoolSize;
}
#endif // BUILDFLAG(IS_IOS)
#endif // PA_CONFIG(DYNAMICALLY_SELECT_POOL_SIZE)

void PartitionAddressSpace::Init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,16 @@ class PA_COMPONENT_EXPORT(PARTITION_ALLOC) PartitionAddressSpace {
static constexpr size_t kThreadIsolatedPoolSize = kGiB / 4;
static_assert(std::has_single_bit(kThreadIsolatedPoolSize));
#endif
#if PA_CONFIG(DYNAMICALLY_SELECT_POOL_SIZE)
// We can't afford pool sizes as large as kPoolMaxSize on Windows <8.1 (see
// crbug.com/1101421 and crbug.com/1217759).
static constexpr size_t kRegularPoolSizeForLegacyWindows = 4 * kGiB;
static constexpr size_t kBRPPoolSizeForLegacyWindows = 4 * kGiB;
static_assert(kRegularPoolSizeForLegacyWindows < kRegularPoolSize);
static_assert(kBRPPoolSizeForLegacyWindows < kBRPPoolSize);
static_assert(std::has_single_bit(kRegularPoolSizeForLegacyWindows));
static_assert(std::has_single_bit(kBRPPoolSizeForLegacyWindows));
#endif // PA_CONFIG(DYNAMICALLY_SELECT_POOL_SIZE)
static constexpr size_t kConfigurablePoolMaxSize = kPoolMaxSize;
static constexpr size_t kConfigurablePoolMinSize = 1 * kGiB;
static_assert(kConfigurablePoolMinSize <= kConfigurablePoolMaxSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,27 @@

#include "partition_alloc/partition_alloc_base/check.h"

// Prototype for ProcessPrng.
// See: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng
extern "C" {
BOOL WINAPI ProcessPrng(PBYTE pbData, SIZE_T cbData);
}
// #define needed to link in RtlGenRandom(), a.k.a. SystemFunction036. See the
// "Community Additions" comment on MSDN here:
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx
#define SystemFunction036 NTAPI SystemFunction036
#include <NTSecAPI.h>
#undef SystemFunction036

namespace partition_alloc::internal::base {

void RandBytes(void* output, size_t output_length) {
// Import bcryptprimitives directly rather than cryptbase to avoid opening a
// handle to \\Device\KsecDD in the renderer.
// Note: we cannot use a magic static here as PA runs too early in process
// startup, but this should be safe as the process will be single-threaded
// when this first runs.
static decltype(&ProcessPrng) process_prng_fn = nullptr;
if (!process_prng_fn) {
HMODULE hmod = LoadLibraryW(L"bcryptprimitives.dll");
PA_BASE_CHECK(hmod);
process_prng_fn = reinterpret_cast<decltype(&ProcessPrng)>(
GetProcAddress(hmod, "ProcessPrng"));
PA_BASE_CHECK(process_prng_fn);
}
BOOL success = process_prng_fn(static_cast<BYTE*>(output), output_length);
// ProcessPrng is documented to always return TRUE.
PA_BASE_CHECK(success);
char* output_ptr = static_cast<char*>(output);
while (output_length > 0) {
const ULONG output_bytes_this_pass = static_cast<ULONG>(std::min(
output_length, static_cast<size_t>(std::numeric_limits<ULONG>::max())));
const bool success =
RtlGenRandom(output_ptr, output_bytes_this_pass) != FALSE;
PA_BASE_CHECK(success);
output_length -= output_bytes_this_pass;
output_ptr += output_bytes_this_pass;
}

}

} // namespace partition_alloc::internal::base
Loading

0 comments on commit 6d16c0e

Please sign in to comment.