| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 PartitionBucket seedBucket; | 130 PartitionBucket seedBucket; |
| 131 PartitionBucket buckets[kNumBuckets]; | 131 PartitionBucket buckets[kNumBuckets]; |
| 132 char* nextSuperPage; | 132 char* nextSuperPage; |
| 133 char* nextPartitionPage; | 133 char* nextPartitionPage; |
| 134 char* nextPartitionPageEnd; | 134 char* nextPartitionPageEnd; |
| 135 bool initialized; | 135 bool initialized; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 WTF_EXPORT void partitionAllocInit(PartitionRoot*); | 138 WTF_EXPORT void partitionAllocInit(PartitionRoot*); |
| 139 WTF_EXPORT void partitionAllocShutdown(PartitionRoot*); | 139 WTF_EXPORT void partitionAllocShutdown(PartitionRoot*); |
| 140 WTF_EXPORT size_t partitionAllocGetUsedPagesSize(const PartitionRoot&); |
| 140 | 141 |
| 141 WTF_EXPORT NEVER_INLINE void* partitionAllocSlowPath(PartitionBucket*); | 142 WTF_EXPORT NEVER_INLINE void* partitionAllocSlowPath(PartitionBucket*); |
| 142 WTF_EXPORT NEVER_INLINE void partitionFreeSlowPath(PartitionPageHeader*); | 143 WTF_EXPORT NEVER_INLINE void partitionFreeSlowPath(PartitionPageHeader*); |
| 143 | 144 |
| 144 ALWAYS_INLINE PartitionFreelistEntry* partitionFreelistMask(PartitionFreelistEnt
ry* ptr) | 145 ALWAYS_INLINE PartitionFreelistEntry* partitionFreelistMask(PartitionFreelistEnt
ry* ptr) |
| 145 { | 146 { |
| 146 // For now, use a simple / fast mask that guarantees an invalid pointer in | 147 // For now, use a simple / fast mask that guarantees an invalid pointer in |
| 147 // case it gets used as a vtable pointer. | 148 // case it gets used as a vtable pointer. |
| 148 // The one attack we're fully mitigating is where an object is freed and its | 149 // The one attack we're fully mitigating is where an object is freed and its |
| 149 // vtable used where the attacker doesn't get the chance to run allocations | 150 // vtable used where the attacker doesn't get the chance to run allocations |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 } // namespace WTF | 218 } // namespace WTF |
| 218 | 219 |
| 219 using WTF::PartitionRoot; | 220 using WTF::PartitionRoot; |
| 220 using WTF::partitionAllocInit; | 221 using WTF::partitionAllocInit; |
| 221 using WTF::partitionAllocShutdown; | 222 using WTF::partitionAllocShutdown; |
| 222 using WTF::partitionAlloc; | 223 using WTF::partitionAlloc; |
| 223 using WTF::partitionFree; | 224 using WTF::partitionFree; |
| 224 | 225 |
| 225 #endif // WTF_PartitionAlloc_h | 226 #endif // WTF_PartitionAlloc_h |
| OLD | NEW |