[前][次][番号順一覧][スレッド一覧]

ruby-changes:72877

From: Nobuyoshi <ko1@a...>
Date: Tue, 9 Aug 2022 22:39:11 +0900 (JST)
Subject: [ruby-changes:72877] ff07e5c264 (master): Skip poisoned regions

https://git.ruby-lang.org/ruby.git/commit/?id=ff07e5c264

From ff07e5c264c82f73b0368dd0bc2ae39f78678519 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 9 Aug 2022 02:15:10 +0900
Subject: Skip poisoned regions

Poisoned regions cannot be accessed without unpoisoning outside gc.c.
Specifically, debug.gem is terminated by AddressSanitizer.

```
SUMMARY: AddressSanitizer: use-after-poison iseq_collector.c:39 in iseq_i
```
---
 gc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gc.c b/gc.c
index df4c99b15b..ecb4aa7e20 100644
--- a/gc.c
+++ b/gc.c
@@ -3904,7 +3904,8 @@ objspace_each_objects_try(VALUE arg) https://github.com/ruby/ruby/blob/trunk/gc.c#L3904
             uintptr_t pstart = (uintptr_t)page->start;
             uintptr_t pend = pstart + (page->total_slots * size_pool->slot_size);
 
-            if ((*data->callback)((void *)pstart, (void *)pend, size_pool->slot_size, data->data)) {
+            if (!__asan_region_is_poisoned((void *)pstart, pend - pstart) &&
+                (*data->callback)((void *)pstart, (void *)pend, size_pool->slot_size, data->data)) {
                 break;
             }
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]