You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/08/04 08:50:30 UTC
[GitHub] [incubator-tvm] 12101111 opened a new issue #6205: [Rust] unsafe transmute cause runtime error
12101111 opened a new issue #6205:
URL: https://github.com/apache/incubator-tvm/issues/6205
The `impl From<ByteArray> for ArgValue<'static>` is unsound and cause runtime error:
```
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
```
Here is a reproducible example:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=79b8e8c9abda957d250b0c780582f014
miri catch this UB:
```
error: Undefined Behavior: type validation failed: encountered a dangling reference (use-after-free) at .0
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-tvm] jroesch commented on issue #6205: [Rust] unsafe transmute cause runtime error
Posted by GitBox <gi...@apache.org>.
jroesch commented on issue #6205:
URL: https://github.com/apache/incubator-tvm/issues/6205#issuecomment-668831661
Thanks for the issue, I have another open issue #6098 that is worried about these kinds of things. I believe the old `TVMArgValue` and `TVMRetValue`'s implementations were previously unsound, and now more unsound after migrating things to object system. I believe we need to remove all non-owned variants but I haven't got around to doing this yet. If you have the cycles happy to accept a PR on this. cc @mwillsey
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-tvm] 12101111 commented on issue #6205: [Rust] unsafe transmute cause runtime error
Posted by GitBox <gi...@apache.org>.
12101111 commented on issue #6205:
URL: https://github.com/apache/incubator-tvm/issues/6205#issuecomment-668586211
There is another error:
In `ArgValue` 's `to_tvm_value()` ( inside `TVMPODValue!` macro).
```rust
match &self {
Bytes(val) => {
(TVMValue { v_handle: val as *const _ as *mut c_void }, TVMArgTypeCode_kTVMBytes)
}
Str(val) => { (TVMValue { v_handle: val.as_ptr() as *mut c_void }, TVMArgTypeCode_kTVMStr) }
}
```
The type of `val` is `&&ffi::TVMByteArray`, so the pointer return is a invalid dangling pointer.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-tvm] tqchen closed issue #6205: [Rust] unsafe transmute cause runtime error
Posted by GitBox <gi...@apache.org>.
tqchen closed issue #6205:
URL: https://github.com/apache/incubator-tvm/issues/6205
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org