Implement guard pages in PHC
Categories
(Core :: Memory Allocator, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox76 | --- | fixed |
People
(Reporter: n.nethercote, Assigned: n.nethercote)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 6 obsolete files)
We can put a guard page next to each allocation page and possibly catch bounds violations. It costs additional virtual memory, but no physical memory, and PHC is only enabled on 64-bit platforms which have plenty of virtual memory.
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Comment 2•5 years ago
|
||
XX: the patch adds the guard pages, and things appear to work fine. However,
it has not yet moved allocations so they abut the guard pages, so it's unlikely
to be useful yet for anything other than page-sized allocations.
Depends on D42267
Updated•5 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
This reduces the indentation level by one for most of the loop body.
Depends on D42267
Assignee | ||
Comment 4•5 years ago
|
||
Depends on D43837
Assignee | ||
Comment 5•5 years ago
|
||
It probably doesn't matter, but we might as well copy enough bytes to
completely fill up the usable space of the new allocation when possible.
Depends on D43838
Assignee | ||
Comment 6•5 years ago
|
||
Currently the PHC code uses char* and uintptr_t in various address
computations. This patch changes it to use uint8_t* instead, which is clearer
than char* and avoids the need for various casts.
Depends on D43839
Assignee | ||
Comment 7•5 years ago
|
||
This is in preparation for the introduction of "guard pages", which are
interleaved with alloc pages. The specific renamings are:
- kMaxPageAllocs --> kNumAllocPages
- PagePtr --> AllocPagePtr
- PageState --> AllocPageState
- PageInfo --> AllocPageInfo
- mPages --> mAllocPages
- AssertPageInUse --> AssertAllocPageInUse
Depends on D43840
Assignee | ||
Comment 8•5 years ago
|
||
Each allocation page is now followed by a guard page, and allocations are put
at the end of their page so that bounds violations trigger a crash.
Various operations (realloc(), free(), malloc_usable_size()) now require that
the pointer they are given points to the start of an allocation.
Depends on D43841
Comment 9•5 years ago
|
||
Comment on attachment 9085973 [details]
Bug 1574390 - Fix some broken PHC_LOGGING code. r=glandium
Revision D42267 was moved to bug 1594598. Setting attachment 9085973 [details] to obsolete.
Comment 10•5 years ago
|
||
Comment on attachment 9088871 [details]
Bug 1574390 - Tweak the control flow in MaybePageAlloc()'s loop. r=glandium
Revision D43837 was moved to bug 1594598. Setting attachment 9088871 [details] to obsolete.
Comment 11•5 years ago
|
||
Comment on attachment 9088872 [details]
Bug 1574390 - Improve some PHC comments. r=glandium
Revision D43838 was moved to bug 1594598. Setting attachment 9088872 [details] to obsolete.
Comment 12•5 years ago
|
||
Comment on attachment 9088874 [details]
Bug 1574390 - Use uint8_t* to avoid a bunch of casts. r=glandium
Revision D43840 was moved to bug 1594598. Setting attachment 9088874 [details] to obsolete.
Updated•5 years ago
|
Comment 13•5 years ago
|
||
Comment 14•5 years ago
|
||
bugherder |
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
bugherder |
Description
•