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

[0.38.0] Backport CI fixes #4491

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
--------------------------------------------------------------------------------

## 0.38.3

Released 2022-07-20.

### Fixed.

* An s390x-specific codegen bug in addition to a mistake introduced in the fix
of CVE-2022-31146 were fixed.
[#4491](https://github.com/bytecodealliance/wasmtime/pull/4491)

--------------------------------------------------------------------------------

## 0.38.2

Released 2022-07-20.
Expand Down
14 changes: 13 additions & 1 deletion cranelift/codegen/src/isa/s390x/lower/isle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ where
fn u64_from_value(&mut self, val: Value) -> Option<u64> {
let inst = self.lower_ctx.dfg().value_def(val).inst()?;
let constant = self.lower_ctx.get_constant(inst)?;
Some(constant)
let ty = self.lower_ctx.output_ty(inst, 0);
Some(zero_extend_to_u64(constant, self.ty_bits(ty).unwrap()))
}

#[inline]
Expand Down Expand Up @@ -516,3 +517,14 @@ where
self.lower_ctx.emit(inst.clone());
}
}

/// Zero-extend the low `from_bits` bits of `value` to a full u64.
#[inline]
fn zero_extend_to_u64(value: u64, from_bits: u8) -> u64 {
assert!(from_bits <= 64);
if from_bits >= 64 {
value
} else {
value & ((1u64 << from_bits) - 1)
}
}
5 changes: 5 additions & 0 deletions cranelift/codegen/src/machinst/vcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,14 @@ impl<I: VCodeInst> VCodeBuilder<I> {
// will be returned directly to `regalloc2` eventually and all
// operands/results of instructions will use the alias-resolved vregs
// from `regalloc2`'s perspective.
//
// Also note that `reftyped_vregs` can't have duplicates, so after the
// aliases are applied duplicates are removed.
for reg in self.vcode.reftyped_vregs.iter_mut() {
*reg = Self::resolve_vreg_alias_impl(&self.vcode.vreg_aliases, *reg);
}
self.vcode.reftyped_vregs.sort();
self.vcode.reftyped_vregs.dedup();

self.compute_preds_from_succs();
self.vcode.debug_value_labels.sort_unstable();
Expand Down