Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Issue 1410213004: Create "persistent memory allocator" for persisting and sharing objects. (Closed)

Created:
5 years, 1 month ago by bcwhite
Modified:
4 years, 11 months ago
CC:
chromium-reviews, gavinp+memory_chromium.org, vmpstr+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Create "persistent memory allocator" for persisting and sharing objects. This allocator reserves memory within a specific block that itself can be persisted and/or shared between processes by various means. It is lock-free for operation on all platforms (even Android which does not support inter-process locks) and self-checking to deal with security concerns where not all processes accessing the memory are fully trustworthy. BUG=546019 Committed: https://crrev.com/34ae4983d4a24f5136bf8fda7b618842920962b0 Cr-Commit-Position: refs/heads/master@{#370377}

Patch Set 1 #

Total comments: 53

Patch Set 2 : fixed compile problems; added paging test #

Total comments: 2

Patch Set 3 : addressed review comments by chrisha #

Patch Set 4 : changed int32 to int32_t #

Total comments: 40

Patch Set 5 : addressed review comments by Alexander #

Total comments: 4

Patch Set 6 : added parallel test (and fixed a bug found by it) #

Patch Set 7 : cleaned up some checks no longer necessary after previous fix #

Patch Set 8 : added iterable loop detection; added "malicious" test #

Patch Set 9 : simplified loop detection #

Total comments: 2

Patch Set 10 : moved flags to Atomic32 #

Total comments: 34

Patch Set 11 : addressed review comments by Alexander and Dmitry #

Patch Set 12 : some 'git cl format' changes and remove double-space after periods #

Total comments: 20

Patch Set 13 : addressed review comments by Chris #

Total comments: 6

Patch Set 14 : rebased #

Total comments: 38

Patch Set 15 : addressed review comments by Dmitry #

Patch Set 16 : fixed signed/unsigned comparison; improved comment #

Patch Set 17 : new MakeIterable enqueue algorithm #

Patch Set 18 : remove unnecessary barriers in Allocate; rename Corrupted->Corrupt to match tense of Full #

Patch Set 19 : use size_t for sizes on external interface #

Patch Set 20 : fix signed/unsigned compile issues #

Patch Set 21 : improvements to external interface ('offset' becomes 'reference') #

Patch Set 22 : hardening of GetAllocSize() and more signed/unsigned compile problem fixes #

Patch Set 23 : even more signed/unsigned comparison fixes #

Patch Set 24 : good grief -- when will it end? #

Total comments: 30

Patch Set 25 : addressed review comments by Chris #

Total comments: 22

Patch Set 26 : addressed review comments; added metrics #

Patch Set 27 : add missing <string> import #

Patch Set 28 : SharedMemoryAllocator -> PersistentMemoryAllocator #

Total comments: 4

Patch Set 29 : overflow-safe validation of passed size_t #

Patch Set 30 : use 'volatile' for shared memory; use std::atomic for member flag #

Total comments: 6

Patch Set 31 : changed from subtle::Atomic32 to std::atomic<uint32_t> #

Patch Set 32 : fixed a few remaining int32_t values #

Patch Set 33 : fixed unittest signed/unsigned usage #

Patch Set 34 : iterator improvements (to allow comparisons and hide internal details) #

Total comments: 9

Patch Set 35 : support for read-only (const) memory segments; support arbitrary iteration start; more tests #

Patch Set 36 : addressed review comments by Dmity #

Patch Set 37 : added File allocator and test #

Patch Set 38 : fix delete of new[]; record failed allocs in histogram #

Patch Set 39 : harden used(); file allocator now read-only #

Patch Set 40 : moved from base/memory to base/metrics #

Patch Set 41 : added IsMemoryAcceptable and IsFileAcceptable methods for pre-checking source #

Patch Set 42 : rebased #

Total comments: 47

Patch Set 43 : addesed comments by Alexander Potapenko #

Patch Set 44 : addessed more comments by Alexander Potapenko #

Total comments: 51

