Skip to content

crash in aggregator with flow data containing fields of type IPFIX_TYPE_string or IPFIX_TYPE_octetArray #108

@nickbroon

Description

@nickbroon

Using the following very basic config containing an aggregator, and the attached basic ipfix dump of flows that contain the "applicationId (95)" field, vermont will crash, with the below backtrace in the aggregator hashtable.
Anyone familiar with aggregator/hashtable code able to easily diagnose the cause of the crash?
If the flow capture does not contain the applicationId (95) the aggregator does not crash, so perhaps it related to 'octetArray' field support, or that in this case the field has a length of 5?

./vermont -l debug -f ./vermont.xml >& vermont.log
*** Error in `./vermont': malloc(): memory corruption: 0x00007f240c003670 ***
Aborted (core dumped)
Thread 4 "IpfixReceiver" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff0bca700 (LWP 1030)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff5d09f5d in __GI_abort () at abort.c:90
#2  0x00007ffff5d5228d in __libc_message (action=action@entry=do_abort, 
    fmt=fmt@entry=0x7ffff5e79528 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff5d5964a in malloc_printerr (action=<optimised out>, str=0x7ffff5e75ef0 "malloc(): memory corruption", 
    ptr=<optimised out>, ar_ptr=<optimised out>) at malloc.c:5426
#4  0x00007ffff5d5d42d in _int_malloc (av=av@entry=0x7fffe8000020, bytes=bytes@entry=48) at malloc.c:3741
#5  0x00007ffff5d5ff3e in __GI___libc_malloc (bytes=48) at malloc.c:3086
#6  0x00007ffff66ae458 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00005555557b80c1 in InstanceManager<BucketListElement>::getNewInstance (this=0x555555b9de90)
    at /home/user/vermont/src/core/InstanceManager.h:95
#8  0x00005555557bc318 in FlowHashtable::bufferDataBlock (this=0x555555b9daa0, data=...)
    at /home/user/vermont/src/modules/ipfix/aggregator/FlowHashtable.cpp:542
#9  0x00005555557bd7ff in FlowHashtable::aggregateDataRecord (this=0x555555b9daa0, record=0x7fffe8013550)
    at /home/user/vermont/src/modules/ipfix/aggregator/FlowHashtable.cpp:749
#10 0x0000555555744bab in IpfixAggregator::onDataRecord (this=0x555555b9d910, record=0x7fffe8013550)
    at /home/user/vermont/src/modules/ipfix/aggregator/IpfixAggregator.cpp:76
#11 0x0000555555718810 in IpfixRecordDestination::receive (this=0x555555b9da88, ipfixRecord=0x7fffe8013550)
    at /home/user/vermont/src/modules/ipfix/IpfixRecordDestination.cpp:40
#12 0x000055555569f20b in Source<IpfixRecord*>::send (this=0x555555b9d740, t=0x7fffe8013550)
    at /home/user/vermont/src/core/Source.h:98
#13 0x000055555571179a in IpfixCollector::send (this=0x555555b9d6e0, ipfixRecord=0x7fffe8013550)
    at /home/user/vermont/src/modules/ipfix/IpfixCollector.cpp:102
#14 0x000055555579d5b0 in IpfixParser::push (this=0x555555b9d820, ipfixRecord=0x7fffe8013550)
    at /home/user/vermont/src/modules/ipfix/IpfixParser.cpp:771
#15 0x00005555557998c3 in IpfixParser::processDataSet (this=0x555555b9d820, sourceId=..., message=..., 
    set=0x7fffe8013c00, endOfMessage=0x7fffe8013c64 "")
    at /home/user/vermont/src/modules/ipfix/IpfixParser.cpp:352
#16 0x000055555579bce1 in IpfixParser::processIpfixPacket (this=0x555555b9d820, message=..., length=116, sourceId=...)
    at /home/user/vermont/src/modules/ipfix/IpfixParser.cpp:608
#17 0x000055555579c967 in IpfixParser::processPacket (this=0x555555b9d820, message=..., length=116, sourceId=...)
    at /home/user/vermont/src/modules/ipfix/IpfixParser.cpp:676
#18 0x0000555555796e0d in IpfixReceiverFile::run (this=0x555555b942e0)
    at /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:287
#19 0x0000555555708461 in IpfixReceiver::threadWrapper (ipfixReceiver_=0x555555b942e0)
    at /home/user/vermont/src/modules/ipfix/IpfixReceiver.cpp:170
#20 0x00007ffff7bbd7fc in start_thread (arg=0x7ffff0bca700) at pthread_create.c:465
#21 0x00007ffff5de5b5f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
<ipfixConfig>

<ipfixReceiverFile id="1">
  <next>2</next>
</ipfixReceiverFile>

<ipfixAggregator id="2">
<!-- Aggregator agg1 -->
        <rule>
                <flowKey>
                       <ieName>destinationIPv4Address</ieName>
                       <autoAddV4PrefixLength>false</autoAddV4PrefixLength>
                </flowKey>
                <flowKey>
                       <ieName>sourceIPv4Address</ieName>
                       <autoAddV4PrefixLength>false</autoAddV4PrefixLength>
                </flowKey>
                <nonFlowKey>
                       <ieName>applicationId</ieName>
                </nonFlowKey>
        </rule>
        <expiration>
               <inactiveTimeout unit="sec">5</inactiveTimeout>
               <activeTimeout unit="sec">30</activeTimeout>
        </expiration>
        <next>3</next><!-- Exporter exp1 -->
</ipfixAggregator>

<ipfixExporter id="3">
<!-- Exporter exp1 -->
        <protocolVersion>NFV9</protocolVersion>
        <maxRecordRate>0</maxRecordRate>
        <collector>
                <transportProtocol>UDP</transportProtocol>
                <ipAddress>10.10.10.1</ipAddress>
                <port>2055</port>
        </collector>
</ipfixExporter>

</ipfixConfig>
17:23:47.651[0] WARNING /home/user/vermont/src/vermont.cc:340: starting up vermont config manager
17:23:47.651[0] NOTICE /home/user/vermont/src/modules/ipfix/IpfixReceiverFileCfg.cpp:71: CollectorConfiguration: Successfully parsed collectingProcess section
17:23:47.651[0] NOTICE /home/user/vermont/src/modules/ipfix/IpfixExporterCfg.cpp:40: Exporter: using maximum rate of 0 records/second
17:23:47.651[0] NOTICE /home/user/vermont/src/core/Connector.cpp:51: Connecting module ipfixReceiverFile[Id = 1] -> ipfixAggregator[Id = 2]
17:23:47.651[0]   INFO /home/user/vermont/src/core/Connector.cpp:54: connecting instances
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:128: IpfixReceiverFile initialized with the following parameters:
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:129:   - packet_file_directory = ./
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:130:   - packet_file_basename = ipfix.dump
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:131:   - Start (from) = 0
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:132:   - End (to) = 0
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:133:   - ignoreTimestamps = true
17:23:47.652[0]   INFO /home/user/vermont/src/modules/ipfix/IpfixRecord.cpp:167: received unknown field type applicationId (id=95, length=65535)
17:23:47.652[0]   INFO /home/user/vermont/src/modules/ipfix/aggregator/Rule.cpp:82: valid protocols for this template: 07
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/aggregator/BaseHashtable.cpp:59: Hashtable initialized with following parameters:
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/aggregator/BaseHashtable.cpp:60:   - inactiveTimeout=5
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/aggregator/BaseHashtable.cpp:61:   - activeTimeout=30
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/aggregator/BaseHashtable.cpp:62:   - htableBits=17
17:23:47.652[0]   INFO /home/user/vermont/src/modules/ipfix/IpfixRecord.cpp:279: TemplateInfo: need to increase number of uniqueIds, oldSize=0
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/aggregator/BaseAggregator.cpp:135: Done. Parsed 1 rules; inactiveTimeout 5, activeTimeout 30
17:23:47.652[0] NOTICE /home/user/vermont/src/core/Connector.cpp:51: Connecting module ipfixAggregator[Id = 2] -> ipfixExporter[Id = 3]
17:23:47.652[0]   INFO /home/user/vermont/src/core/Connector.cpp:54: connecting instances
17:23:47.652[0]   INFO /home/user/vermont/src/modules/ipfix/IpfixSender.cpp:114: IpfixSender: running
17:23:47.652[0]   INFO /home/user/vermont/src/modules/ipfix/IpfixExporterCfg.cpp:128: IpfixExporter: adding collector UDP://10.10.10.1:2055
17:23:47.652[0] NOTICE /home/user/vermont/src/modules/ipfix/IpfixSender.cpp:191: IpfixSender: adding UDP://10.10.10.1:2055 to exporter
17:23:47.652[0] CRITICAL /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:234: getsockopt(...,IP_MTU,...) failed, Transport endpoint is not connected
17:23:47.652[0]   INFO /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:593: get_mtu() returned -1
17:23:47.652[0]   INFO /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:879: Removing collector.
17:23:47.652[0]   INFO /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:893: Closing data socket
17:23:47.652[0] CRITICAL /home/user/vermont/src/modules/ipfix/IpfixSender.cpp:230: IpfixSender: ipfix_add_collector of 10.10.10.1:2055 to exporter
17:23:47.652[0] WARNING /home/user/vermont/src/core/Cfg.h:265: queue is required by module id=3 but is not configured. Inserting a default queue with max size 1 (attention: this is inefficient!)
17:23:47.652[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:260: NodeID=0, Modulename=ipfixReceiverFile
17:23:47.652[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:228: called (0)
17:23:47.652[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:235: module 0 -> module 1
17:23:47.652[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:228: called (1)
17:23:47.652[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:235: module 1 -> module 2
17:23:47.652[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:228: called (2)
17:23:47.652[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:243: postI[0] = 2
17:23:47.653[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:243: postI[1] = 1
17:23:47.653[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:243: postI[2] = 0
17:23:47.653[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:260: NodeID=1, Modulename=ipfixAggregator
17:23:47.653[0]  DEBUG /home/user/vermont/src/core/Graph.cpp:260: NodeID=2, Modulename=ipfixExporter
17:23:47.653[0]   INFO /home/user/vermont/src/core/Graph.cpp:271: topological sort #0: ipfixReceiverFile[1]
17:23:47.653[0]   INFO /home/user/vermont/src/core/Graph.cpp:271: topological sort #1: ipfixAggregator[2]
17:23:47.653[0]   INFO /home/user/vermont/src/core/Graph.cpp:271: topological sort #2: ipfixExporter[3]
17:23:47.653[0] NOTICE /home/user/vermont/src/modules/ConfigManager.cpp:201: Starting module ipfixExporter
17:23:47.653[0]   INFO /home/user/vermont/src/common/TimeoutSemaphore.h:262: restarting
17:23:47.653[0]   INFO /home/user/vermont/src/common/TimeoutSemaphore.h:262: restarting
17:23:47.653[0]   INFO /home/user/vermont/src/common/Thread.h:44: creating new thread: ConnectionQueue
17:23:47.653[0] NOTICE /home/user/vermont/src/modules/ConfigManager.cpp:201: Starting module ipfixAggregator
17:23:47.653[0]   INFO /home/user/vermont/src/modules/ipfix/aggregator/BaseAggregator.cpp:65: called
17:23:47.653[0]   INFO /home/user/vermont/src/core/InstanceManager.h:103: adding used instance 0x5596a8ea6790
17:23:47.653[1]   INFO /home/user/vermont/src/core/ConnectionQueue.h:262: starting thread
17:23:47.653[0]   INFO /home/user/vermont/src/core/ConnectionQueue.h:54: receive(Packet*)
17:23:47.653[0]  DEBUG /home/user/vermont/src/common/ConcurrentQueue.h:68: () trying to push element (0 elements in queue)
17:23:47.653[0]  DEBUG /home/user/vermont/src/common/ConcurrentQueue.h:91: () element pushed (1 elements in queue)
17:23:47.653[0]   INFO /home/user/vermont/src/common/Thread.h:44: creating new thread: BaseAggregator
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ConcurrentQueue.h:37: () element popped
17:23:47.653[1]   INFO /home/user/vermont/src/modules/ipfix/IpfixSender.cpp:269: IpfixSender: Template received (setid=2, id=0)
17:23:47.653[0] NOTICE /home/user/vermont/src/modules/ConfigManager.cpp:201: Starting module ipfixReceiverFile
17:23:47.653[1]   INFO /home/user/vermont/src/modules/ipfix/IpfixSender.cpp:304: IpfixSender: Use Template ID 256 instead of 0.
17:23:47.653[0]   INFO /home/user/vermont/src/common/Thread.h:44: creating new thread: IpfixReceiver
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:956: ipfix_find_template with ID: 256
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:972: ipfix_get_free_template_slot
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:977: ipfix_get_free_template_slot found at 0
17:23:47.653[2] NOTICE /home/user/vermont/src/modules/ipfix/aggregator/BaseAggregator.cpp:157: Polling aggregator each 0 msec
17:23:47.653[0] WARNING /home/user/vermont/src/vermont.cc:347: vermont is up and running
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:956: ipfix_find_template with ID: 256
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:964: ipfix_find_template with ID: 256, validity 1 found at 0
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:174: IpfixReceiverFile: Trying to read message from file "./ipfix.dump0000000000"
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2612: template found at 0
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2613: A p_pos 0x7f241c0015f0, p_end 0x7f241c001610
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2614: max_fields_length 32
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2615: fields_length 8
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2620: B p_pos 0x7f241c0015f8, p_end 0x7f241c001610
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:286: Data block starts with: 0 a 0 7c
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:956: ipfix_find_template with ID: 256
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/IpfixRecord.cpp:279: TemplateInfo: need to increase number of uniqueIds, oldSize=1
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:964: ipfix_find_template with ID: 256, validity 1 found at 0
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/TemplateBuffer.cpp:138: Destroy template - no matching template found (id=256)
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2612: template found at 0
17:23:47.653[3]   INFO /home/user/vermont/src/core/InstanceManager.h:103: adding used instance 0x7f240c013a60
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2613: A p_pos 0x7f241c0015f0, p_end 0x7f241c001610
17:23:47.653[3]   INFO /home/user/vermont/src/core/InstanceManager.h:151: removing used instance 0x7f240c013a60
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2614: max_fields_length 32
17:23:47.653[3]  DEBUG /home/user/vermont/src/modules/ipfix/IpfixParser.cpp:646: IPFIX message from 1.0.0.127:0 ( contained 0 Data Records and 1 Template Records. Sequence number was 0.
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2615: fields_length 12
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/IpfixReceiverFile.cpp:286: Data block starts with: 0 a 0 74
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2620: B p_pos 0x7f241c0015fc, p_end 0x7f241c001610
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/TemplateBuffer.cpp:43: ALL TEMPLATES ---------------------------
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:956: ipfix_find_template with ID: 256
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/TemplateBuffer.cpp:45: bt->sourceID odid 0 exporter port 0 collector port 0 exporter ip 1.0.0.127 len 4 prot 0 ptr: 0x7f240c0011a0 size: 40 expires in -1520875427 sec
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:964: ipfix_find_template with ID: 256, validity 1 found at 0
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/TemplateBuffer.cpp:49: END ALL TEMPLATES --------------------------
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2612: template found at 0
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/TemplateBuffer.cpp:52: Searching for : sourceID 0 0 0 1.0.0.127  4 0
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2613: A p_pos 0x7f241c0015f0, p_end 0x7f241c001610
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/TemplateBuffer.cpp:62: Template found.
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2614: max_fields_length 32
17:23:47.653[3]   INFO /home/user/vermont/src/core/InstanceManager.h:103: adding used instance 0x7f240c013550
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2615: fields_length 16
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/aggregator/IpfixAggregator.cpp:57: Got a Data Record

17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:2620: B p_pos 0x7f241c001600, p_end 0x7f241c001610
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/aggregator/IpfixAggregator.cpp:75: rule 0 matches

17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:956: ipfix_find_template with ID: 256
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/aggregator/FlowHashtable.cpp:672: called
17:23:47.653[1]  DEBUG /home/user/vermont/src/common/ipfixlolib/ipfixlolib.c:964: ipfix_find_template with ID: 256, validity 1 found at 0
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/aggregator/FlowHashtable.cpp:724: Tried to set mask of length 4 IP address
17:23:47.653[1]   INFO /home/user/vermont/src/modules/ipfix/IpfixSender.cpp:358: IpfixSender: created template with ID 256
17:23:47.653[3]   INFO /home/user/vermont/src/modules/ipfix/aggregator/FlowHashtable.cpp:709: Tried to set mask of length 4 IP address

17:23:47.653[1]   INFO /home/user/vermont/src/core/InstanceManager.h:151: removing used instance 0x5596a8ea6790
17:23:47.654[3]  DEBUG /home/user/vermont/src/modules/ipfix/aggregator/FlowHashtable.cpp:459: nhash=12553
17:23:47.654[3]  DEBUG /home/user/vermont/src/modules/ipfix/aggregator/FlowHashtable.cpp:536: creating new bucket

vermont.xml.gz
ipfix.dump0000000000.gz
vermont.log.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions