Skip to content

do not relabel delegation edge after writing to underlying value - #191

Merged
zgrannan merged 2 commits into
mainfrom
delegation_no_relabelling
Nov 2, 2026
Merged

zgrannan merged 2 commits into
mainfrom
delegation_no_relabelling

Conversation

@ThomasMayerl

Copy link
Copy Markdown
Contributor

The PCG would relabel delegation edges after writing to the underlying value. Therefore, writing to the underlying value (e.g., through a mutef) would decouple the mutref from a derived raw pointer. Afterwards, the PCG might convert the mutef to a generic type even though we are still accessing the rawptr. The following snippet shows this issue:

fn main() {
    let mut x = 3;
    let r_x = &mut x;
    let p_x = r_x as *mut i32;
    *r_x = *r_x + 1;
    unsafe { *p_x = *p_x + 1 };
    *r_x = *r_x + 1;
    assert!(x == 6);
}

This PR fixes this issue by preventing delegation edges from being relabelled after writing to a place.

Disclaimer: This PR was written using Claude Code.

@ThomasMayerl
ThomasMayerl requested a review from zgrannan October 30, 2026 11:38
@zgrannan
zgrannan merged commit 9da9900 into main Nov 2, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants