Bug 28926 - Should crash if JIT code buffer allocation fails.
Summary: Should crash if JIT code buffer allocation fails.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-02 17:06 PDT by Gavin Barraclough
Modified: 2009-09-02 17:33 PDT (History)
0 users

See Also:


Attachments
The patch (2.27 KB, patch)
2009-09-02 17:08 PDT, Gavin Barraclough
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Barraclough 2009-09-02 17:06:37 PDT
<rdar://problem/7031922>
Comment 1 Gavin Barraclough 2009-09-02 17:08:02 PDT
Created attachment 38948 [details]
The patch
Comment 2 Sam Weinig 2009-09-02 17:10:57 PDT
Comment on attachment 38948 [details]
The patch

> Index: JavaScriptCore/jit/ExecutableAllocatorPosix.cpp
> ===================================================================
> --- JavaScriptCore/jit/ExecutableAllocatorPosix.cpp	(revision 47901)
> +++ JavaScriptCore/jit/ExecutableAllocatorPosix.cpp	(working copy)
> @@ -44,7 +44,10 @@ void ExecutableAllocator::intializePageS
>  
>  ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
>  {
> -    ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0)), n };
> +    void* allocation = mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0);
> +    if (allocation == (void*)-1)
Can we use the MAP_FAILED constant here?

Otherwise, r=me
Comment 3 Gavin Barraclough 2009-09-02 17:33:40 PDT
Sending        JavaScriptCore/ChangeLog
Sending        JavaScriptCore/jit/ExecutableAllocatorPosix.cpp
Sending        JavaScriptCore/jit/ExecutableAllocatorWin.cpp
Transmitting file data ...
Committed revision 48000.