New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 634011 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Android should have a 2GB malloc() check like Win and Linux to mitigate memory management bugs

Project Member Reported by primiano@chromium.org, Aug 3 2016

Issue description

This is the Android follow-up of  Issue 169327 .

A bit of historical evolution of things:
In  Issue 169327  security folks figured out that we should prevent >2GB allocations to prevent memory bugs due to sign vs unsigned / sign extensions bugs.
This is happening today on Win and Linux.
On Windows: this check is done in the shim layer (which siggi@ is migrating to the new unified shim)
On Linux: this check is baked into tcmalloc.cc (See  IsAllocSizePermitted in tcmalloc.cc)

Historically on Android we never had a way to hook malloc() calls. Until very recently we didn't have even a way to invoke the new handler when malloc() fails because of OOM.
The latter is being fixed by the work on the unified allocator shim (see Issue 550886) and later follow up in crrev.com/2201363002.

Now that we have a shim, we could afford this check also on Android.
If nobody has objections I'd volunteer for doing this.

From a practical viewpoint, the best place to make this happen is the allocator_shim.cc
This requires a bit of refactoring which overlaps with siggi's work on migrating the windows shim to the unified allocator_shim.cc (otherwise win could end up having the same check twice in the malloc path, which is undesirable).
Once that sticks (https://codereview.chromium.org/2183093002/ did that but got recently reverted) I'll get on this if there are no other objections.
 
Status: Assigned (was: Untriaged)

Sign in to add a comment