From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS24940 94.130.0.0/16 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_PASS shortcircuit=no 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 908C81F47C for ; Mon, 16 Jan 2023 13:46:41 +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=cP/EzECy; 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=MqxS7C7i; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 9ED177E827; Mon, 16 Jan 2023 13:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1673876794; bh=XPzuGQjEIQkTeZxSzu4s4uS70V6jd/jUhw6pquS80yE=; 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=cP/EzECyPgdiae1SKz328GhfmcOukqxmt3wI4i7oHqupJ4Cd5JiaexX+CCoH4k98o eamvST6s+0X6eW6BHOvCQkJ61OqPMAQed2iz1VaBVvmpfQeRaOzuyrvZ0FBGYdaNX7 eUJ9j72I5sKlrUtx8UzReysna35qA63qcdj2jUzw= Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 156907E808 for ; Mon, 16 Jan 2023 13:46:30 +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=MqxS7C7i; 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=5ZETX4+69a8DFFf/SCcvlOgtSXFVmZkaEXcTgRIgrOE=; b=MqxS7C7iSgBGVB/AsIPvOH6ATSxX4S6vAmxXtoeTZkhMsQFiA10DcslsVk2Av0kktxwG YAeFBJ8VVFmi0CZhR1LwU5/F143lo5tE1Zq6fKArNZKwZYieR/Kr+tzplDemukzDILess7 ryZSmpQay33Mo/erSZ+ywtb1ib+sKyhD+HVQJo2VMzwBqK/bBxtCJU6xyPp4pkeVgOjmHg +KyqxcaPBAfsRd6frbCv+rbtMfnmWJx/+tzf+cPKfzliNID0g6o/+0gRrVLN/ZwG/ieJRc 8Wcp4fHTGh0YVzLiUdbnG51BMhy71lnvQ55oVPP5/SoxH1SFVylLM/IJnNnb3uHg== Received: by filterdrecv-6c4ccfbdd8-967nf with SMTP id filterdrecv-6c4ccfbdd8-967nf-1-63C55535-1E 2023-01-16 13:46:29.378937312 +0000 UTC m=+5150451.877862799 Received: from herokuapp.com (unknown) by geopod-ismtpd-5-1 (SG) with ESMTP id otj1YAJORs6PHF9QZRQhIQ for ; Mon, 16 Jan 2023 13:46:29.240 +0000 (UTC) Date: Mon, 16 Jan 2023 13:46:29 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17420 X-Redmine-Issue-Author: Eregon X-Redmine-Issue-Assignee: ko1 X-Redmine-Sender: Eregon 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: 88225 X-SG-EID: =?us-ascii?Q?DvL3W2Xo+Vk=2FeUn3F50L=2FNc8u9NqZCnbE0mXZHiyye4R1YZg=2FtAFc0SAFzpcS=2F?= =?us-ascii?Q?Zcr7BqPN=2FYCcMZBMITNeIci9STxYay0JAJWPbek?= =?us-ascii?Q?rFR+qW1IwhLrIJHvZNpMQ2dViU=2FZuACAra9ly5A?= =?us-ascii?Q?FF0GRx08N3MS9WM6AiceNankE=2FOW4T1y69kTFhA?= =?us-ascii?Q?gLbBOXhHVEQgaS6V=2FYAaYhJZBNxwCmjAqMpu6RG?= =?us-ascii?Q?JXpZbrlyfxLYvnuv5Fiq=2FLPFhrk6iLcaU2SOdHU?= =?us-ascii?Q?hFZaA1PGUOW0E5BbtWzpg=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: 6TGIU4YGUS4ZINEXBK7L7GCBSC4F2KSL X-Message-ID-Hash: 6TGIU4YGUS4ZINEXBK7L7GCBSC4F2KSL 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:111834] [Ruby master Bug#17420] Unsafe mutation of $" when doing non-RubyGems require in Ractor List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Eregon (Benoit Daloze) via ruby-core" Cc: "Eregon (Benoit Daloze)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #17420 has been updated by Eregon (Benoit Daloze). @ko1 I believe this needs to be an exception until there is a better solution. It's likely possible to create a segfault with concurrent mutations of `$"` currently. And anyway `require` does not work in non-main Ractors, not just `$"` but many other problems (RubyGems' Monitor, any non-shareable constant accessed during loading in that Ractor, etc). ---------------------------------------- Bug #17420: Unsafe mutation of $" when doing non-RubyGems require in Ractor https://bugs.ruby-lang.org/issues/17420#change-101245 * Author: Eregon (Benoit Daloze) * Status: Open * Priority: Normal * Assignee: ko1 (Koichi Sasada) * ruby -v: ruby 3.0.0dev (2020-12-16T10:12:48Z master a9a7f4d8b8) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- With an empty file `a.rb`: ``` $ ruby --disable-gems -e 'Ractor.new { puts $" }.take' -e:1:in `block in
': can not access global variables $" from non-main Ractors (RuntimeError) ``` That is expected, given the rules for global variables. ``` ruby --disable-gems -e 'Ractor.new { require "./a.rb"; }.take; p $"' [... , "/home/eregon/a.rb"] ``` Is it OK that the Ractor can do `require`, which does modify `$"`? I think it's not, and it might lead to segfaults if e.g. the main Ractor mutates `$"` in parallel to some other Ractor doing `require`. Probably `require` needs to be forbidden in non-main Ractors (it does mutate `$"`, so it's logical), or there needs to be always VM-global synchronization on any access to `$"` (otherwise, segfaults are possible). The latter doesn't seem reasonable, especially when considering the user might do `$".each { ... }`. --- Note that RubyGems' `require` does not work on non-main Ractors (pretty much expected given it depends on a lot of global state): ``` $ ruby -e 'Ractor.new { require "./a.rb"; }.take' :37:in `require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (NameError) ``` This probably also has consequences for `autoload`. Maybe the `zeitwerk` gem can help with the mode to resolve all autoload at once. -- 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/