On Mon, Apr 7, 2025 at 10:33 AM Dan McDonald <
[email protected]> wrote:

> Due to node trying to bring in more recent versions of V8, I was informed
> about it not building on illumos (Node calls it SmartOS but it's really
> applicable to all illumos distros).
>
> After some searching and debug-by-printf, I found this line:
>
> https://github.com/v8/v8/blob/main/src/sandbox/js-dispatch-table.h#L81
>
> At first glance, this line appears to assume that pointers have all-zeroes
> at the top, for free use.  This is not true for illumos, which sets its
> heap pointers starting at:
>
> #define USERLIMIT       ADDRESS_C(0xfffffc7fffe00000)
>
> It gets more hard to understand, however, given that:
>
> - It's a 16-bit mask, but used with 32-bit inputs like here:
>
>
> https://github.com/v8/v8/blob/main/src/sandbox/js-dispatch-table-inl.h#L192-L195
>
> - The 32-bit input has no mask collision with the 0xffff000000000000
> definition of the next_entry_index variable.
>
> This feels like a bug to me,
>

No, that code is fine. It is entirely intentional to not have a collision
between the top 16 bits in the kFreeEntryTag and the lower 32-bits payload.


> and if ones pointers have the high 16 bits set to 0, it might be an
> undetected one.
>
> I may be missing something, and am glad to be educated,. To my eyes,
> either this code did not consider getting pointers with the high-16-bits
> set to non-zero values,
>

Yes, that code is quite clearly written for OSs where the upper 16 bits of
a 64-bit pointer are always zero.
For other OSs this will need adaptation. I don't have a specific
suggestion, and am not planning to work on it. If you want to work on a
patch yourself, please keep in mind to make it as non-intrusive as
possible: since such OSs are officially unsupported, we wouldn't want to
pay a large code complexity price for them.

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/v8-dev/CAKSzg3RgSsR3q2RSsAnUffnM%3DJd6weEVQF87CO-iZg_c4og7Gg%40mail.gmail.com.

Reply via email to