Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-13324

Use of uninitialized nanoseconds on Zabbix proxy

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • None
    • None
    • None
    • None

      Potentially harmless but if client does not send ns then it's used uninitialized, in particular this was spotted while using 1.8 agent with proxy from trunk.

      As you see clock and ns are initialized only in case of failure.

      	if (SUCCEED != get_client_timediff(jp, ts, &client_timediff))
      	{
      		client_timediff.sec = 0;
      		client_timediff.ns = 0;
      	}
      

      However it's possible that on success only sec is initialized

      	if (SUCCEED == zbx_json_value_by_name(jp, ZBX_PROTO_TAG_CLOCK, tmp, sizeof(tmp)))
      	{
      		client_timediff->sec = ts_recv->sec - atoi(tmp);
      
      		if (SUCCEED == zbx_json_value_by_name(jp, ZBX_PROTO_TAG_NS, tmp, sizeof(tmp)))
      		{
      			client_timediff->ns = ts_recv->ns - atoi(tmp);
      
      ==25976== Conditional jump or move depends on uninitialised value(s)
      ==25976==    at 0x5A4857: parse_history_data_row_value (proxy.c:2641)
      ==25976==    by 0x5AE660: parse_history_data (proxy.c:2825)
      ==25976==    by 0x5AE660: process_client_history_data (proxy.c:3097)
      ==25976==    by 0x5AF4DA: process_agent_history_data (proxy.c:3197)
      ==25976==    by 0x44F42B: recv_agenthistory (trapper.c:110)
      ==25976==    by 0x44F42B: process_trap (trapper.c:968)
      ==25976==    by 0x450CA5: process_trapper_child (trapper.c:1118)
      ==25976==    by 0x450CA5: trapper_thread (trapper.c:1168)
      ==25976==    by 0x5475CA: zbx_thread_start (threads.c:128)
      ==25976==    by 0x4209B3: MAIN_ZABBIX_ENTRY (proxy.c:1078)
      ==25976==    by 0x5175B2: daemon_start (daemon.c:392)
      ==25976==    by 0x41E2F9: main (proxy.c:857)
      ==25976==  Uninitialised value was created by a stack allocation
      ==25976==    at 0x5AE1C9: process_client_history_data (proxy.c:3063)
      ==25976== 
      ==25976== Conditional jump or move depends on uninitialised value(s)
      ==25976==    at 0x5A4893: parse_history_data_row_value (proxy.c:2643)
      ==25976==    by 0x5AE660: parse_history_data (proxy.c:2825)
      ==25976==    by 0x5AE660: process_client_history_data (proxy.c:3097)
      ==25976==    by 0x5AF4DA: process_agent_history_data (proxy.c:3197)
      ==25976==    by 0x44F42B: recv_agenthistory (trapper.c:110)
      ==25976==    by 0x44F42B: process_trap (trapper.c:968)
      ==25976==    by 0x450CA5: process_trapper_child (trapper.c:1118)
      ==25976==    by 0x450CA5: trapper_thread (trapper.c:1168)
      ==25976==    by 0x5475CA: zbx_thread_start (threads.c:128)
      ==25976==    by 0x4209B3: MAIN_ZABBIX_ENTRY (proxy.c:1078)
      ==25976==    by 0x5175B2: daemon_start (daemon.c:392)
      ==25976==    by 0x41E2F9: main (proxy.c:857)
      ==25976==  Uninitialised value was created by a stack allocation
      ==25976==    at 0x5AE1C9: process_client_history_data (proxy.c:3063)
      ==25976== 
      ==25976== Conditional jump or move depends on uninitialised value(s)
      ==25976==    at 0x4AAEC3: hc_queue_elem_compare_func (dbcache.c:2880)
      ==25976==    by 0x51F80C: __binary_heap_bubble_up (binaryheap.c:89)
      ==25976==    by 0x5205A9: zbx_binary_heap_insert (binaryheap.c:240)
      ==25976==    by 0x4AE0DE: hc_queue_item (dbcache.c:2936)
      ==25976==    by 0x4AE0DE: hc_add_item_values (dbcache.c:3214)
      ==25976==    by 0x4AE0DE: dc_flush_history.part.2 (dbcache.c:2833)
      ==25976==    by 0x5AD879: process_history_data (proxy.c:2518)
      ==25976==    by 0x5AE823: process_client_history_data (proxy.c:3120)
      ==25976==    by 0x5AF4DA: process_agent_history_data (proxy.c:3197)
      ==25976==    by 0x44F42B: recv_agenthistory (trapper.c:110)
      ==25976==    by 0x44F42B: process_trap (trapper.c:968)
      ==25976==    by 0x450CA5: process_trapper_child (trapper.c:1118)
      ==25976==    by 0x450CA5: trapper_thread (trapper.c:1168)
      ==25976==    by 0x5475CA: zbx_thread_start (threads.c:128)
      ==25976==    by 0x4209B3: MAIN_ZABBIX_ENTRY (proxy.c:1078)
      ==25976==    by 0x5175B2: daemon_start (daemon.c:392)
      ==25976==  Uninitialised value was created by a stack allocation
      ==25976==    at 0x5AE1C9: process_client_history_data (proxy.c:3063)
      ==25976== 
      ==25976== Conditional jump or move depends on uninitialised value(s)
      ==25976==    at 0x51F80F: __binary_heap_bubble_up (binaryheap.c:89)
      ==25976==    by 0x5205A9: zbx_binary_heap_insert (binaryheap.c:240)
      ==25976==    by 0x4AE0DE: hc_queue_item (dbcache.c:2936)
      ==25976==    by 0x4AE0DE: hc_add_item_values (dbcache.c:3214)
      ==25976==    by 0x4AE0DE: dc_flush_history.part.2 (dbcache.c:2833)
      ==25976==    by 0x5AD879: process_history_data (proxy.c:2518)
      ==25976==    by 0x5AE823: process_client_history_data (proxy.c:3120)
      ==25976==    by 0x5AF4DA: process_agent_history_data (proxy.c:3197)
      ==25976==    by 0x44F42B: recv_agenthistory (trapper.c:110)
      ==25976==    by 0x44F42B: process_trap (trapper.c:968)
      ==25976==    by 0x450CA5: process_trapper_child (trapper.c:1118)
      ==25976==    by 0x450CA5: trapper_thread (trapper.c:1168)
      ==25976==    by 0x5475CA: zbx_thread_start (threads.c:128)
      ==25976==    by 0x4209B3: MAIN_ZABBIX_ENTRY (proxy.c:1078)
      ==25976==    by 0x5175B2: daemon_start (daemon.c:392)
      ==25976==    by 0x41E2F9: main (proxy.c:857)
      ==25976==  Uninitialised value was created by a stack allocation
      ==25976==    at 0x5AE1C9: process_client_history_data (proxy.c:3063)
      

            Unassigned Unassigned
            vso Vladislavs Sokurenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: