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=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 9209C1F44D for ; Wed, 28 Feb 2024 04:01:52 +0000 (UTC) Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 0D1587EF4A; Wed, 28 Feb 2024 04:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1709092903; bh=I77wbhVjaxIjlTwUZ/JC/8BbmtIO3X1vLwI6zNQDNAI=; 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=iVu84a+fyy/noupLr14AAOoKx33mNR28J1we1+FMMAMZ5lhgHJ3HB1bM+cR/kgs2O FIbX9pBGukwhpijLS2L/vEcL62TcAnj9vF1yZ1JEQThg/Y/iKJh7cJJrmbHcQhrQZb 1d+6klj/3bPRpGnZpsSUS78iQM2tT4FjlH4KylwE= Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 902027D5D0 for ; Wed, 28 Feb 2024 04:01:39 +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=ShIFHbBz; 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=X5446qYRRxnfqTQezWpib4E2FHbjW2Te6AM0chRkJ+Y=; b=ShIFHbBz4AGhk8t9qMCMWaE1gH/JDYqrxmeRMFBSqlAFRPXXnp+m1KbQWCqiP80bcO2z 04zITs87blGsZGV7F/FkKno6akNl8GTbxXlG66zvMNRAC4XJSgflUAPpxdYFaP037zGn70 KJEdpynej0rx/kdAA0zVUvQdgHkpgjLhW4WNEg0/QA+UwAChaX2j//6cDFnS/IjPRKPLDY WsJuQYj6YIgjQL/d7NOOR66D5SKyAXEGok+1ZaV8PBQcy4o68+uhv15D8O2U1/btMORQHz ndttdsOpqUENXs6XvP0eFBcJs/87r7b7WqQh6iwrx2UG1heq9QQvjdx6Vf+wFevg== Received: by filterdrecv-b85775b64-r45kn with SMTP id filterdrecv-b85775b64-r45kn-1-65DEB021-8 2024-02-28 04:01:37.662203552 +0000 UTC m=+1669505.793865184 Received: from herokuapp.com (unknown) by geopod-ismtpd-19 (SG) with ESMTP id E4HQ1zSQRby_wyTBS9MT9Q for ; Wed, 28 Feb 2024 04:01:37.523 +0000 (UTC) Date: Wed, 28 Feb 2024 04:01:37 +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: kjtsanaktsidis 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: 93543 X-SG-EID: =?us-ascii?Q?bpuAnwiv5wR3AMKfH76hNK7PI5khDDZ1kji5+D8yFrgaUvTZzAkIlQXnVriLYY?= =?us-ascii?Q?wZntoXP0DUH6R9LNgqzTU1esCZ4KY8M9zX8WDhO?= =?us-ascii?Q?VCp0C7SgYDWXY9VqUrPtsrJozDoC+oj=2FgaErDtp?= =?us-ascii?Q?RbceDZp0atgGSMYIF44Kv4VWytL2lz1nmKiw4VB?= =?us-ascii?Q?fmOQMKT1v9xGTRIB1XaOtZBuvA+qmKucR0bX4Dt?= =?us-ascii?Q?NJAp+d3MqpSMX5oLFbfbJ5emxeN=2FgHsiHoW2Jhq?= =?us-ascii?Q?3dfXQnNe1sazar+VltR8s20M=2FTNNISFzOe9lFcO?= =?us-ascii?Q?Maw=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: 7YMKL636QFZ2QV6237FAOZ4M4V72TXCI X-Message-ID-Hash: 7YMKL636QFZ2QV6237FAOZ4M4V72TXCI 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:116987] [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: "kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core" Cc: "kjtsanaktsidis (KJ Tsanaktsidis)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20310 has been reported by kjtsanaktsidis (KJ Tsanaktsidis). ---------------------------------------- Bug #20310: ASAN fake stacks need to be marked during GC for non-current execution context https://bugs.ruby-lang.org/issues/20310 * 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/