Commit Graph

8 Commits

Author SHA1 Message Date
Matthew Parkinson
71e205fe17 Fallible notify using (#790)
On Windows, the most common way to out-of-memory is to fail to commit a
page.  The current design of the Pal assumes that notify_using always
succeeds, thus we have to raise an error if it fails.  This changes the
specification of notify_using to return a bool, indicating whether the
notify succeeded or not.

This allows Windows to fail the notification, and then the surrounding
code can handle the failure appropriately, such as by throwing an
exception or returning the nullptr for the allocation.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-09 07:37:58 +00:00
Axel PASCON
7f368bd6da Fix broken link in PORTING.md (#610) 2023-04-07 20:08:37 +01:00
Matthew Parkinson
ccca98a709 Factor checks under separate feature flags. (#587)
All the checks and mitigations have been placed under feature flags.
These can be controlled by defining

  SNMALLOC_CHECK_CLIENT_MITIGATIONS

This can take a term that represents the mitigations that should be enabled.
E.g.
  -DSNMALLOC_CHECK_CLIENT_MITIGATIONS=nochecks+random_pagemap

The CMake uses this to build numerous versions of the LD_PRELOAD library and
tests to allow individual features to be benchmarked.

Co-authored-by: Nathaniel Wesley Filardo <nfilardo@microsoft.com>
2023-03-23 13:41:02 +00:00
Matthew Parkinson
55a7ad2d58 Introduce PalEnforceAccess
The various Pals were given different meanings in CHECK_CLIENT and
non-CHECK_CLIENT builds.  This was because it is essential
that in the CHECK_CLIENT builds access is prevented, when not requested.

This PR separates the CHECK_CLIENT concept from how the Pal should be
implemented.
2021-09-28 09:23:52 +01:00
Matthew Parkinson
b4efc40aa6 Expose notify_using_readonly
This exposes a readonly notify using, so that the underlying platform
can map the range of pages readonly into the application.  This improves
performance of external pointer on platforms that support lazy commit
of pages as it can access anything in the range.
2021-09-28 09:23:52 +01:00
Matthew Parkinson
5d0ae71423 Remove at_least
The Pal was providing policy for overallocating a block of memory to
achieve alignment make that part of the backend.
The backend should be responsible for layout policy.
2021-07-21 09:36:06 +01:00
Matthew Parkinson
8b1ffbc166 Expose reserve_at_least in all Pals 2021-07-21 09:36:06 +01:00
David Chisnall
2385eb2bc1 Separate out building and porting docs. (#260)
Fix omissions in the porting doc (`page_size` and C++20 concepts).
2020-11-10 13:33:45 +00:00