Open Bug 2057626 Opened 1 month ago Updated 1 day ago

DLP WASM module should have memory allocation model with guaranteed correct alignment

Categories

(Enterprise Products :: Firefox, defect)

defect

Tracking

(Not tracked)

People

(Reporter: jmendez, Unassigned)

References

(Blocks 1 open bug)

Details

As raised in a PR comment, the memory allocation of bytes used in the DLP module only guarantees 1-byte alignment but is used for usize/u32 data structures. From testing and research, this isn't currently a practical concern due to known allocators over-aligning their allocations. But we should change the model to guarantee alignment.

A few possible approaches:

  1. Create type-specific allocate methods; there are few types and they should stabilize early, so it shouldn't blow up the API
  2. Update ca_alloc to take an align value and expect the host to pass the correct align value. This could perhaps be paired with an API that lets the host query existing types and their sizes/alignments.
  3. Leave the same API but just always over-align to e.g. 8 bytes.
Summary: DLP WASM module has memory allocation model with guaranteed correct alignment → DLP WASM module should have memory allocation model with guaranteed correct alignment

Also to the extent we cannot enforce byte-compatibility automatically we should document e.g. wasm32 vs wasm64.

Severity: -- → S3
Target Milestone: MVP → V1
You need to log in before you can comment on or make changes to this bug.