github-actions[bot] commented on issue #4351:
Subscribe to Label Action
cc @peterhuene
<details>
This issue or pull request has been labeled: "wasmtime:api", "wasmtime:config"Thus the following users have been cc'd because of the following labels:
- peterhuene: wasmtime:api
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
github-actions[bot] commented on issue #4351:
Label Messager: wasmtime:config
It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:
[ ] If you added a new
Config
method, you wrote extensive documentation for
it.<details>
Our documentation should be of the following form:
```text
Short, simple summary sentence.More details. These details can be multiple paragraphs. There should be
information about not just the method, but its parameters and results as
well.Is this method fallible? If so, when can it return an error?
Can this method panic? If so, when does it panic?
Example
Optional example here.
```</details>
[ ] If you added a new
Config
method, or modified an existing one, you
ensured that this configuration is exercised by the fuzz targets.<details>
For example, if you expose a new strategy for allocating the next instance
slot inside the pooling allocator, you should ensure that at least one of our
fuzz targets exercises that new strategy.Often, all that is required of you is to ensure that there is a knob for this
configuration option in [wasmtime_fuzzing::Config
][fuzzing-config] (or one
of its nestedstruct
s).Rarely, this may require authoring a new fuzz target to specifically test this
configuration. See [our docs on fuzzing][fuzzing-docs] for more details.</details>
[ ] If you are enabling a configuration option by default, make sure that it
has been fuzzed for at least two weeks before turning it on by default.[fuzzing-config]: https://github.com/bytecodealliance/wasmtime/blob/ca0e8d0a1d8cefc0496dba2f77a670571d8fdcab/crates/fuzzing/src/generators.rs#L182-L194
[fuzzing-docs]: https://docs.wasmtime.dev/contributing-fuzzing.html
<details>
To modify this label's message, edit the <code>.github/label-messager/wasmtime-config.md</code> file.
To add new label messages or remove existing label messages, edit the
<code>.github/label-messager.json</code> configuration file.</details>
alexcrichton commented on issue #4351:
Would you be up for adding a test which disables backtraces? I thought we had something along those lines but it sounds like your configuration is different which our current test suite isn't covering.
alexcrichton commented on issue #4351:
Also, I'm a bit confused how this is coming up, this example program works for me:
use anyhow::Result; use wasmtime::*; fn main() -> Result<()> { let mut config = Config::new(); config.wasm_backtrace(false); let engine = Engine::new(&config).unwrap(); let m1 = Module::new(&engine, "(module (func unreachable))")?; let bytes = m1.serialize()?; let m2 = unsafe { Module::deserialize(&engine, &bytes)? }; let mut store = Store::new(&engine, ()); Instance::new(&mut store, &m1, &[])?; Instance::new(&mut store, &m2, &[])?; Ok(()) }
so I'm also curious what configuration you're using to trigger the error coming out.
Stebalien commented on issue #4351:
Would you be up for adding a test which disables backtraces? I thought we had something along those lines but it sounds like your configuration is different which our current test suite isn't covering.
There's a test:
But it doesn't test that unwind info isn't generated. I've just added a targeted one to make sure it's disabled at the compiler level, but there may be a better way.
Stebalien commented on issue #4351:
Also, I'm a bit confused how this is coming up, this example program works for me:
It does work, however:
- In 0.38, unwind info won't be disabled unless you also disable reference types. If you disable reference types as well, that won't work.
- In 0.39 (dev), that will "work" simply because unwind info won't be disabled no matter what you do.
The test I added should catch this.
alexcrichton commented on issue #4351:
Ah ok that makes sense, thanks for clarifying. I had forgotten that the changes to
Config
and idempotency which would affect this were only on 0.39.0 and not 0.38.0.Otherwise though I think that the
unwind_info
flag still needs verification as you mentioned along the lines of safepoints. Ifwasm_backtrace
orwasm_reference_types
are enabled thenunwind_info
must be true, but otherwise the value of the flag does not matter.
Stebalien commented on issue #4351:
Otherwise though I think that the unwind_info flag still needs verification as you mentioned along the lines of safepoints.
I was pointing out an inconsistency. It looks like that function is _primarily_ for validating that the config matches the current system, not for validating that the config matches the flags. That function isn't currently checking, e.g., enable_simd, enable_float, enable_verifier, etc. either. The enable_safepoints check is actually the exception.
The config is checked against the compiler flags in https://github.com/bytecodealliance/wasmtime/blob/61312a9bf4b6a5d0922f77901f9b3f025de324ef/crates/wasmtime/src/config.rs#L1410
alexcrichton commented on issue #4351:
This is needed for memory safety I believe. Without a check it's possible to load a wasm module which doesn't have
.eh_frame
and we're then unable to produce backtraces or backtraces crash at runtime if backtraces are required. The specific problem is compiling a module without.eh_frame
as a precompiled artifact and then loading it into an engine that tries to do backtraces.
Stebalien commented on issue #4351:
Ah, because this is checking the _compiled_ module. Got it, thanks. That also explains why we don't care about enable_simd, enable_float, etc. (although the fact that the engine will happily deserialize a module that doesn't _quite_ match the engine's config is non-obvious).
I've pushed a fix, but I think there's still _technically_ a bug. We're checking that we have unwind_info _if_ the flag is present, but we're not making sure the flag is actually present. I'm not sure if we really care, but I figured I'd mention it.
Meta: would you like me to squash?
Stebalien commented on issue #4351:
@alexcrichton and @pchickey, thanks for guiding me through this!
Last updated: Nov 22 2024 at 17:03 UTC