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

Issue 2201363002: android: Enable death on malloc/operator new failure. (Closed)

Created:
4 years, 4 months ago by Primiano Tucci (use gerrit)
Modified:
4 years, 4 months ago
Reviewers:
Nico, Torne, Will Harris
CC:
chromium-reviews, Robert Sesek
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

android: Enable death on malloc/operator new failure. 1. Historically the OnNoMemory suicide on malloc/new failure was not enabled on Android. This seems to be due to the fact that set_new_handler was not avilable on Android back in the days of pre-libcxx. See crbug.com/317791 . 2. After the libcxx switch, however, the combination of operator new throwing bad_alloc and chrome building with -fno-exception made operator new (but not malloc) inadvertently suicidal, by virtue of ending up calling the default exception handler. See crbug.com/633313#c28 . 3. crrev.com/1883093005 (first seen in M52) introduced a shim layer wrapping malloc and operator new, which was intending, among the various things, to make malloc / new finally secure on Android. This good intend, however, failed to materialize because the set_new_handler call in memory_linux.cc was still #ifdef-ed out on Android. Similarly the memory_unittests.cc were excluded on Android for the same reason (Android was deemed to not possibly be secure since 1.). In summary here's what went wrong: - When we switched to libcxx, nobody realized that we could have finally taken advantage of set_new_handler. - When I enabled the android shim I didn't realize about the missing set_new_handler call. I was assuming that the memory tests would have screamed red if I did something wrong, but I didn't realize that they were disabled on Android. This CL fixes all this, enabling set_new_handler on Android and enabling the tests. Note also that this CL is just about inducing a hard crash on malloc failure. This does not change the situation about disallowing large allocations (>2GB) that might cause int signed/unsigned bugs (see crbug.com/169327). As things stand today, Android never had that check and still doesn't yet after this CL. BUG=633966, 317791 TEST=base_unittests --gtest_filter=OutOfMemory* Committed: https://crrev.com/227dbd3dc564004471f146ef655fad35c52704c3 Cr-Commit-Position: refs/heads/master@{#409531}

Patch Set 1 #

Total comments: 1

Patch Set 2 : Remove death test blacklist on Android #

Patch Set 3 : Disable 2GB tests on Android though, they pass just because VM space is fragmented on 32 bit devices #

Total comments: 4

Patch Set 4 : fix comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+9 lines, -24 lines) Patch
M base/process/memory_linux.cc View 3 chunks +0 lines, -7 lines 0 comments Download
M base/process/memory_unittest.cc View 1 2 3 5 chunks +9 lines, -15 lines 0 comments Download
M build/android/pylib/gtest/filter/base_unittests_disabled View 1 1 chunk +0 lines, -2 lines 0 comments Download

Messages

Total messages: 39 (24 generated)
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2201363002/diff/1/base/process/memory_unittest.cc File base/process/memory_unittest.cc (left): https://codereview.chromium.org/2201363002/diff/1/base/process/memory_unittest.cc#oldcode418 base/process/memory_unittest.cc:418: #if !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) This #if is redundant as the entire ...
4 years, 4 months ago (2016-08-03 11:30:14 UTC) #6
Torne
LGTM, thanks!
4 years, 4 months ago (2016-08-03 11:34:00 UTC) #7
Primiano Tucci (use gerrit)
actually +thakis as this is in //base/process
4 years, 4 months ago (2016-08-03 12:24:06 UTC) #9
Primiano Tucci (use gerrit)
On 2016/08/03 12:24:06, Primiano Tucci wrote: > actually +thakis as this is in //base/process Hold ...
4 years, 4 months ago (2016-08-03 12:35:37 UTC) #14
Primiano Tucci (use gerrit)
On 2016/08/03 12:35:37, Primiano Tucci wrote: > On 2016/08/03 12:24:06, Primiano Tucci wrote: > > ...
4 years, 4 months ago (2016-08-03 12:52:18 UTC) #15
Primiano Tucci (use gerrit)
Had a chat with jbudorick. death tests seem to work on Android. I think these ...
4 years, 4 months ago (2016-08-03 13:09:13 UTC) #18
Nico
lgtm https://codereview.chromium.org/2201363002/diff/40001/base/process/memory_unittest.cc File base/process/memory_unittest.cc (right): https://codereview.chromium.org/2201363002/diff/40001/base/process/memory_unittest.cc#newcode190 base/process/memory_unittest.cc:190: #if !defined(OS_MACOSX) && !defined(OS_ANDROID) Why ifdef out these ...
4 years, 4 months ago (2016-08-03 14:13:20 UTC) #21
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2201363002/diff/40001/base/process/memory_unittest.cc File base/process/memory_unittest.cc (right): https://codereview.chromium.org/2201363002/diff/40001/base/process/memory_unittest.cc#newcode190 base/process/memory_unittest.cc:190: #if !defined(OS_MACOSX) && !defined(OS_ANDROID) On 2016/08/03 14:13:20, Nico wrote: ...
4 years, 4 months ago (2016-08-03 15:04:48 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2201363002/60001
4 years, 4 months ago (2016-08-03 15:06:49 UTC) #28
Nico
https://codereview.chromium.org/2201363002/diff/40001/base/process/memory_unittest.cc File base/process/memory_unittest.cc (right): https://codereview.chromium.org/2201363002/diff/40001/base/process/memory_unittest.cc#newcode190 base/process/memory_unittest.cc:190: #if !defined(OS_MACOSX) && !defined(OS_ANDROID) On 2016/08/03 15:04:48, Primiano Tucci ...
4 years, 4 months ago (2016-08-03 15:06:52 UTC) #29
Torne
On 2016/08/03 15:04:48, Primiano Tucci wrote: > https://codereview.chromium.org/2201363002/diff/40001/base/process/memory_unittest.cc > File base/process/memory_unittest.cc (right): > > https://codereview.chromium.org/2201363002/diff/40001/base/process/memory_unittest.cc#newcode190 ...
4 years, 4 months ago (2016-08-03 15:08:59 UTC) #30
Primiano Tucci (use gerrit)
On 2016/08/03 15:08:59, Torne wrote: > Well, only because we only build/test 32-bit, right? If ...
4 years, 4 months ago (2016-08-03 15:21:45 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2201363002/60001
4 years, 4 months ago (2016-08-03 15:48:31 UTC) #35
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 4 months ago (2016-08-03 16:31:19 UTC) #37
commit-bot: I haz the power
4 years, 4 months ago (2016-08-03 16:33:30 UTC) #39
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/227dbd3dc564004471f146ef655fad35c52704c3
Cr-Commit-Position: refs/heads/master@{#409531}

Powered by Google App Engine
This is Rietveld 408576698