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

codegen: guard phi node loads of invalid inputs #39747

Merged
merged 1 commit into from
Feb 21, 2021

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Feb 19, 2021

At runtime, it is prohibited to observe these values, but we need to
make sure they are not reading through undefined pointers (and
potentially trying to GC-root the memory there)

Refs ChainRules in #39641

At runtime, it is prohibited to observe these values, but we need to
make sure they are not reading through undefined pointers (and
potentially trying to GC-root the memory there)

Refs ChainRules in #39641
@vtjnash vtjnash added compiler:codegen Generation of LLVM IR and native code bugfix This change fixes an existing bug backport 1.6 Change should be backported to release-1.6 labels Feb 19, 2021
@vtjnash vtjnash merged commit fdd2633 into master Feb 21, 2021
@vtjnash vtjnash deleted the jn/39641-ChainRulesTestUtils branch February 21, 2021 23:41
@KristofferC KristofferC mentioned this pull request Feb 22, 2021
52 tasks
KristofferC pushed a commit that referenced this pull request Feb 22, 2021
At runtime, it is prohibited to observe these values, but we need to
make sure they are not reading through undefined pointers (and
potentially trying to GC-root the memory there)

Refs ChainRules in #39641

(cherry picked from commit fdd2633)
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Mar 14, 2021
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
At runtime, it is prohibited to observe these values, but we need to
make sure they are not reading through undefined pointers (and
potentially trying to GC-root the memory there)

Refs ChainRules in JuliaLang#39641
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
At runtime, it is prohibited to observe these values, but we need to
make sure they are not reading through undefined pointers (and
potentially trying to GC-root the memory there)

Refs ChainRules in JuliaLang#39641
vtjnash added a commit that referenced this pull request May 2, 2022
The optimization pass often uses values for phi values (and thus by
extension, also for pi, phic and upsilon values) that are invalid. We
make sure that these have a null pointer, so that we can detect that
case at runtime (at the cost of slightly worse code generation for
them), but it means we need to be very careful to check for that.

This is identical to #39747, which added the equivalent code to the
other side of the conditional there, but missed some additional
relevant, but rare, cases that are observed to be possible.

The `emit_isa_and_defined` is derived from the LLVM name for this
operation: `isa_and_nonnull<T>`.

Secondly, we also optimize `emit_unionmove` to change a bad IR case to a
better IR form.

Fix #44501
vtjnash added a commit that referenced this pull request May 9, 2022
The optimization pass often uses values for phi values (and thus by
extension, also for pi, phic and upsilon values) that are invalid. We
make sure that these have a null pointer, so that we can detect that
case at runtime (at the cost of slightly worse code generation for
them), but it means we need to be very careful to check for that.

This is identical to #39747, which added the equivalent code to the
other side of the conditional there, but missed some additional
relevant, but rare, cases that are observed to be possible.

The `emit_isa_and_defined` is derived from the LLVM name for this
operation: `isa_and_nonnull<T>`.

Secondly, we also optimize `emit_unionmove` to change a bad IR case to a
better IR form.

Fix #44501
oscardssmith pushed a commit that referenced this pull request May 11, 2022
The optimization pass often uses values for phi values (and thus by
extension, also for pi, phic and upsilon values) that are invalid. We
make sure that these have a null pointer, so that we can detect that
case at runtime (at the cost of slightly worse code generation for
them), but it means we need to be very careful to check for that.

This is identical to #39747, which added the equivalent code to the
other side of the conditional there, but missed some additional
relevant, but rare, cases that are observed to be possible.

The `emit_isa_and_defined` is derived from the LLVM name for this
operation: `isa_and_nonnull<T>`.

Secondly, we also optimize `emit_unionmove` to change a bad IR case to a
better IR form.

Fix #44501
KristofferC pushed a commit that referenced this pull request May 16, 2022
The optimization pass often uses values for phi values (and thus by
extension, also for pi, phic and upsilon values) that are invalid. We
make sure that these have a null pointer, so that we can detect that
case at runtime (at the cost of slightly worse code generation for
them), but it means we need to be very careful to check for that.

This is identical to #39747, which added the equivalent code to the
other side of the conditional there, but missed some additional
relevant, but rare, cases that are observed to be possible.

The `emit_isa_and_defined` is derived from the LLVM name for this
operation: `isa_and_nonnull<T>`.

Secondly, we also optimize `emit_unionmove` to change a bad IR case to a
better IR form.

Fix #44501

(cherry picked from commit 72b80e2)
KristofferC pushed a commit that referenced this pull request May 18, 2022
The optimization pass often uses values for phi values (and thus by
extension, also for pi, phic and upsilon values) that are invalid. We
make sure that these have a null pointer, so that we can detect that
case at runtime (at the cost of slightly worse code generation for
them), but it means we need to be very careful to check for that.

This is identical to #39747, which added the equivalent code to the
other side of the conditional there, but missed some additional
relevant, but rare, cases that are observed to be possible.

The `emit_isa_and_defined` is derived from the LLVM name for this
operation: `isa_and_nonnull<T>`.

Secondly, we also optimize `emit_unionmove` to change a bad IR case to a
better IR form.

Fix #44501

(cherry picked from commit 72b80e2)
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
At runtime, it is prohibited to observe these values, but we need to
make sure they are not reading through undefined pointers (and
potentially trying to GC-root the memory there)

Refs ChainRules in #39641

(cherry picked from commit fdd2633)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug compiler:codegen Generation of LLVM IR and native code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants