SMP netlrts/verbs: fix out of bounds array access by comm thread12/2012/1
commit9f8f812558c6d24ac68224b87e56999b7df74052
authorPhil Miller <mille121@illinois.edu>
Thu, 1 Dec 2016 04:14:18 +0000 (30 22:14 -0600)
committerPhil Miller <mille121@illinois.edu>
Thu, 1 Dec 2016 04:14:18 +0000 (30 22:14 -0600)
tree25f89f9c7291ddd6bd25336b946fe11a4504efd2
parent34a1b17a494533382f8c1fe64b17e0fbc7d8f211
SMP netlrts/verbs: fix out of bounds array access by comm thread

Fixes this very copious valgrind report:

$ valgrind --fair-sched=yes --error-limit=no ./pgm +ppn 4
    Memcheck, a memory error detector
    Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
    Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
    Command: ./pgm +ppn 4

Charm++: standalone mode (not using charmrun)
Charm++> Running in SMP mode: numNodes 1,  4 worker threads per process
Charm++> The comm. thread both sends and receives messages
Converse/Charm++ Commit ID: v6.7.0-463-g34a1b17
proc module init
    Thread 5:
    Invalid read of size 4
       at 0x41901E: CommunicationServerNet (machine-eth.c:709)
       by 0x419255: LrtsAdvanceCommunication (machine.c:1699)
       by 0x415AE9: AdvanceCommunication (machine-common-core.c:1317)
       by 0x4152D6: CommunicationServer (machine-common-core.c:1341)
       by 0x4152B2: CommunicationServerThread (machine-common-core.c:1360)
       by 0x41521D: ConverseRunPE (machine-common-core.c:1292)
       by 0x41A480: call_startfn (machine-smp.c:406)
       by 0x4E3E463: start_thread (pthread_create.c:333)
       by 0x5BDC9DE: clone (clone.S:105)
     Address 0x5ea4cc0 is 0 bytes after a block of size 16 alloc'd
       at 0x4C2CBC5: calloc (vg_replace_malloc.c:711)
       by 0x414D26: LrtsInit (machine.c:2180)
       by 0x4145E3: ConverseInit (machine-common-core.c:1099)
       by 0x405772: main (commbench.c:159)

    Invalid write of size 4
       at 0x419024: CommunicationServerNet (machine-eth.c:709)
       by 0x419255: LrtsAdvanceCommunication (machine.c:1699)
       by 0x415AE9: AdvanceCommunication (machine-common-core.c:1317)
       by 0x4152D6: CommunicationServer (machine-common-core.c:1341)
       by 0x4152B2: CommunicationServerThread (machine-common-core.c:1360)
       by 0x41521D: ConverseRunPE (machine-common-core.c:1292)
       by 0x41A480: call_startfn (machine-smp.c:406)
       by 0x4E3E463: start_thread (pthread_create.c:333)
       by 0x5BDC9DE: clone (clone.S:105)
     Address 0x5ea4cc0 is 0 bytes after a block of size 16 alloc'd
       at 0x4C2CBC5: calloc (vg_replace_malloc.c:711)
       by 0x414D26: LrtsInit (machine.c:2180)
       by 0x4145E3: ConverseInit (machine-common-core.c:1099)
       by 0x405772: main (commbench.c:159)

    Invalid read of size 4
       at 0x419217: CommunicationServerNet (machine-eth.c:749)
       by 0x419255: LrtsAdvanceCommunication (machine.c:1699)
       by 0x415AE9: AdvanceCommunication (machine-common-core.c:1317)
       by 0x4152D6: CommunicationServer (machine-common-core.c:1341)
       by 0x4152B2: CommunicationServerThread (machine-common-core.c:1360)
       by 0x41521D: ConverseRunPE (machine-common-core.c:1292)
       by 0x41A480: call_startfn (machine-smp.c:406)
       by 0x4E3E463: start_thread (pthread_create.c:333)
       by 0x5BDC9DE: clone (clone.S:105)
     Address 0x5ea4cc0 is 0 bytes after a block of size 16 alloc'd
       at 0x4C2CBC5: calloc (vg_replace_malloc.c:711)
       by 0x414D26: LrtsInit (machine.c:2180)
       by 0x4145E3: ConverseInit (machine-common-core.c:1099)
       by 0x405772: main (commbench.c:159)

    Invalid write of size 4
       at 0x41921D: CommunicationServerNet (machine-eth.c:749)
       by 0x419255: LrtsAdvanceCommunication (machine.c:1699)
       by 0x415AE9: AdvanceCommunication (machine-common-core.c:1317)
       by 0x4152D6: CommunicationServer (machine-common-core.c:1341)
       by 0x4152B2: CommunicationServerThread (machine-common-core.c:1360)
       by 0x41521D: ConverseRunPE (machine-common-core.c:1292)
       by 0x41A480: call_startfn (machine-smp.c:406)
       by 0x4E3E463: start_thread (pthread_create.c:333)
       by 0x5BDC9DE: clone (clone.S:105)
     Address 0x5ea4cc0 is 0 bytes after a block of size 16 alloc'd
       at 0x4C2CBC5: calloc (vg_replace_malloc.c:711)
       by 0x414D26: LrtsInit (machine.c:2180)
       by 0x4145E3: ConverseInit (machine-common-core.c:1099)
       by 0x405772: main (commbench.c:159)

Change-Id: Ia6bc094e93345648baea2409149e2f9132de4e07
src/arch/netlrts/machine.c
src/arch/verbs/machine.c