.
A 0004-tclExecute-Fix-for-CHERI-by-not-assuming-ptrdiff_t-i.patch 37108037b980ea6e705f56a9d983e05ee218dd0c 90c8e607b4b43da4ad6ef8d3e22f19be2d688837b2aa8d18c183f168998aa040
C [PATCH\s4/8]\stclExecute:\sFix\sfor\sCHERI\sby\snot\sassuming\sptrdiff_t\sis\sa\spointer\r\n\r\nThis\sis\sneeded\sto\ssupport\sCHERI,\sand\sthus\sArm's\sexperimental\sMorello\r\nprototype,\swhere\spointers\sare\simplemented\susing\sunforgeable\scapabilities\r\nthat\sinclude\sbounds\sand\spermissions\smetadata\sto\sprovide\sfine-grained\r\nspatial\sand\sreferential\smemory\ssafety,\sas\swell\sas\srevocation\sby\ssweeping\r\nmemory\sto\sprovide\sheap\stemporal\smemory\ssafety.\r\n\r\nptrdiff_t\sis\san\sinteger\stype\sthat\scan\shold\sa\ssigned\soffset\swithin\san\r\nobject.\sOn\sCHERI,\sthis\sis\sa\sword-sized\sinteger,\sbut\spointers\sare\r\ncapabilities,\stwice\sthe\ssize\sof\sthat.\sThe\stype\spointed\sto\sby\scatchTop\r\nmust\sbe\sthe\ssame\ssize\sas\sthe\sactual\sobject\sstack\sentries\s(Tcl_Obj\s*)\sbut\r\ncatchTop\sis\scurrently\sa\sptrdiff_t\s*\sso\son\sCHERI\sthis\sdoes\snot\scurrently\r\nhold,\sgiving\ssimilar\sbehaviour\sas\ssen\son\s64-bit\sWindows\swith\sthe\sinitial\r\nbacked-out\sfix\sfor\sbug\s3274728.\r\n\r\nInstead,\suse\sa\spointer\stype\sfor\scatchTop's\spointee\stype.\sWe\scould\suse\r\nintptr_t\sand\sthat\swould\swork\son\sCHERI,\sbut\sthe\sC\sstandard\sdoes\snot\sin\r\nfact\sguarantee\sthat\s(u)intptr_t\sare\sthe\ssame\ssize\sas\sobject\spointers,\r\nmerely\sthat\sa\spointer\scan\sbe\scast\sto\s(u)intptr_t\sand\sback\slosslessly\r\n(thus,\s(u)int64_t\swould\sbe\sa\sconforming,\sif\sfoolish,\simplementation\sof\r\n(u)intptr_t\son\sa\ssystem\swhere\spointers\sthemselves\sare\srepresented\sas\r\n32-bit\sintegers).\sTo\sbe\ssure\sthe\ssizes\sagree,\suse\sTcl_Obj\s*\sas\sthe\r\npointee\stype\sfor\scatchTop\sas\swell\sand\s(un)wrap\swith\sPTR2INT/INT2PTR\sas\r\nneeded;\sthis\salso\sallows\sstack\sto\sbe\sa\sTcl_Obj\s*[1]\sand\sremoves\scasting\r\nin\sinitCatchTop\sand\sinitTosPtr,\smaking\sit\sclear\sthese\stypes\sare\smeant\sto\r\nbe\sthe\ssame.
D 2022-08-12T23:20:46.413
U jrtc27
Z 33450338bd526c457c9b2419626a3512