[ZBX-4658] Solaris 10 SPARC 64-bit, zabbix agent, boottime/uptime kstat return type mismatch Created: 2012 Feb 15 Updated: 2017 May 30 Resolved: 2013 Oct 04 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G) |
Affects Version/s: | 1.8.10 |
Fix Version/s: | 1.8.19rc1, 2.0.10rc1, 2.1.8 |
Type: | Incident report | Priority: | Minor |
Reporter: | Janne Korkkula | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | agent, items, solaris | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Zabbix agent 1.8.10 compiled as a 64-bit binary on SPARC Solaris 10, with Sun C 5.11 SunOS_sparc 145354-05 2011/09/13 (Studio 12.2). |
Issue Links: |
|
Description |
src/libs/zbxsysinfo/solaris/boottime.c and uptime.c do not check the kstat return value type and assume an unsigned long, when the correct type is ui32. This results in system.boottime and system.uptime returning insane values. If kn->value.ul is changed to kn->value.ui32, everything works just fine. |
Comments |
Comment by Aleksandrs Saveljevs [ 2013 Oct 03 ] |
The problem seems to manifest depending on whether the agent is compiled as a 32-bit or a 64-bit binary: $ CFLAGS="$CFLAGS -m32" ./configure --enable-agent ... ... $ src/zabbix_agent/zabbix_agentd -t system.boottime system.boottime [u|1372661428] $ src/zabbix_agent/zabbix_agentd -t system.uptime system.uptime [u|8132082] $ CFLAGS="$CFLAGS -m64" ./configure --enable-agent ... ... $ src/zabbix_agent/zabbix_agentd -t system.boottime system.boottime [u|5895535941740658688] $ src/zabbix_agent/zabbix_agentd -t system.uptime system.uptime [u|12551208133349686272] The bug seems to have been there since the very beginning in 2005 (see r2198). Although what
$ svn log ^/ -c 37064
------------------------------------------------------------------------
r37064 | igors | 2013-07-17 14:25:07 +0300 (Wed, 17 Jul 2013) | 2 lines
....I..... [ZBX-6637] added -m64 compilation flag for solaris to be able to understand all attributes of 64-bit processes
------------------------------------------------------------------------
|
Comment by Aleksandrs Saveljevs [ 2013 Oct 04 ] |
Fixed in development branches:
Structure kstat_named_t has a member data_type (see http://www.manpages.spotlynx.com/solaris/man/kstat.3KSTAT), which describes the data type of the stored value. So it was decided to create a function, get_kstat_numeric_value(), which would return the value through the appropriate member of the union. Previously access to the union's value was hardcoded: not just for system.boottime and system.uptime, but in other places, too. |
Comment by Andris Mednis [ 2013 Oct 10 ] |
Branches 1.8 and 2.0 successfully tested. |
Comment by Aleksandrs Saveljevs [ 2013 Oct 11 ] |
Fixed in pre-1.8.19 r39228, pre-2.0.10 r39230 and pre-2.1.8 (trunk) r39231. |