Context varargs can smuggle graph-runtime references past the borrow tree's lifetime discipline

オープン
#4,358 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
静か
技術スタック
rust

調査の方向性

まず OwnedContextImpl::with_vararg、NodeContainer のライフタイム処理、Monitor ノードの IORecord スナップショット経路を追跡し、その後 #4335 のランク多相性の変更を確認します。context API と vararg API が、グラフランタイムへの参照を有効なライフタイムの外へ、グラフの再コンパイルをまたぐ場合も含めて、もはや逃がさないようになり、かつ safe code の保証を弱めていなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

Graphene

Reported by @TrueDoctor following the rank polymorphism PR (#4335). Three existing mechanisms combine into an unsound API surface:

  1. The borrow tree launders lifetimes: NodeContainer derefs *const TypeErasedNode<'static> to &'static, so references handed out inside the graph (the &PlatformEditorApi scope wire, &WgpuExecutor, or any reference to node-owned state) are typed 'static but actually live only until the next graph recompilation deallocates their owner.
  2. OwnedContextImpl::with_vararg accepts any Box<dyn AnyHash + Send + Sync>. Its 'static bound cannot distinguish real ownership from a laundered reference, so safe code in any node can store such a reference into a context. #4335 made this channel idiomatic (render boundary config, per-item lambda rows).
  3. Contexts escape the graph: the Monitor node snapshots IORecord { input: Context, output } into an Arc<dyn Any> that the editor introspects and can retain across recompiles.

Combined: a node stores a laundered reference as a vararg, a Monitor captures the context, the graph recompiles and frees the referent, and the editor reads freed memory through entirely safe code (vararg() + downcast_ref). A vararg with interior mutability would similarly let context readers mutate graph-owned state as a covert return channel.

All current with_vararg callers box owned data, so no UB exists in the code today. But the risk remains for the API permitting it silently.

主要言語
Rust
スター
27.8k
フォーク
1.3k
平均マージ
10時間 53分
マージ済み PR(30日)
195

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

GraphiteEditor/Graphite のほかの issue

GraphiteEditor/Graphite の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。