Stream: git-wasmtime

Topic: wasmtime / issue #4350 Can't fully disable wasm backtraces


view this post on Zulip Wasmtime GitHub notifications bot (Jun 28 2022 at 22:52):

Stebalien labeled issue #4350:

I can fix this with:

diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs
index b41ae9396..256009a0a 100644
--- a/crates/wasmtime/src/config.rs
+++ b/crates/wasmtime/src/config.rs
@@ -1423,6 +1423,10 @@ impl Config {
             {
                 bail!("compiler option 'unwind_info' must be enabled when either 'backtraces' or 'reference types' are enabled");
             }
+        } else {
+            unsafe {
+                self.cranelift_flag_set("unwind_info", "false");
+            }
         }
         if self.features.reference_types {
             if !self
diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs
index 9dd637e71..83514d72c 100644
--- a/crates/wasmtime/src/engine.rs
+++ b/crates/wasmtime/src/engine.rs
@@ -345,7 +345,7 @@ impl Engine {
             // can affect the way the generated code performs or behaves at
             // runtime.
             "avoid_div_traps" => *value == FlagValue::Bool(true),
-            "unwind_info" => *value == FlagValue::Bool(true),
+            "unwind_info" => true,
             "libcall_call_conv" => *value == FlagValue::Enum("isa_default".into()),

             // Features wasmtime doesn't use should all be disabled, since

But I'm wondering if:

  1. The other settings (reference types, simd) need to be explicitly set as well.
  2. There's a bad default somewhere. Should unwind_info be disabled by default in cranelift?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 28 2022 at 22:52):

Stebalien opened issue #4350:

I can fix this with:

diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs
index b41ae9396..256009a0a 100644
--- a/crates/wasmtime/src/config.rs
+++ b/crates/wasmtime/src/config.rs
@@ -1423,6 +1423,10 @@ impl Config {
             {
                 bail!("compiler option 'unwind_info' must be enabled when either 'backtraces' or 'reference types' are enabled");
             }
+        } else {
+            unsafe {
+                self.cranelift_flag_set("unwind_info", "false");
+            }
         }
         if self.features.reference_types {
             if !self
diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs
index 9dd637e71..83514d72c 100644
--- a/crates/wasmtime/src/engine.rs
+++ b/crates/wasmtime/src/engine.rs
@@ -345,7 +345,7 @@ impl Engine {
             // can affect the way the generated code performs or behaves at
             // runtime.
             "avoid_div_traps" => *value == FlagValue::Bool(true),
-            "unwind_info" => *value == FlagValue::Bool(true),
+            "unwind_info" => true,
             "libcall_call_conv" => *value == FlagValue::Enum("isa_default".into()),

             // Features wasmtime doesn't use should all be disabled, since

But I'm wondering if:

  1. The other settings (reference types, simd) need to be explicitly set as well.
  2. There's a bad default somewhere. Should unwind_info be disabled by default in cranelift?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 28 2022 at 23:47):

pchickey commented on issue #4350:

Thanks for the bug report, please send a PR and we'll merge the fix. The diff in engine.rs should be moving the "unwind_info" case down to the section starting at line 375.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2022 at 15:13):

alexcrichton closed issue #4350:

I can fix this with:

diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs
index b41ae9396..256009a0a 100644
--- a/crates/wasmtime/src/config.rs
+++ b/crates/wasmtime/src/config.rs
@@ -1423,6 +1423,10 @@ impl Config {
             {
                 bail!("compiler option 'unwind_info' must be enabled when either 'backtraces' or 'reference types' are enabled");
             }
+        } else {
+            unsafe {
+                self.cranelift_flag_set("unwind_info", "false");
+            }
         }
         if self.features.reference_types {
             if !self
diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs
index 9dd637e71..83514d72c 100644
--- a/crates/wasmtime/src/engine.rs
+++ b/crates/wasmtime/src/engine.rs
@@ -345,7 +345,7 @@ impl Engine {
             // can affect the way the generated code performs or behaves at
             // runtime.
             "avoid_div_traps" => *value == FlagValue::Bool(true),
-            "unwind_info" => *value == FlagValue::Bool(true),
+            "unwind_info" => true,
             "libcall_call_conv" => *value == FlagValue::Enum("isa_default".into()),

             // Features wasmtime doesn't use should all be disabled, since

But I'm wondering if:

  1. The other settings (reference types, simd) need to be explicitly set as well.
  2. There's a bad default somewhere. Should unwind_info be disabled by default in cranelift?

Last updated: Nov 22 2024 at 16:03 UTC