Bug 1652635

Summary: There is a heap-buffer-overflow that the heap is allocated at src/generator_spgemm_csc_reader.c:125 and triggered at function libxsmm_sparse_csc_reader in libxsmm.
Product: [Fedora] Fedora Reporter: shuitao gan <ganshuitao>
Component: libxsmmAssignee: Dave Love <dave.love>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: rawhideCC: dave.love, dominik, ganshuitao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-23 16:28:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
./libxsmm_gemm_generator sparse b a 10 10 10 1 1 1 1 1 1 0 wsm nopf SP POC3 none

Description shuitao gan 2018-11-22 13:43:46 UTC
Created attachment 1507971 [details]
./libxsmm_gemm_generator sparse b a 10 10 10 1 1 1 1 1 1 0 wsm nopf SP POC3

version: libxsmm release-1.10
summary: 

There is a  heap-buffer-overflow that the heap is allocated at src/generator_spgemm_csc_reader.c:125 and triggered at function libxsmm_sparse_csc_reader in libxsmm.

Description:

The asan debug is as follows:

$./libxsmm_gemm_generator sparse b a 10 10 10 1 1 1 1 1 1 0 wsm nopf SP POC3

==57982==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efa8 at pc 0x000000444861 bp 0x7fff4a1d77d0 sp 0x7fff4a1d77c0
WRITE of size 4 at 0x60200000efa8 thread T0
    #0 0x444860 in libxsmm_sparse_csc_reader src/generator_spgemm_csc_reader.c:178
    #1 0x405751 in libxsmm_generator_spgemm src/generator_spgemm.c:279
    #2 0x40225a in main src/libxsmm_generator_gemm_driver.c:318
    #3 0x7f38cd057a3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
    #4 0x402ea8 in _start (/home/company/real_sanitize/poc_check/libxsmm/libxsmm_gemm_generator_asan+0x402ea8)

0x60200000efa8 is located 8 bytes to the left of 8-byte region [0x60200000efb0,0x60200000efb8)
allocated by thread T0 here:
    #0 0x7f38cd6b79aa in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x989aa)
    #1 0x443fed in libxsmm_sparse_csc_reader src/generator_spgemm_csc_reader.c:124
    #2 0x7fff4a1d7bcf  (<unknown module>)
    #3 0x439  (<unknown module>)

SUMMARY: AddressSanitizer: heap-buffer-overflow src/generator_spgemm_csc_reader.c:178 libxsmm_sparse_csc_reader
Shadow bytes around the buggy address:
  0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9df0: fa fa 01 fa fa[fa]00 fa fa fa 04 fa fa fa 04 fa
  0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==57982==ABORTING

Comment 1 Dave Love 2018-11-22 15:41:26 UTC
Like #1652633, what source is this?

Comment 2 shuitao gan 2018-11-23 00:49:28 UTC
(In reply to Dave Love from comment #1)
> Like #1652633, what source is this?

https://github.com/hfp/libxsmm

Comment 3 Dave Love 2018-11-23 16:28:14 UTC
This doesn't seem to be a Fedora bug.