Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCC: switch "max" facts to "range" facts with two-sided ranges. #7263

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

cfallin
Copy link
Member

@cfallin cfallin commented Oct 17, 2023

This is needed for soundness when verifying accesses to memtype fields: it's not enough to know that we're accessing an offset in 0 up to field_offset inclusive, we need to know the access is actually to field_offset.

The simplest change that validates this turned out to be the most general one: making ranges two-sided rather than one-sided. The transform is mostly mechanical, but a few new tests verify that ranges are updated on both sides, and some fail-tests verify that "fuzzily imprecise" pointers to struct fields fail to validate.

@cfallin cfallin requested a review from fitzgen October 17, 2023 00:41
@cfallin cfallin requested a review from a team as a code owner October 17, 2023 00:41
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:area:aarch64 Issues related to AArch64 backend. labels Oct 17, 2023
cranelift/codegen/src/ir/pcc.rs Outdated Show resolved Hide resolved
cranelift/codegen/src/ir/pcc.rs Outdated Show resolved Hide resolved
cranelift/codegen/src/ir/pcc.rs Outdated Show resolved Hide resolved
This is needed for soundness when verifying accesses to memtype fields:
it's not enough to know that we're accessing an offset in `0` up to
`field_offset` inclusive, we need to know the access is actually to
`field_offset`.

The simplest change that validates this turned out to be the most
general one: making ranges two-sided rather than one-sided. The
transform is *mostly* mechanical, but a few new tests verify that ranges
are updated on both sides, and some fail-tests verify that "fuzzily
imprecise" pointers to struct fields fail to validate.
@cfallin cfallin added this pull request to the merge queue Oct 17, 2023
Merged via the queue into bytecodealliance:main with commit 39a33d2 Oct 17, 2023
18 checks passed
@cfallin cfallin deleted the pcc-two-sided-range branch October 17, 2023 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift:area:aarch64 Issues related to AArch64 backend. cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants