Overview
| Artifact ID: | 807726f0c7af10b52886b77113816b932d743cfa9d21978800ae5b78e12198b4 |
|---|---|
| Ticket: | 37108037b980ea6e705f56a9d983e05ee218dd0c |
| Date: | 2022-08-12 23:20:00 |
| User: | jrtc27 |
| Artifact Attached: | fa4110a46af2a2d696a93ed0d118c4c476076cbc1810022285ca08b08df0ef08 |
| Filename: | 0002-tclInt-Fix-U-INT2PTR-PTR2-U-INT-for-CHERI.patch |
| Description: | [PATCH 2/8] tclInt: Fix (U)INT2PTR/PTR2(U)INT for CHERI This is needed to support CHERI, and thus Arm's experimental Morello prototype, where pointers are implemented using unforgeable capabilities that include bounds and permissions metadata to provide fine-grained spatial and referential memory safety, as well as revocation by sweeping memory to provide heap temporal memory safety. ptrdiff_t and size_t are integer types that can hold (un)signed offsets within an object, but it is not guaranteed that they can round-trip pointers losslessly, unlike (u)intptr_t. On CHERI, the former are plain word-sized integers, but the latter are full capabilities, allowing this metadata to be preserved; if the metadata is not preserved, any attempt to dereference the resulting pointer will trap. Thus, use (u)intptr_t rather than ptrdiff_t/size_t for pointer<->integer casts. Note that these types are defined in stdint.h (and our compat/stdint.h has fallback definitions) so we add an include for that. tclUnixSock also assumed that PTR2INT gave something that could be printed as a size_t but that is not true on CHERI so cast appropriately (and use the unsigned variant of the macro to mirror its use whilst at it). |
Content:
(file is 0 bytes of binary data)