V8 port for platform where code is in execute-only memory

87 views
Skip to first unread message

martin dobrev

unread,
May 26, 2021, 9:43:01 AM5/26/21
to v8-users
Hi, 

Recently i ported v8 for unix base platform (architecture is x64) where all executable memory is "execute only" => each instruction which try to read from  executable  memory result in access violation. The problem is that some of the code generated by `torque` needs to read from the code segments . For example Math.floor defined this constant  `TNode<Float64T> two_52 = Float64Constant(4503599627370496.0E0);`

later used in couple places in function implementation. And `torque` generate following assebly which result in crash, because instuction on '00000000F34A0909' try to read from the code segment.
asm.png

Is there a way to force `torque` to generate immediate/direct mov instead of relative one for constants or maybe i can move them in data segments somehow ? 

Jakob Gruber

unread,
May 31, 2021, 1:46:43 AM5/31/21
to v8-u...@googlegroups.com
Yes, running with a non-readable .text section should work. Pass --no-partial-constant-pool to disable the mechanism you mentioned above.

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/65329c44-c9ed-45be-b600-769260d8a52bn%40googlegroups.com.

martin dobrev

unread,
May 31, 2021, 11:46:03 AM5/31/21
to v8-users
Looks like this do the job.

Thank you for the fast response.

Clemens Backes

unread,
Jun 1, 2021, 8:11:49 AM6/1/21
to v8-u...@googlegroups.com
Note that WebAssembly far jump tables also read the target address from the code object (see JumpTableAssembler::EmitFarJumpSlot). There is no workaround for that, so if you want to support WebAssembly, you would have to change how the far jump table works on x64.



--

Clemens Backes

Software Engineer

clem...@google.com

Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.


This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

martin dobrev

unread,
Jun 1, 2021, 8:28:29 AM6/1/21
to v8-users
Currently I don't need support for wasm.
But just in case I set `--no--expose_wasm` and `--jitless` flags.

Thank you for extra information!
Reply all
Reply to author
Forward
0 new messages