Fuzz-code-coverage motivated improvements (#3905)
* fuzz: Fuzz padding between compiled functions This commit hooks up the custom `wasmtime_linkopt_padding_between_functions` configuration option to the cranelift compiler into the fuzz configuration, enabling us to ensure that randomly inserting a moderate amount of padding between functions shouldn't tamper with any results. * fuzz: Fuzz the `Config::generate_address_map` option This commit adds fuzz configuration where `generate_address_map` is either enabled or disabled, unlike how it's always enabled for fuzzing today. * Remove unnecessary handling of relocations This commit removes a number of bits and pieces all related to handling relocations in JIT code generated by Wasmtime. None of this is necessary nowadays that the "old backend" has been removed (quite some time ago) and relocations are no longer expected to be in the JIT code at all. Additionally with the minimum x86_64 features required to run wasm code it should be expected that no libcalls are required either for Wasmtime-based JIT code.
This commit is contained in:
@@ -211,6 +211,8 @@ pub struct WasmtimeConfig {
|
||||
/// Configuration for the instance allocation strategy to use.
|
||||
pub strategy: InstanceAllocationStrategy,
|
||||
codegen: CodegenSettings,
|
||||
padding_between_functions: Option<u16>,
|
||||
generate_address_map: bool,
|
||||
}
|
||||
|
||||
/// Configuration for linear memories in Wasmtime.
|
||||
@@ -393,7 +395,8 @@ impl Config {
|
||||
16 << 20,
|
||||
self.wasmtime.memory_guaranteed_dense_image_size,
|
||||
))
|
||||
.allocation_strategy(self.wasmtime.strategy.to_wasmtime());
|
||||
.allocation_strategy(self.wasmtime.strategy.to_wasmtime())
|
||||
.generate_address_map(self.wasmtime.generate_address_map);
|
||||
|
||||
self.wasmtime.codegen.configure(&mut cfg);
|
||||
|
||||
@@ -418,6 +421,16 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(pad) = self.wasmtime.padding_between_functions {
|
||||
unsafe {
|
||||
cfg.cranelift_flag_set(
|
||||
"wasmtime_linkopt_padding_between_functions",
|
||||
&pad.to_string(),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
match &self.wasmtime.memory_config {
|
||||
MemoryConfig::Normal(memory_config) => {
|
||||
cfg.static_memory_maximum_size(
|
||||
|
||||
Reference in New Issue
Block a user