Summary: | net-snmp memory leak with lm_sensors patch | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Ronan Mullally <ronan> |
Component: | [OLD] Server | Assignee: | Gentoo Netmon project <netmon> |
Status: | RESOLVED WONTFIX | ||
Severity: | major | CC: | daniel, deepee, henrik |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
valgrind.log
fix memory leaks in hr_sensor.c |
Description
Ronan Mullally
2005-10-19 02:59:32 UTC
(In reply to comment #0) I do have the same issues. It is sufficient to issue several requests to the snmpd per second over the span of a few hours to have snmpd consume more than 100MB. Created attachment 76955 [details]
valgrind.log
Indeed, there is a memory leak related to the patch.
Tested with:
valgrind --leak-check=yes /usr/sbin/snmpd &> valgrind.log
I had a look at Fedora's rawhide (the patch came originally from RedHat), and it seems this patch is gone from their sources altogether. I do not have the Valgrind expertise to fix this problem. I commented the parts of the ebuilds related to the patch so that people who really want it can simply comment it out. I am not doing a revision bump because the lm_sensors USE flag is off by default and net-snmp is a lengthy compile. netmon: if you feel differently, please revbump 5.2.1.2-r1 and 5.2.2-r1. I'm marking this as WONTFIX. If anyone believes himself to be able to fix this problem, please reopen the bug and attach a patch. *** Bug 121031 has been marked as a duplicate of this bug. *** There is no need to disable the lm_sensors useflag completely since net-snmp already has support for it builtin. Just uncomment use lm_sensors && mibs="${mibs} ucd-snmp/lmSensors" in src_compile (and the DEPEND one) and remerge net-snmp with lm_sensors useflag enabled. I'm running a while (true); do snmpwalk -v 2c -c public localhost >/dev/null; done right now and there's no change in memory consumption (as shown in top) so I'm assuming that the memory leak is in the patch. I'm wondering if we even need that patch since the output looks fine form what I can tell. Thanks Daniel, your suggestion is in cvs. Created attachment 84849 [details, diff]
fix memory leaks in hr_sensor.c
apply after original net-snmp-lm_sensors.patch
I would change this row: strncpy(string, sensor->name, strlen(sensor->name)); to: strncpy(string, sensor->name, sizeof(string)); as it may lead to an buffer overflow if sensor->name is longer than string. I may be wrong as I am no C programmer, but that's my 2 cents =) |