[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Trying to crack the Firefox crashing issue




> On May 12, 2025, at 7:16 AM, Damien Stewart <hypexed@yahoo.com.au> wrote:
> 
> On 12/5/25 11:39 pm, Ken Cunningham wrote:
>> wasm will only ever be little endian by design.
>> 
>> I think the issue lies in RLBox, which needs to account for BE systems when using wasm, but does not.
> 
> The VM itself yes. This results in discussions about BE online regarding WASM. It's possible WASM could run on BE as native, and in my debugging it was halfway there since most data was correct, but it's intrinsically LE by design. So, I tend to think, BE will always be second class in this design, so at the end of the day BE will need to specially deal with LE data.


WASM has said it will never make it BE capable, it will always and only be LE intrinsically.

So trying to get WASM to make it BE/LE is a dead path.



> Rather than try and make a pure BE port. Given there are offsets in memory as LE tells me this. It also tells me something funky is going on if a 32 bit integer is already backwards on a BE CPU, so it must be part of the WASM code. Though the mixed endian in the result says different.
> 
> This article explains a bit and uses the XML code as an example. They compile code to WASM binary and then back to C again. Seems like they just found the hard way to sandbox C code and compile it. :-D
> 
> https://github.com/PLSysSec/rlbox/discussions/50
> 
> But check this! By default a JavaScript DataView is big endian! How old is this article? :-P
> 
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Typed_arrays#dataview
> 



So instead of trying to make WASM work as BE natively, which they say over and over they will never do, it would seem that this:

https://github.com/PLSysSec/rlbox_wasm2c_sandbox/

needs to be made to work on a BE system.

It may be a simple as finding the places where they do this:

```
struct rlboxv2-pointer{
char** sandbox_memory_location_ref;
uint32_t ptr_as_relative_offset;
};
```

and make them byteswap for BE — maybe :> 

So as mentioned the other day, this can be built separately outside of Firefox:

https://github.com/PLSysSec/rlbox_wasm2c_sandbox/

and perhaps we see if the tests pass at all on a BE system, and fix them where they fail.

Although — just turning off RLBox is surely a lot easier, and then we could wait for the paid engineers at the BE companies to fix it, which is my plan ….

Ken

Reply to: