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

Memory short circuiting ignores certificates #1930

Closed
athas opened this issue May 2, 2023 · 2 comments · Fixed by #1932
Closed

Memory short circuiting ignores certificates #1930

athas opened this issue May 2, 2023 · 2 comments · Fixed by #1932
Assignees

Comments

@athas
Copy link
Member

athas commented May 2, 2023

This program causes memory errors because the short-circuiting moves the write to dst (or rather its memory block) before the assertion implementing the bounds check:

-- ==
-- input { 5000i64 [1i64] }
-- error:

def main [n] (k: i64) (dst: *[n]i64) =
  let src = iota k
  in dst with [1:4] = src

I think @Munksgaard volunteered to fix it.

@Munksgaard Munksgaard self-assigned this May 2, 2023
@Munksgaard
Copy link
Collaborator

I did. I took a stab at it yesterday, but I'm afraid the fix is a bit more complex than I had hoped. I might have to postpone it until after my defense.

@athas
Copy link
Member Author

athas commented May 2, 2023

Can it not be done using the same machinery we use to only coalesce when the target memory block is in scope? I.e. only coalesce when the certificates are in scope, and then add those certificates to the source when short-circuiting.

Munksgaard added a commit that referenced this issue May 2, 2023
This commit fixes the issue described in #1930 where short circuiting without
also applying the certificates of the destination to the source can cause
runtime errors and memory corruption.  In addition to propagating the
certificates, we also need to check that the values used in the certificate are
actually in scope.

Fixes #1930
Munksgaard added a commit that referenced this issue May 2, 2023
This commit fixes the issue described in #1930 where short circuiting without
also applying the certificates of the destination to the source can cause
runtime errors and memory corruption.  In addition to propagating the
certificates, we also need to check that the values used in the certificate are
actually in scope.

Fixes #1930
athas pushed a commit that referenced this issue May 3, 2023
)

This commit fixes the issue described in #1930 where short circuiting without
also applying the certificates of the destination to the source can cause
runtime errors and memory corruption.  In addition to propagating the
certificates, we also need to check that the values used in the certificate are
actually in scope.

Fixes #1930
razetime pushed a commit to razetime/futhark that referenced this issue May 27, 2023
…ku-dk#1932)

This commit fixes the issue described in diku-dk#1930 where short circuiting without
also applying the certificates of the destination to the source can cause
runtime errors and memory corruption.  In addition to propagating the
certificates, we also need to check that the values used in the certificate are
actually in scope.

Fixes diku-dk#1930
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants