POSIX SharedMemory::Map leaves memory_ set to MAP_FAILED on error (and probably passes it to munmap)
Categories
(Core :: IPC, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: jld, Assigned: jld)
Details
Attachments
(1 file)
See also https://codereview.chromium.org/10174007, found while browing the history for the apparently nonstandard use of (void*)-1
instead of MAP_FAILED
. The error case leaves memory_
set to MAP_FAILED
, but other parts of the code check against null. This should be harmless in practice (we're not checking for errors from munmap
, which should fail without side effects in this case) but we ought to fix it.
Assignee | ||
Comment 1•5 years ago
|
||
I fixed this while writing unit tests for bug 1479960.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
If mmap failed, we'd leave the memory_ member variable set to MAP_FAILED,
but everything else in this file checks for nullptr (and only nullptr) to
test if the pointer is valid.
Also, this removes the debug assertion that the mmap succeeded, to allow
writing unit tests where we expect it to fail (e.g., for insufficient
permissions).
Depends on D26747
Comment 3•5 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:jld, could you have a look please?
Assignee | ||
Comment 4•5 years ago
|
||
This is part of a series of patches that's being held until the next merge cycle.
Pushed by jedavis@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a7c09894c6a0 Fix error handling in base::SharedMemory::Map. r=froydnj
Pushed by jedavis@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7172762c4b87 Fix error handling in base::SharedMemory::Map. r=froydnj
Comment 7•5 years ago
|
||
bugherder |
Comment 8•5 years ago
|
||
Backed out for toolchain bustages on UniquePtrExtensions.h
Backout link: https://hg.mozilla.org/integration/autoland/rev/56834c5fc9390da3bdfb41a3fe3f06119fbb3502
Push link: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&revision=a8518ea4b5944cd5563a882c27b304fc82d07dba&selectedJob=253975140
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=253975140&repo=autoland&lineNumber=922
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
Comment 10•5 years ago
|
||
Pushed by jedavis@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/86cb672b7000 Fix error handling in base::SharedMemory::Map. r=froydnj
Comment 11•5 years ago
|
||
bugherder |
Description
•