[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] Armv8 crash in MVC (Issue #617)

tim Rowledge tim at rowledge.org
Wed Mar 9 22:04:59 UTC 2022


Brilliant analysis. How much of our lives is messed up by singed/unisgned/16/32/64 bits and the joy of C decls...

> On 2022-03-09, at 1:06 PM, Nicolas Cellier <notifications at github.com> wrote:
> 
> 
> fastPathBottomToTop does not do much... It just reverse the line order.
> https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/f5f0e7d98effd7217dded6ed9397b2cac1f787ad/platforms/Cross/plugins/BitBltPlugin/BitBltGeneric.c#L517
> 
> I foresee two cases where it could fail:
> 
> 	• the fast operation by itself has a BUG (whatether BottomToTop or not)
> 	• some integer operations are carried on a larger integer type, transforming negative pitch into a large positive int
> The later is possible because srcPitch and dstPitch are declared usqInt in operation_t
> https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/f5f0e7d98effd7217dded6ed9397b2cac1f787ad/platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.h#L98
> 
> usqInt is 64bits on ARM64, so far so good, unfortunately those variables are copied to 32 bits local temps in
> https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/f5f0e7d98effd7217dded6ed9397b2cac1f787ad/platforms/Cross/plugins/BitBltPlugin/BitBltInternal.h#L137
> 
> I think that it is the mistake, because pointer arithmetic in 64 bits will be performed with 64 bits size_t, and the uint32_t will just move the pointer a large amount forward (2^32-pitch) instead of backward (-pitch).
> 
> So I think that declaring the local srcPitch and dstPitch as usqInt instead of uint32_t might fix the bug.
> 
> I have no ARM64 at hand to play with, so up to you to verify the hypothesis.
> 
>> Reply to this email directly, view it on GitHub, or unsubscribe.
> Triage notifications on the go with GitHub Mobile for iOS or Android. 
> You are receiving this because you commented.
> 


tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: DMZ: Divide Memory by Zero




More information about the Vm-dev mailing list