Patch Set 45 : addressed review comments by Chris #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1516 lines, -0 lines) Patch
M base/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 2 chunks +3 lines, -0 lines 0 comments Download
M base/base.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 1 chunk +1 line, -0 lines 0 comments Download
M base/base.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 1 chunk +2 lines, -0 lines 0 comments Download
A base/metrics/persistent_memory_allocator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 1 chunk +333 lines, -0 lines 0 comments Download
A base/metrics/persistent_memory_allocator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 1 chunk +670 lines, -0 lines 0 comments Download
A base/metrics/persistent_memory_allocator_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 1 chunk +507 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 153 (26 generated)
bcwhite
I'm still working on a multi-threaded test for the allocator to verify its parallel operation ...
5 years, 1 month ago (2015-10-29 18:55:02 UTC) #2
chrisha
A first review based just on the header file. I started looking at the .cc ...
5 years, 1 month ago (2015-10-29 21:05:14 UTC) #3
bcwhite
https://codereview.chromium.org/1410213004/diff/1/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/1/base/memory/shared_memory_allocator.cc#newcode13 base/memory/shared_memory_allocator.cc:13: #define ALLOC_ALIGNMENT 16 On 2015/10/29 21:05:13, chrisha wrote: > ...
5 years, 1 month ago (2015-10-29 23:40:58 UTC) #4
Alexander Potapenko
I think this code is over-complicated by the seemingly unnecessary corruption checks. Can you please ...
5 years, 1 month ago (2015-10-30 06:53:14 UTC) #5
Alexander Potapenko
+dvyukov for the lock-free stuff.
5 years, 1 month ago (2015-10-30 06:53:55 UTC) #7
pasko
The implementation is certainly interesting. I am worried of wasting time reviewing it, so I ...
5 years, 1 month ago (2015-10-30 11:58:05 UTC) #8
bcwhite
> I think this code is over-complicated by the seemingly unnecessary corruption > checks. Can ...
5 years, 1 month ago (2015-10-30 12:40:26 UTC) #9
bcwhite
https://codereview.chromium.org/1410213004/diff/20001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/20001/base/memory/shared_memory_allocator.cc#newcode276 base/memory/shared_memory_allocator.cc:276: corrupted_ = true; On 2015/10/30 06:53:13, Alexander Potapenko wrote: ...
5 years, 1 month ago (2015-10-30 14:01:10 UTC) #10
chrisha
https://codereview.chromium.org/1410213004/diff/1/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/1/base/memory/shared_memory_allocator.cc#newcode13 base/memory/shared_memory_allocator.cc:13: #define ALLOC_ALIGNMENT 16 On 2015/10/29 23:40:57, bcwhite wrote: > ...
5 years, 1 month ago (2015-10-30 14:36:47 UTC) #11
chrisha
Okay, after offline discussions: I'm okay with the "alloc" and "commit" phase (ie: MakeIterable). Maybe ...
5 years, 1 month ago (2015-10-30 15:06:10 UTC) #12
chrisha
https://codereview.chromium.org/1410213004/diff/60001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/60001/base/memory/shared_memory_allocator.cc#newcode43 base/memory/shared_memory_allocator.cc:43: int32_t cookie; // constant value indicating completed allocation On ...
5 years, 1 month ago (2015-10-30 15:11:54 UTC) #13
bcwhite
https://codereview.chromium.org/1410213004/diff/1/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/1/base/memory/shared_memory_allocator.cc#newcode13 base/memory/shared_memory_allocator.cc:13: #define ALLOC_ALIGNMENT 16 On 2015/10/30 14:36:46, chrisha wrote: > ...
5 years, 1 month ago (2015-10-30 15:15:35 UTC) #14
bcwhite
https://codereview.chromium.org/1410213004/diff/80001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/80001/base/memory/shared_memory_allocator.cc#newcode93 base/memory/shared_memory_allocator.cc:93: // being initialized. It's unshared and single-threaded... On 2015/10/30 ...
5 years, 1 month ago (2015-10-30 17:27:39 UTC) #15
Alexander Potapenko
Before proceeding with the review I'd love to make several important points. 1. There is ...
5 years, 1 month ago (2015-10-30 19:06:39 UTC) #16
Alexander Potapenko
Before proceeding with the review I'd love to make several important points. 1. There is ...
5 years, 1 month ago (2015-10-30 19:06:42 UTC) #17
Alexander Potapenko
I still have a strong belief that the corruption checks should be less invasive. How ...
5 years, 1 month ago (2015-10-30 19:22:47 UTC) #18
bcwhite
> 1. There is no such thing as "non-harmful data race". This is undefined behavior ...
5 years, 1 month ago (2015-10-30 19:27:16 UTC) #19
Alexander Potapenko
On 2015/10/30 19:27:16, bcwhite wrote: > > 1. There is no such thing as "non-harmful ...
5 years, 1 month ago (2015-10-30 20:23:05 UTC) #20
bcwhite
> I am sorry, but it is not acceptable. The data races I am talking ...
5 years, 1 month ago (2015-10-30 20:32:02 UTC) #21
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/160001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/160001/base/memory/shared_memory_allocator.cc#newcode269 base/memory/shared_memory_allocator.cc:269: if (tail == subtle::Release_Load(&shared_meta_->tailptr)) { > Why? It ensures ...
5 years, 1 month ago (2015-10-30 20:43:20 UTC) #22
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/160001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/160001/base/memory/shared_memory_allocator.cc#newcode264 base/memory/shared_memory_allocator.cc:264: // Ensure that the tail pointer didn't change while ...
5 years, 1 month ago (2015-10-30 21:01:15 UTC) #23
bcwhite
> > Absolutely. But if there are no read-modify-write operations and the only > value ...
5 years, 1 month ago (2015-10-31 22:28:48 UTC) #24
chrisha
You could use bitfields or chars. Then you could use an atomic 32-bit read, update ...
5 years, 1 month ago (2015-10-31 22:33:28 UTC) #25
pasko
On 2015/10/31 22:28:48, bcwhite wrote: > > C++ Standard, 1.10.21: > > ===================== > > ...
5 years, 1 month ago (2015-11-01 11:16:18 UTC) #26
Alexander Potapenko
On 2015/10/31 22:28:48, bcwhite wrote: > > > Absolutely. But if there are no read-modify-write ...
5 years, 1 month ago (2015-11-01 14:43:33 UTC) #27
bcwhite
> > The base/atomicops has only > > 32-bit and 64-bit atomics. Is it okay ...
5 years, 1 month ago (2015-11-02 15:18:33 UTC) #28
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/180001/base/atomicops_unittest.cc File base/atomicops_unittest.cc (right): https://codereview.chromium.org/1410213004/diff/180001/base/atomicops_unittest.cc#newcode92 base/atomicops_unittest.cc:92: AtomicType fail = base::subtle::NoBarrier_CompareAndSwap(&value, 0, 2); I suggest you ...
5 years, 1 month ago (2015-11-02 19:40:53 UTC) #29
bcwhite
On 2015/11/02 19:40:53, Alexander Potapenko wrote: > https://codereview.chromium.org/1410213004/diff/180001/base/atomicops_unittest.cc > File base/atomicops_unittest.cc (right): > > https://codereview.chromium.org/1410213004/diff/180001/base/atomicops_unittest.cc#newcode92 ...
5 years, 1 month ago (2015-11-02 20:28:05 UTC) #30
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc#newcode49 base/memory/shared_memory_allocator.cc:49: base::subtle::Atomic32 loaded_flags = base::subtle::NoBarrier_Load(flags); It's not immediately evident whether ...
5 years, 1 month ago (2015-11-03 08:12:54 UTC) #31
Alexander Potapenko
5 years, 1 month ago (2015-11-03 08:12:55 UTC) #32
Dmitry Vyukov
https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc#newcode20 base/memory/shared_memory_allocator.cc:20: // It shouldn't be less than 8 so that ...
5 years, 1 month ago (2015-11-03 14:06:46 UTC) #34
bcwhite
addressed review comments by Alexander and Dmitry
5 years, 1 month ago (2015-11-03 16:27:12 UTC) #35
bcwhite
https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc#newcode20 base/memory/shared_memory_allocator.cc:20: // It shouldn't be less than 8 so that ...
5 years, 1 month ago (2015-11-03 16:28:20 UTC) #36
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc#newcode272 base/memory/shared_memory_allocator.cc:272: subtle::NoBarrier_Store(&block->next, OFFSET_QUEUE); // will be tail block On 2015/11/03 ...
5 years, 1 month ago (2015-11-03 17:25:16 UTC) #37
bcwhite
On 2015/11/03 17:25:16, Alexander Potapenko wrote: > https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc > File base/memory/shared_memory_allocator.cc (right): > > https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc#newcode272 ...
5 years, 1 month ago (2015-11-03 17:29:40 UTC) #38
Alexander Potapenko
On 2015/11/03 17:29:40, bcwhite wrote: > On 2015/11/03 17:25:16, Alexander Potapenko wrote: > > > ...
5 years, 1 month ago (2015-11-03 17:32:13 UTC) #39
bcwhite
On 2015/11/03 17:32:13, Alexander Potapenko wrote: > On 2015/11/03 17:29:40, bcwhite wrote: > > On ...
5 years, 1 month ago (2015-11-03 17:47:42 UTC) #40
Dmitry Vyukov
https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/180001/base/memory/shared_memory_allocator.cc#newcode272 base/memory/shared_memory_allocator.cc:272: subtle::NoBarrier_Store(&block->next, OFFSET_QUEUE); // will be tail block On 2015/11/03 ...
5 years, 1 month ago (2015-11-03 18:15:07 UTC) #41
chrisha
Another round of comments on the API. https://codereview.chromium.org/1410213004/diff/220001/base/memory/shared_memory_allocator.h File base/memory/shared_memory_allocator.h (right): https://codereview.chromium.org/1410213004/diff/220001/base/memory/shared_memory_allocator.h#newcode50 base/memory/shared_memory_allocator.h:50: }; Each ...
5 years, 1 month ago (2015-11-03 18:20:51 UTC) #42
bcwhite
> > > Why don't you use a lock-free stack? > > > The stack ...
5 years, 1 month ago (2015-11-03 18:30:55 UTC) #43
chrisha
https://codereview.chromium.org/1410213004/diff/240001/base/memory/shared_memory_allocator.h File base/memory/shared_memory_allocator.h (right): https://codereview.chromium.org/1410213004/diff/240001/base/memory/shared_memory_allocator.h#newcode54 base/memory/shared_memory_allocator.h:54: enum { Use a typed enum: enum : int32_t ...
5 years, 1 month ago (2015-11-03 21:25:25 UTC) #44
bcwhite
https://codereview.chromium.org/1410213004/diff/220001/base/memory/shared_memory_allocator.h File base/memory/shared_memory_allocator.h (right): https://codereview.chromium.org/1410213004/diff/220001/base/memory/shared_memory_allocator.h#newcode50 base/memory/shared_memory_allocator.h:50: }; On 2015/11/03 18:20:51, chrisha wrote: > Each of ...
5 years, 1 month ago (2015-11-03 22:32:17 UTC) #45
Dmitry Vyukov
https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc#newcode174 base/memory/shared_memory_allocator.cc:174: if (size < 0) { check that size != ...
5 years, 1 month ago (2015-11-04 13:52:29 UTC) #46
bcwhite
https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc#newcode174 base/memory/shared_memory_allocator.cc:174: if (size < 0) { On 2015/11/04 13:52:29, Dmitry ...
5 years, 1 month ago (2015-11-04 17:18:55 UTC) #47
Dmitry Vyukov
https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc#newcode212 base/memory/shared_memory_allocator.cc:212: if (size > page_free) { On 2015/11/04 17:18:55, bcwhite ...
5 years, 1 month ago (2015-11-04 17:33:08 UTC) #48
bcwhite
https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc#newcode212 base/memory/shared_memory_allocator.cc:212: if (size > page_free) { > > I want ...
5 years, 1 month ago (2015-11-04 18:40:17 UTC) #49
Dmitry Vyukov
https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc#newcode192 base/memory/shared_memory_allocator.cc:192: int32_t freeptr = subtle::Acquire_Load(&shared_meta_->freeptr); On 2015/11/04 17:18:55, bcwhite wrote: ...
5 years, 1 month ago (2015-11-05 10:49:42 UTC) #50
bcwhite
https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc#newcode192 base/memory/shared_memory_allocator.cc:192: int32_t freeptr = subtle::Acquire_Load(&shared_meta_->freeptr); > > > What do ...
5 years, 1 month ago (2015-11-05 14:37:15 UTC) #51
Dmitry Vyukov
https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc#newcode192 base/memory/shared_memory_allocator.cc:192: int32_t freeptr = subtle::Acquire_Load(&shared_meta_->freeptr); On 2015/11/05 14:37:15, bcwhite wrote: ...
5 years, 1 month ago (2015-11-05 16:38:13 UTC) #52
Dmitry Vyukov
I don't see any issues in the code, so LGTM.
5 years, 1 month ago (2015-11-05 16:39:00 UTC) #53
bcwhite
https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc#newcode192 base/memory/shared_memory_allocator.cc:192: int32_t freeptr = subtle::Acquire_Load(&shared_meta_->freeptr); > > If so, then... ...
5 years, 1 month ago (2015-11-05 17:06:30 UTC) #54
Alexander Potapenko
> Nice. I don't see any flaws in it. The parallel test hasn't crashed or ...
5 years, 1 month ago (2015-11-05 17:15:46 UTC) #55
Dmitry Vyukov
On 2015/11/05 17:06:30, bcwhite wrote: > https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc > File base/memory/shared_memory_allocator.cc (right): > > https://codereview.chromium.org/1410213004/diff/260001/base/memory/shared_memory_allocator.cc#newcode192 > ...
5 years, 1 month ago (2015-11-05 17:19:06 UTC) #56
bcwhite
Chris, any further comments?
5 years, 1 month ago (2015-11-09 15:52:10 UTC) #57
chrisha
A few more comments, mostly nits. Also, do we want to house this in base/metrics, ...
5 years, 1 month ago (2015-11-09 16:53:51 UTC) #58
bcwhite
https://codereview.chromium.org/1410213004/diff/450001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/450001/base/memory/shared_memory_allocator.cc#newcode56 base/memory/shared_memory_allocator.cc:56: enum { On 2015/11/09 16:53:51, chrisha wrote: > You ...
5 years, 1 month ago (2015-11-09 18:02:05 UTC) #59
Alexander Potapenko
Looks mostly good. https://codereview.chromium.org/1410213004/diff/450001/base/memory/shared_memory_allocator.h File base/memory/shared_memory_allocator.h (right): https://codereview.chromium.org/1410213004/diff/450001/base/memory/shared_memory_allocator.h#newcode19 base/memory/shared_memory_allocator.h:19: // This class provides for thread-secure ...
5 years, 1 month ago (2015-11-09 18:03:46 UTC) #60
Alexander Potapenko
Looks mostly good.
5 years, 1 month ago (2015-11-09 18:03:49 UTC) #61
pasko
I cannot approve this until I get an answer to this question: why is this ...
5 years, 1 month ago (2015-11-09 18:15:22 UTC) #62
bcwhite
On 2015/11/09 18:15:22, pasko wrote: > I cannot approve this until I get an answer ...
5 years, 1 month ago (2015-11-09 19:20:58 UTC) #63
bcwhite
https://codereview.chromium.org/1410213004/diff/450001/base/memory/shared_memory_allocator.h File base/memory/shared_memory_allocator.h (right): https://codereview.chromium.org/1410213004/diff/450001/base/memory/shared_memory_allocator.h#newcode19 base/memory/shared_memory_allocator.h:19: // This class provides for thread-secure (i.e. safe against ...
5 years, 1 month ago (2015-11-09 19:21:16 UTC) #64
pasko
Thank you for the background, Brian. That's very helpful. On 2015/11/09 19:20:58, bcwhite wrote: > ...
5 years, 1 month ago (2015-11-10 13:18:19 UTC) #65
bcwhite
> > > why is this complexity in the security boundary preferable to registering a ...
5 years, 1 month ago (2015-11-10 13:56:17 UTC) #66
pasko
OK, thanks for responses. Given the goal of "easy" creation of UMA regions in various ...
5 years, 1 month ago (2015-11-10 17:24:28 UTC) #67
mdempsky
(I'm going to assume others have checked the algorithm for correctness in non-malicious scenarios, so ...
5 years, 1 month ago (2015-11-10 19:47:56 UTC) #69
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/470001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/470001/base/memory/shared_memory_allocator.cc#newcode438 base/memory/shared_memory_allocator.cc:438: if (block->size < size) On 2015/11/10 19:47:55, mdempsky wrote: ...
5 years, 1 month ago (2015-11-10 20:47:10 UTC) #70
bcwhite
https://codereview.chromium.org/1410213004/diff/470001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/470001/base/memory/shared_memory_allocator.cc#newcode16 base/memory/shared_memory_allocator.cc:16: // is far simpler than the alternative. On 2015/11/10 ...
5 years, 1 month ago (2015-11-10 21:17:35 UTC) #71
mdempsky
https://codereview.chromium.org/1410213004/diff/470001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/470001/base/memory/shared_memory_allocator.cc#newcode16 base/memory/shared_memory_allocator.cc:16: // is far simpler than the alternative. On 2015/11/10 ...
5 years, 1 month ago (2015-11-10 22:45:52 UTC) #72
bcwhite
https://codereview.chromium.org/1410213004/diff/470001/base/memory/shared_memory_allocator.cc File base/memory/shared_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/470001/base/memory/shared_memory_allocator.cc#newcode112 base/memory/shared_memory_allocator.cc:112: // This can't be a constant because SharedMetadata is ...
5 years, 1 month ago (2015-11-11 13:25:14 UTC) #73
bcwhite
FYI: I'm going to rename this to PersistentMemoryAllocator to reflect that data within it is ...
5 years, 1 month ago (2015-11-12 22:55:06 UTC) #74
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/530001/base/memory/persistent_memory_allocator.cc File base/memory/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/530001/base/memory/persistent_memory_allocator.cc#newcode234 base/memory/persistent_memory_allocator.cc:234: int32_t size = static_cast<int32_t>(usize + sizeof(BlockHeader)); Can "usize + ...
5 years, 1 month ago (2015-11-16 16:01:52 UTC) #76
bcwhite
https://codereview.chromium.org/1410213004/diff/530001/base/memory/persistent_memory_allocator.cc File base/memory/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/530001/base/memory/persistent_memory_allocator.cc#newcode234 base/memory/persistent_memory_allocator.cc:234: int32_t size = static_cast<int32_t>(usize + sizeof(BlockHeader)); On 2015/11/16 16:01:51, ...
5 years, 1 month ago (2015-11-17 01:35:08 UTC) #77
bcwhite
https://codereview.chromium.org/1410213004/diff/530001/base/memory/persistent_memory_allocator.cc File base/memory/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/530001/base/memory/persistent_memory_allocator.cc#newcode234 base/memory/persistent_memory_allocator.cc:234: int32_t size = static_cast<int32_t>(usize + sizeof(BlockHeader)); On 2015/11/17 01:35:08, ...
5 years, 1 month ago (2015-11-17 02:39:26 UTC) #78
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/530001/base/memory/persistent_memory_allocator.cc File base/memory/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/530001/base/memory/persistent_memory_allocator.cc#newcode234 base/memory/persistent_memory_allocator.cc:234: int32_t size = static_cast<int32_t>(usize + sizeof(BlockHeader)); On 2015/11/17 02:39:26, ...
5 years, 1 month ago (2015-11-17 10:39:16 UTC) #79
bcwhite
> > > > Can "usize + sizeof(BlockHeader)" overflow int32_t? > > > > > ...
5 years, 1 month ago (2015-11-17 13:40:10 UTC) #80
Alexander Potapenko
On 2015/11/17 13:40:10, bcwhite wrote: > > > > > Can "usize + sizeof(BlockHeader)" overflow ...
5 years, 1 month ago (2015-11-18 11:07:35 UTC) #81
bcwhite
> > This should protect against that, then: > > > > // Round up ...
5 years, 1 month ago (2015-11-18 13:46:49 UTC) #82
Alexander Potapenko
Sorry, looks like I've misunderstood the code. The following line: int32_t size = static_cast<int32_t>(usize + ...
5 years, 1 month ago (2015-11-18 14:40:29 UTC) #83
bcwhite
> Sorry, looks like I've misunderstood the code. > > The following line: > int32_t ...
5 years, 1 month ago (2015-11-18 15:13:24 UTC) #84
JF
(post-vacation review as requested) I haven't looked in-depth yet, but two things come to mind: ...
5 years, 1 month ago (2015-11-20 17:25:33 UTC) #86
bcwhite
> (1) Could you instead use std::atomic? thakis said elsewhere that he thinks we > ...
5 years, 1 month ago (2015-11-20 18:15:10 UTC) #87
JF
On 2015/11/20 18:15:10, bcwhite wrote: > > (1) Could you instead use std::atomic? thakis said ...
5 years, 1 month ago (2015-11-20 18:45:13 UTC) #88
Nico
On 2015/11/20 18:45:13, JF wrote: > On 2015/11/20 18:15:10, bcwhite wrote: > > > (1) ...
5 years, 1 month ago (2015-11-20 18:56:32 UTC) #89
bcwhite
> Comment 27 says "almost ready", and that time is now. See thread "C++11 library ...
5 years, 1 month ago (2015-11-20 20:02:43 UTC) #90
JF
https://codereview.chromium.org/1410213004/diff/570001/base/memory/persistent_memory_allocator.cc File base/memory/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/570001/base/memory/persistent_memory_allocator.cc#newcode464 base/memory/persistent_memory_allocator.cc:464: CHECK(corrupt_.is_lock_free()); It would be useful to explain why this ...
5 years, 1 month ago (2015-11-20 20:43:31 UTC) #91
bcwhite
https://codereview.chromium.org/1410213004/diff/570001/base/memory/persistent_memory_allocator.h File base/memory/persistent_memory_allocator.h (right): https://codereview.chromium.org/1410213004/diff/570001/base/memory/persistent_memory_allocator.h#newcode107 base/memory/persistent_memory_allocator.h:107: reinterpret_cast<volatile T*>(GetBlockData(ref, type_id, sizeof(T)))); On 2015/11/20 20:43:31, JF wrote: ...
5 years, 1 month ago (2015-11-20 21:57:05 UTC) #92
bcwhite
> volatile doesn't provide no-tear guarantees, nor write ordering guarantees. It > merely tells the ...
5 years, 1 month ago (2015-11-20 22:01:26 UTC) #93
bcwhite
Dmitry, sorry to trouble you again but would you look over this change to std::atomic ...
5 years ago (2015-11-23 16:48:22 UTC) #94
JF
On 2015/11/20 22:01:26, bcwhite wrote: > > volatile doesn't provide no-tear guarantees, nor write ordering ...
5 years ago (2015-11-24 01:34:59 UTC) #98
bcwhite
thakis@chromium.org: Please review changes in base/* The algorithm has been vetted; now I need permission ...
5 years ago (2015-12-03 14:32:15 UTC) #100
Dmitry Vyukov
LGTM with nits https://codereview.chromium.org/1410213004/diff/710001/base/memory/persistent_memory_allocator.cc File base/memory/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/710001/base/memory/persistent_memory_allocator.cc#newcode288 base/memory/persistent_memory_allocator.cc:288: // -sizeof(header) so accouting for that ...
5 years ago (2015-12-03 20:51:37 UTC) #101
bcwhite
https://codereview.chromium.org/1410213004/diff/710001/base/memory/persistent_memory_allocator.cc File base/memory/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/710001/base/memory/persistent_memory_allocator.cc#newcode288 base/memory/persistent_memory_allocator.cc:288: // -sizeof(header) so accouting for that will yield an ...
5 years ago (2015-12-03 21:53:42 UTC) #102
bcwhite
thakis@chromium.org: Please review changes in base/* The algorithm has been vetted; now I need permission ...
5 years ago (2015-12-11 04:48:09 UTC) #104
Nico
Yes, if this is for base/metrics it should be in base/metrics for now. (+primiano for ...
5 years ago (2015-12-15 20:17:44 UTC) #110
Primiano Tucci (use gerrit)
On 2015/12/15 20:17:44, Nico wrote: > Yes, if this is for base/metrics it should be ...
5 years ago (2015-12-15 20:47:33 UTC) #111
bcwhite
Moved to base/metrics. crbug/750004 updated with more information, including original design-doc.
5 years ago (2015-12-16 13:14:33 UTC) #112
bcwhite
Happy New Year! 2 months, 10 reviewers, 42 revisions ... and counting :-) Primiano, would ...
4 years, 11 months ago (2016-01-07 20:11:56 UTC) #115
Primiano Tucci (use gerrit)
On 2016/01/07 20:11:56, bcwhite wrote: > Primiano, would you take a look at this when ...
4 years, 11 months ago (2016-01-11 11:16:22 UTC) #116
bcwhite
On 2016/01/11 11:16:22, Primiano Tucci wrote: > On 2016/01/07 20:11:56, bcwhite wrote: > > Primiano, ...
4 years, 11 months ago (2016-01-11 13:37:32 UTC) #117
Nico
lgtm!
4 years, 11 months ago (2016-01-12 03:02:14 UTC) #118
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1410213004/990001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1410213004/990001
4 years, 11 months ago (2016-01-13 16:34:53 UTC) #121
Alexei Svitkine (slow)
Sorry, I just want to clarify whether this was thoroughly reviewed by a Chromium committer. ...
4 years, 11 months ago (2016-01-13 16:50:38 UTC) #123
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/990001/base/metrics/persistent_memory_allocator.cc File base/metrics/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/990001/base/metrics/persistent_memory_allocator.cc#newcode150 base/metrics/persistent_memory_allocator.cc:150: CHECK(((SharedMetadata*)0)->freeptr.is_lock_free()); Sorry, are you dereferencing a NULL pointer here? ...
4 years, 11 months ago (2016-01-13 18:34:01 UTC) #124
bcwhite
https://codereview.chromium.org/1410213004/diff/990001/base/metrics/persistent_memory_allocator.cc File base/metrics/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/990001/base/metrics/persistent_memory_allocator.cc#newcode150 base/metrics/persistent_memory_allocator.cc:150: CHECK(((SharedMetadata*)0)->freeptr.is_lock_free()); On 2016/01/13 18:34:00, Alexander Potapenko wrote: > Sorry, ...
4 years, 11 months ago (2016-01-13 21:31:39 UTC) #125
Alexander Potapenko
https://codereview.chromium.org/1410213004/diff/990001/base/metrics/persistent_memory_allocator.cc File base/metrics/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/990001/base/metrics/persistent_memory_allocator.cc#newcode313 base/metrics/persistent_memory_allocator.cc:313: uint32_t type_id) { OOC: did clang-format put the arguments ...
4 years, 11 months ago (2016-01-14 10:54:17 UTC) #126
chrisha
Still looking at the .cc file, but some comments for now... https://codereview.chromium.org/1410213004/diff/1030001/base/metrics/persistent_memory_allocator.h File base/metrics/persistent_memory_allocator.h (right): ...
4 years, 11 months ago (2016-01-18 22:40:28 UTC) #127
chrisha
https://codereview.chromium.org/1410213004/diff/1030001/base/metrics/persistent_memory_allocator.cc File base/metrics/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/1030001/base/metrics/persistent_memory_allocator.cc#newcode47 base/metrics/persistent_memory_allocator.cc:47: const uint32_t kBlockCookieAllocated = 0xC8799269; Worth putting these values ...
4 years, 11 months ago (2016-01-19 16:37:41 UTC) #128
bcwhite
https://codereview.chromium.org/1410213004/diff/990001/base/metrics/persistent_memory_allocator_unittest.cc File base/metrics/persistent_memory_allocator_unittest.cc (right): https://codereview.chromium.org/1410213004/diff/990001/base/metrics/persistent_memory_allocator_unittest.cc#newcode1 base/metrics/persistent_memory_allocator_unittest.cc:1: // Copyright 2015 The Chromium Authors. All rights reserved. ...
4 years, 11 months ago (2016-01-19 19:49:41 UTC) #129
chrisha
Okay, this lgtm now! Odyssey nearly over? :)
4 years, 11 months ago (2016-01-19 20:21:25 UTC) #130
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1410213004/1050001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1410213004/1050001
4 years, 11 months ago (2016-01-20 12:56:28 UTC) #133
commit-bot: I haz the power
Committed patchset #45 (id:1050001)
4 years, 11 months ago (2016-01-20 13:44:54 UTC) #135
commit-bot: I haz the power
Patchset 45 (id:??) landed as https://crrev.com/34ae4983d4a24f5136bf8fda7b618842920962b0 Cr-Commit-Position: refs/heads/master@{#370377}
4 years, 11 months ago (2016-01-20 13:46:07 UTC) #137
Alexander Potapenko
LGTM https://codereview.chromium.org/1410213004/diff/1030001/base/metrics/persistent_memory_allocator.cc File base/metrics/persistent_memory_allocator.cc (right): https://codereview.chromium.org/1410213004/diff/1030001/base/metrics/persistent_memory_allocator.cc#newcode97 base/metrics/persistent_memory_allocator.cc:97: uint32_t _padding_; // Padding to match required allocation ...
4 years, 11 months ago (2016-01-20 14:13:43 UTC) #138
Nico
Looks like one of the tests added by this fails on the 32-bit clang/win bots: ...
4 years, 11 months ago (2016-01-20 20:09:42 UTC) #139
Alexander Potapenko
On 2016/01/20 20:09:42, Nico wrote: > Looks like one of the tests added by this ...
4 years, 11 months ago (2016-01-20 20:56:27 UTC) #140
benwells
Is it expected that PersistentMemoryAllocatorTest.CorruptionTest would introduce data races picked up by TSAN? See https://build.chromium.org/p/chromium.memory.fyi/builders/Linux%20TSan%20Tests/builds/16058/steps/base_unittests/logs/PersistentMemoryAllocatorTest.CorruptionTest ...
4 years, 11 months ago (2016-01-21 06:59:11 UTC) #142
Alexander Potapenko
On 2016/01/21 06:59:11, benwells wrote: > Is it expected that PersistentMemoryAllocatorTest.CorruptionTest would introduce > data ...
4 years, 11 months ago (2016-01-21 11:40:52 UTC) #143
bcwhite
On 2016/01/21 11:40:52, Alexander Potapenko wrote: > On 2016/01/21 06:59:11, benwells wrote: > > Is ...
4 years, 11 months ago (2016-01-21 11:44:20 UTC) #144
bcwhite
On 2016/01/21 11:44:20, bcwhite wrote: > On 2016/01/21 11:40:52, Alexander Potapenko wrote: > > On ...
4 years, 11 months ago (2016-01-21 18:37:51 UTC) #145
Alexander Potapenko
On 2016/01/21 18:37:51, bcwhite wrote: > On 2016/01/21 11:44:20, bcwhite wrote: > > On 2016/01/21 ...
4 years, 11 months ago (2016-01-21 19:12:20 UTC) #146
bcwhite
On 2016/01/20 20:09:42, Nico wrote: > Looks like one of the tests added by this ...
4 years, 11 months ago (2016-01-21 19:54:31 UTC) #147
bcwhite
> > I don't think that is enough. The "corruptor" code is just doing random ...
4 years, 11 months ago (2016-01-21 20:15:01 UTC) #148
JF
On 2016/01/21 20:15:01, bcwhite wrote: > > > I don't think that is enough. The ...
4 years, 11 months ago (2016-01-21 20:22:59 UTC) #149
bcwhite
On 2016/01/21 20:15:01, bcwhite wrote: > > > I don't think that is enough. The ...
4 years, 11 months ago (2016-01-21 20:44:27 UTC) #150
Alexander Potapenko
On 2016/01/21 20:44:27, bcwhite wrote: > On 2016/01/21 20:15:01, bcwhite wrote: > > > > ...
4 years, 11 months ago (2016-01-21 21:19:50 UTC) #151
bcwhite
On 2016/01/21 21:19:50, Alexander Potapenko wrote: > On 2016/01/21 20:44:27, bcwhite wrote: > > On ...
4 years, 11 months ago (2016-01-22 00:17:16 UTC) #152
bcwhite
4 years, 11 months ago (2016-01-22 01:35:33 UTC) #153
Message was sent while issue was closed.
On 2016/01/22 00:17:16, bcwhite wrote:
> On 2016/01/21 21:19:50, Alexander Potapenko wrote:
> > On 2016/01/21 20:44:27, bcwhite wrote:
> > > On 2016/01/21 20:15:01, bcwhite wrote:
> > > > > > I don't think that is enough.  The "corruptor" code is just doing
> random
> > > > > writes
> > > > > > while valid code is sometimes doing atomic read/write and sometimes
> > doing
> > > > > > regular read/write (because it knows that there should be nothing
> > > operating
> > > > in
> > > > > > parallel on those memory locations).  If I make the corruptor do
> atomic
> > > > > writes,
> > > > > > won't that still cause a TSan error when valid code is doing
> non-atomic
> > > > work?
> > > > > > 
> > > > > > If that is the case...  Perhaps I can just disable that particular
> test
> > > > during
> > > > > > the TSan test?
> > > > > 
> > > > > Agreed, relaxed loads aren't enough.
> > > > > Why do you need this test to be parallel in the first place?
> > > > 
> > > > It was just a simple simulation of a parallel system with a malicious
> actor.
> > 
> > > I
> > > > could serialize it, I guess, and achieve pretty much the same results.
> > > > 
> > > > No way to just disable it under TSan?
> > > 
> > > Could I just surround the "corrupt" write with
> > ANNOTATE_IGNORE_WRITES_BEGIN/END?
> > 
> > Please don't use ANNOTATE_XXX, those are deprecated.
> > 
> > Perhaps just disabling the test under TSan is ok, as the test is performing
> > races on purpose.
> 
> Sure.  The question is, how to disable them only on TSan...

Fixed: https://codereview.chromium.org/1611393003

Powered by Google App Engine
This is Rietveld 408576698