Title: [289351] branches/safari-613-branch/Source/bmalloc
Revision
289351
Author
[email protected]
Date
2022-02-07 18:58:17 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r289144. rdar://problem/88585404

    [libpas] allocation failure crash should be PAS_NEVER_INLINE
    https://bugs.webkit.org/show_bug.cgi?id=236164

    Reviewed by Saam Barati.

    We introduce pas_allocation_result_crash_on_error function which can leave OOM crash
    information in the crash log. To keep this non-inlined, we annotate it PAS_NEVER_INLINE.

    * libpas/src/libpas/pas_allocation_result.h:
    (pas_allocation_result_crash_on_error):
    * libpas/src/libpas/pas_utils.c:
    (pas_panic_on_out_of_memory_error):
    * libpas/src/libpas/pas_utils.h:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289144 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/bmalloc/ChangeLog (289350 => 289351)


--- branches/safari-613-branch/Source/bmalloc/ChangeLog	2022-02-08 02:58:14 UTC (rev 289350)
+++ branches/safari-613-branch/Source/bmalloc/ChangeLog	2022-02-08 02:58:17 UTC (rev 289351)
@@ -1,5 +1,41 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r289144. rdar://problem/88585404
+
+    [libpas] allocation failure crash should be PAS_NEVER_INLINE
+    https://bugs.webkit.org/show_bug.cgi?id=236164
+    
+    Reviewed by Saam Barati.
+    
+    We introduce pas_allocation_result_crash_on_error function which can leave OOM crash
+    information in the crash log. To keep this non-inlined, we annotate it PAS_NEVER_INLINE.
+    
+    * libpas/src/libpas/pas_allocation_result.h:
+    (pas_allocation_result_crash_on_error):
+    * libpas/src/libpas/pas_utils.c:
+    (pas_panic_on_out_of_memory_error):
+    * libpas/src/libpas/pas_utils.h:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289144 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-04  Yusuke Suzuki  <[email protected]>
+
+            [libpas] allocation failure crash should be PAS_NEVER_INLINE
+            https://bugs.webkit.org/show_bug.cgi?id=236164
+
+            Reviewed by Saam Barati.
+
+            We introduce pas_allocation_result_crash_on_error function which can leave OOM crash
+            information in the crash log. To keep this non-inlined, we annotate it PAS_NEVER_INLINE.
+
+            * libpas/src/libpas/pas_allocation_result.h:
+            (pas_allocation_result_crash_on_error):
+            * libpas/src/libpas/pas_utils.c:
+            (pas_panic_on_out_of_memory_error):
+            * libpas/src/libpas/pas_utils.h:
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288866. rdar://problem/88303899
 
     [libpas] get_num_free_bytes_for_each_heap_callback() is called with `arg` pointing to uninitialized stack memory

Modified: branches/safari-613-branch/Source/bmalloc/libpas/src/libpas/pas_allocation_result.h (289350 => 289351)


--- branches/safari-613-branch/Source/bmalloc/libpas/src/libpas/pas_allocation_result.h	2022-02-08 02:58:14 UTC (rev 289350)
+++ branches/safari-613-branch/Source/bmalloc/libpas/src/libpas/pas_allocation_result.h	2022-02-08 02:58:17 UTC (rev 289351)
@@ -102,7 +102,8 @@
 static PAS_ALWAYS_INLINE pas_allocation_result
 pas_allocation_result_crash_on_error(pas_allocation_result result)
 {
-    PAS_ASSERT(result.did_succeed);
+    if (PAS_UNLIKELY(!result.did_succeed))
+        pas_panic_on_out_of_memory_error();
     return result;
 }
 

Modified: branches/safari-613-branch/Source/bmalloc/libpas/src/libpas/pas_utils.c (289350 => 289351)


--- branches/safari-613-branch/Source/bmalloc/libpas/src/libpas/pas_utils.c	2022-02-08 02:58:14 UTC (rev 289350)
+++ branches/safari-613-branch/Source/bmalloc/libpas/src/libpas/pas_utils.c	2022-02-08 02:58:17 UTC (rev 289351)
@@ -55,6 +55,11 @@
 }
 #endif /* PAS_ENABLE_TESTING */
 
+void pas_panic_on_out_of_memory_error()
+{
+    __builtin_trap();
+}
+
 static void (*deallocation_did_fail_callback)(const char* reason, void* begin);
 
 PAS_NO_RETURN PAS_NEVER_INLINE void pas_deallocation_did_fail(const char *reason, uintptr_t begin)

Modified: branches/safari-613-branch/Source/bmalloc/libpas/src/libpas/pas_utils.h (289350 => 289351)


--- branches/safari-613-branch/Source/bmalloc/libpas/src/libpas/pas_utils.h	2022-02-08 02:58:14 UTC (rev 289350)
+++ branches/safari-613-branch/Source/bmalloc/libpas/src/libpas/pas_utils.h	2022-02-08 02:58:17 UTC (rev 289351)
@@ -160,6 +160,8 @@
 /* NOTE: panic format string must have \n at the end. */
 PAS_API PAS_NO_RETURN void pas_panic(const char* format, ...) PAS_FORMAT_PRINTF(1, 2);
 
+PAS_API PAS_NEVER_INLINE PAS_NO_RETURN void pas_panic_on_out_of_memory_error(void);
+
 #define pas_set_deallocation_did_fail_callback __pas_set_deallocation_did_fail_callback
 #define pas_set_reallocation_did_fail_callback __pas_set_reallocation_did_fail_callback
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to