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

#[link_section] static FOO can contain undefined bytes on wasm #60633

Closed
oli-obk opened this issue May 8, 2019 · 3 comments · Fixed by #62749
Closed

#[link_section] static FOO can contain undefined bytes on wasm #60633

oli-obk opened this issue May 8, 2019 · 3 comments · Fixed by #62749
Assignees
Labels
A-const-eval Area: constant evaluation (mir interpretation) A-linkage Area: linking into static, shared libraries and binaries C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-wasm Target: WASM (WebAssembly), http://webassembly.org/

Comments

@oli-obk
Copy link
Contributor

oli-obk commented May 8, 2019

https://github.com/rust-lang/rust/blob/e80c86c535b74cdd65c4b75b94ce38342d0bb946/src/librustc_typeck/check/mod.rs#L1444-L1467 only checks that the link section contains no pointers, but there may be arbitrary bytes in the data, even undefined bytes (e.g. due to padding).

cc @alexcrichton is that ok? llvm may insert undef whereever there are undefined bytes. Or should we lint/error on such statics?

This issue has been assigned to @Chocol4te via this comment.

@oli-obk oli-obk added A-const-eval Area: constant evaluation (mir interpretation) A-linkage Area: linking into static, shared libraries and binaries O-wasm Target: WASM (WebAssembly), http://webassembly.org/ labels May 8, 2019
@alexcrichton
Copy link
Member

@oli-obk that should be ok yeah, I think that's what happens on all other platforms and it's up to the consumer to ensure that all bytes they read have defined values if they want.

@oli-obk oli-obk added C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels May 8, 2019
@oli-obk
Copy link
Contributor Author

oli-obk commented May 8, 2019

Ok, I guess we should probably just document that in the code segment that I linked above.

@fmckeogh
Copy link
Member

@rustbot claim

@rustbot rustbot self-assigned this Jul 17, 2019
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: constant evaluation (mir interpretation) A-linkage Area: linking into static, shared libraries and binaries C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-wasm Target: WASM (WebAssembly), http://webassembly.org/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants