From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 760801F44D for ; Thu, 14 Mar 2024 09:44:28 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=AVs/o3BU; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=InzVhS9S; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id A0B2F83369; Thu, 14 Mar 2024 09:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1710409462; bh=sRWjZpnRBbgxmzT7BwtkHe8amHfrMASrzhp4+z/zCvE=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=AVs/o3BUJ9BVJ21/5TaGpbAHaIlxm3DfPHjuL1xVJWi25+4vbymOIPf1cNfnkNTz5 Sc08SO32pfvGIdwSAzUPCq9h6WFjpnUQu2WKaa49ucQnbF85+ueBsTs5m9aqYUABjJ XsZex5Y+umjDqKBmRq5QyFKcyDxl3U/184acklww= Received: from s.wrqvtzvf.outbound-mail.sendgrid.net (s.wrqvtzvf.outbound-mail.sendgrid.net [149.72.126.143]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 967FF8335D for ; Thu, 14 Mar 2024 09:44:19 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=InzVhS9S; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=OEr60d9bAnxaaYvkiKyN3QluW7jEIy/t9RxC2LXod+c=; b=InzVhS9S8NL31mOve/Q1Dm++3pjDpLluDIvPUnpH3wB2lM66QVkbFvGzMOZFKqtjbDkV GtAmXEhU0pV9N/A63ah8VJR53Ba5cKMVGN60Wl7E+65mlP4hXcx4Lx3kziaGVG/MF6FTfr bqov13GSt/9Ibr5/jrCm/EizOrdrANRT9RWSMHhOfQiTYrz5NvbNzSjYEZfqu+EeECJNFR ADUgVTIucAaRixXN1fwrn8ml6YBjeQ+X6Cjrs+22WHlryojCAs8T9wfPNscQQMQgpSV4Wv Ud6MQUA4RxMm1/o7jRA9eaJlDGKyRv0HWTUuPKM2lYU3Sp8omNPwWfzJWdOS/iSg== Received: by recvd-6449d6bd6c-spx68 with SMTP id recvd-6449d6bd6c-spx68-1-65F2C6F2-11 2024-03-14 09:44:18.466800204 +0000 UTC m=+1252435.548246494 Received: from herokuapp.com (unknown) by geopod-ismtpd-25 (SG) with ESMTP id fYDiaVEBRM-MJ_9w8u6_Qw for ; Thu, 14 Mar 2024 09:44:18.434 +0000 (UTC) Date: Thu, 14 Mar 2024 09:44:18 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20310 X-Redmine-Issue-Author: kjtsanaktsidis X-Redmine-Issue-Assignee: kjtsanaktsidis X-Redmine-Issue-Priority: Normal X-Redmine-Sender: mame X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 93718 X-SG-EID: =?us-ascii?Q?u001=2Ep+ckLDtT+4Y5c+H0YCkEnsuWiCQmn3OZA=2F9FzjoR6ZZlPaMv54M7EFoSM?= =?us-ascii?Q?CX5Trc79ep2R5F+0oYS4n23jq1cv00Wlmzs8hsX?= =?us-ascii?Q?VeDLzm4Qbwu5VJnVd+889qoo9dkeE3fEq3hXfC1?= =?us-ascii?Q?O4XQKOAZEtWdno=2FKud5v9LpLXUQi+DlQFeF+4GB?= =?us-ascii?Q?b9brwVhAoJ851812rZlYnh9ZJNhuWArYdPRxstU?= =?us-ascii?Q?OAB6HULn4rj2n+Sf5jad08yu56QG1cWJp2Ug38L?= =?us-ascii?Q?MGsn?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: ZV5P7OVVQHMA7QXV7KCSA2EHSWDAF32C X-Message-ID-Hash: ZV5P7OVVQHMA7QXV7KCSA2EHSWDAF32C X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:117152] [Ruby master Bug#20310] ASAN fake stacks need to be marked during GC for non-current execution context List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "mame (Yusuke Endoh) via ruby-core" Cc: "mame (Yusuke Endoh)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20310 has been updated by mame (Yusuke Endoh). Discussed at the dev meeting, and @ko1 said the PR looks good to him. ---------------------------------------- Bug #20310: ASAN fake stacks need to be marked during GC for non-current execution context https://bugs.ruby-lang.org/issues/20310#change-107239 * Author: kjtsanaktsidis (KJ Tsanaktsidis) * Status: Assigned * Assignee: kjtsanaktsidis (KJ Tsanaktsidis) * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- When ASAN (address sanitizer) is enabled, the compiler does not necessarily store all local variables on the real machine stack; instead, locals can be stored in per-frame heap allocated memory which ASAN uses to detect things like stack-use-after-return ("fake stacks"). A pointer to the fake stack is left on the real machine stack, so it's possible to discover these fake stacks during GC and mark locals stored there as well. At the moment, Ruby is currently marking these fake stacks for the current execution context which triggered GC, as part of `mark_current_machine_context`: https://github.com/ruby/ruby/blob/fe0b704df5553bdd59e90650ffbbfac785a2e48a/gc.c#L6411. However, there are other machine stacks which also need to be marked like this: * Machine stacks for other threads which did not trigger GC are marked in `rb_execution_context_mark` here: https://github.com/ruby/ruby/blob/fe0b704df5553bdd59e90650ffbbfac785a2e48a/vm.c#L3422 * Machine stacks for fibers are marked in `cont_mark` here: https://github.com/ruby/ruby/blob/fe0b704df5553bdd59e90650ffbbfac785a2e48a/cont.c#L1030 We need to make these two kinds of stacks perform the same ASAN fake stack marking as `mark_current_machine_context` does. (P.S. - `callcc` continuations are another kind of machine stack which get marked, but ASAN is not compatible with callcc, so this doesn't really matter). (P.S. - it appears to me that the currently-switched-to fiber will have its stack marked _twice_; once in `rb_execution_context_mark` or `mark_current_machine_context, and once in `cont_mark`; if this is true, I will fix this too) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/