Bug 102030

Summary: private memory overflow in openCL
Product: Mesa Reporter: Janpieter Sollie <janpieter.sollie>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED INVALID QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: janpieter.sollie
Version: 17.2   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=101952
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 99553    
Attachments: program source
clover dump files
working program source

Description Janpieter Sollie 2017-08-03 17:54:28 UTC
Created attachment 133229 [details]
program source

the program is attached, I debugged using the following:
-gdb break 380 & print answer
-investigation of answer[7] and answer[8]
while in both moments of the program they point to exactly the same array, the content is different.  The only thing that happened in between is the SHA1Init(&ctx), which should not interfere with output[] and k_pad/digest.
Comment 1 Janpieter Sollie 2017-08-03 17:58:37 UTC
Created attachment 133230 [details]
clover dump files
Comment 2 Janpieter Sollie 2017-08-03 18:02:08 UTC
fyi: I ran the program through oclgrind, this reports no problems ...
I ran the program with pocl, there's no problem there,
I ran the program with amdgpu-pro, no problem either
Comment 3 Janpieter Sollie 2017-08-08 10:45:19 UTC
confirmed on -RC3 (initial report on RC2)
Comment 4 Janpieter Sollie 2017-08-09 06:03:52 UTC
I got it running on both pocl and clover.  I will attach a working version with a built_hints.txt file included, which also includes debug information to debug memory contents.
what I concluded:
- atom_add does not work correctly
- this workaround works, where it should not:
        i = ctx->l1;
        i+= len << 3;
        atom_xchg(&(ctx->l1), i);
Comment 5 Janpieter Sollie 2017-08-09 06:09:44 UTC
Created attachment 133403 [details]
working program source

the source contains the following modifications:
-use of local memory
-insertion of debug function
- removal of atom_add
Comment 6 Janpieter Sollie 2017-08-09 13:56:55 UTC
seems like I am a very bad programmer...
after investigating the OpenCL reference manual, I found out my code was unstable, and I need to fix it before I can post something useful

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.