<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">and I just fond a lot of other cases where it does not work.&nbsp;<div class="">I think I will rever my change (with pinning) and think a bit further… it still remains the fact that same code in Alien side does not make any check at all… :(</div><div class=""><br class=""></div><div class="">Esteban<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 08 Dec 2015, at 13:59, Esteban Lorenzano &lt;<a href="mailto:estebanlm@gmail.com" class="">estebanlm@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 08 Dec 2015, at 13:47, Esteban Lorenzano &lt;<a href="mailto:estebanlm@gmail.com" class="">estebanlm@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">Some days ago I submitted a small change at ThreadedFFIPlugin&gt;&gt;#ffiAddressOf: rcvr startingAt: byteOffset size: byteSize</div><div class=""><br class=""></div><div class="">to restore a security level:&nbsp;</div><div class=""><br class=""></div><div class=""><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>"don't you dare to read from object memory (unless is pinned)!"</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>(addr = 0 or: [(interpreterProxy isInMemory: addr) or: [(interpreterProxy isPinned: rcvr) not]])</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                        </span>ifTrue:[^interpreterProxy primitiveFail].</div></div><div class=""><br class=""></div><div class="">if you remember, before (at the origin) that method was validating #isInMemory, but I took it out because it was making some test failing and because if found it incorrect.&nbsp;</div><div class="">Then, after talk with Eliot (and after I took some vacations in the middle), he suggested that internal object should be pinned, so I submitted the change you can see.</div><div class=""><br class=""></div><div class="">Now, the problem is now the test FFIPluginTests&gt;&gt;#testPointers fails because it returns a structure and we try to access its fields.&nbsp;</div><div class=""><br class=""></div><div class="">Problem is solved if I edit the tests to add a pin:</div><div class=""><br class=""></div><div class=""><div class="">FFIPluginTests&gt;&gt;#testPointers</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>"Test passing and returning of pointers to structs"</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>| pt1 pt2 pt3 |</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>pt1 := FFITestPoint4 new.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>pt1 x: 1. pt1 y: 2. pt1 z: 3. pt1 w: 4.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>pt2 := FFITestPoint4 new.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>pt2 x: 5. pt2 y: 6. pt2 z: 7. pt2 w: 8.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>pt3 := FFITestLibrary ffiTestPointers: pt1 with: pt2.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span><b class="">pt3 getHandle pin.&nbsp;“HERE THE CHANGE"</b></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>self assert: pt3 x = 6.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>self assert: pt3 y = 8.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>self assert: pt3 z = 10.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>self assert: pt3 w = 12.</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">mmm… that change will not work on non-spur images :(</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">I will submit the change, but now I wonder (again) if forcing a pin is correct.&nbsp;</div><div class="">Of course, pinning it is safe because it prevents errors if object is moved… but well, I wonder :)</div><div class=""><br class=""></div><div class="">Esteban</div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></body></html>