[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-coders
Subject:    Re: Core dump with net-snmp-5.8
From:       Anders Wallin <wallinux () gmail ! com>
Date:       2019-04-11 14:58:42
Message-ID: CAF2baFedJK_sY5kMzXYNFfN3+zGrdCw0tQ+bOCQHxQ0Y18wNgQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Sam,

I'm not a maintainer for net-snmp, but it was merged into 5-8-patches
yesterday

Regards
Anders Wallin


On Wed, Apr 10, 2019 at 8:04 PM Sam Tannous <stannous@cumulusnetworks.com>
wrote:

> Hi Anders,
>
> We've been testing the patch for
>
> https://sourceforge.net/p/net-snmp/bugs/2914/
>
> and this works.
>
> Before the patch, we were getting lots of core dumps where the flow in
> master.c hits the default case and memory gets double-freed and a core
> happens.
> We'd love to get this into V5-8-patches soon.
>
> Thanks,
> Sam
>
>
>
> On Tue, Apr 9, 2019 at 9:13 AM Sam Tannous <stannous@cumulusnetworks.com>
> wrote:
>
>> Hi Anders,
>>
>> I fixed some snmpv3 (bulkget) coredumps a while ago.
>> https://sourceforge.net/p/net-snmp/patches/1388/
>>
>> While not directly related, the (double-free memory) core dumps
>> were easily triggered by any error condition within a v3 bulkget.
>>
>> I'm hoping my patch will get picked up soon :-(
>>
>> Thanks,
>> Sam
>>
>> On Tue, Apr 9, 2019 at 6:54 AM Anders Wallin <wallinux@gmail.com> wrote:
>>
>>> Now it works fine!
>>>
>>> thx
>>> Anders Wallin
>>>
>>>
>>> On Tue, Apr 9, 2019 at 2:26 AM Masayoshi Mizuma <msys.mizuma@gmail.com>
>>> wrote:
>>>
>>>> Hi Anders,
>>>>
>>>> Thank you for your feedback!
>>>> I attach the v2 patch. Could you try it?
>>>>
>>>> On the v1 patch, I missed the check for the request callback. So, the
>>>> request
>>>> gets removed even though the callback doesn't run.
>>>>
>>>> Thanks,
>>>> Masa
>>>>
>>>> On 4/8/19 11:06 AM, Anders Wallin wrote:
>>>> > Hi Masa,
>>>> >
>>>> > looks like it solves the problem reported by Josef, BUT it breaks
>>>> DTLSUDP.
>>>> > I run the tests w/o analyzing why.
>>>> > To reproduce the issue I did the following using net-snmp master
>>>> branch,
>>>> > plus these patches
>>>> > 39485c6f2 - snmplib/snmp_api: Remove the request on the session when
>>>> the
>>>> > sending is failed (10 minutes ago) <Masayoshi Mizuma>
>>>> > 06a4d52d8 - agentx: logging to late responses (5 days ago) <Anders
>>>> Wallin>
>>>> > a420d87d3 - BUG2914: Agent master needs to treat resend as normal (5
>>>> days
>>>> > ago) <Anders Wallin>
>>>> > eaad09d04 - (origin/master, origin/HEAD, master) Merge branch
>>>> > 'V5-8-patches' (9 weeks ago) <Bart Van Assche>
>>>> >
>>>> > $ ./configure --prefix=/usr \
>>>> >                 --with-persistent-directory=/var/lib/net-snmp \
>>>> >                 --with-mib-modules='smux tlstm-mib tsm-mib
>>>> examples/example
>>>> > examples/notification' \
>>>> >                 --with-security-modules="tsm" \
>>>> >                 --with-transports="TLSTCP DTLSUDP" \
>>>> >                 --enable-shared \
>>>> >                 --with-defaults \
>>>> >                 --enable-ipv6 \
>>>> >                 --with-cflags="-g -O2" \
>>>> >                 --without-elf
>>>> >
>>>> > $ make install
>>>> > $ cd testing
>>>> > $ ./RUNFULLTESTS -g tls
>>>> > DTLS-UDP user certificate tests .......................... 41/?
>>>> >  This hangs forever in "41" with snmpd.log saying....
>>>> > ......
>>>> > 2019-04-08 16:29:11
>>>> > 2019-04-08 16:29:11
>>>> > Received 0 byte packet from DTLSUDP: unknown
>>>> > 2019-04-08 16:29:11
>>>> > 2019-04-08 16:29:13
>>>> > Received 0 byte packet from DTLSUDP: unknown
>>>> > 2019-04-08 16:29:13
>>>> > 2019-04-08 16:29:15
>>>> > Received 0 byte packet from DTLSUDP: unknown
>>>> > 2019-04-08 16:29:15
>>>> > 2019-04-08 16:29:15 tls verification failure: ok=0 ctx=0x55ee625b4170
>>>> > depth=0 err=18:self signed certificate
>>>> > 2019-04-08 16:29:15 ---- OpenSSL Related Errors: ----
>>>> > 2019-04-08 16:29:15  TLS error: SSL_read: rc=-1, sslerror = 1
>>>> > (SSL_ERROR_SSL)
>>>> > 2019-04-08 16:29:15  TLS Error: certificate verify failed
>>>> > 2019-04-08 16:29:15 ---- End of OpenSSL Errors ----
>>>> > 2019-04-08 16:29:15 ---- OpenSSL Related Errors: ----
>>>> > 2019-04-08 16:29:15 TLS error: SSL_read: rc=-1, sslerror = 5
>>>> > (SSL_ERROR_SYSCALL): system_error=0 (Success)
>>>> > 2019-04-08 16:29:15 TLS Error: (null)
>>>> > 2019-04-08 16:29:16 ---- OpenSSL Related Errors: ----
>>>> > 2019-04-08 16:29:16 TLS error: SSL_read: rc=-1, sslerror = 5
>>>> > (SSL_ERROR_SYSCALL): system_error=0 (Success)
>>>> > 2019-04-08 16:29:16 TLS Error: (null)
>>>> > 2019-04-08 16:29:16 ---- OpenSSL Related Errors: ----
>>>> > 2019-04-08 16:29:16 TLS error: SSL_read: rc=-1, sslerror = 5
>>>> > (SSL_ERROR_SYSCALL): system_error=0 (Success)
>>>> > 2019-04-08 16:29:16 TLS Error: (null)
>>>> >
>>>> > With the fix suggested på Josef I don't see the DTLSUDP problem, but
>>>> maybe
>>>> > there are other problems.
>>>> >
>>>> > Regards
>>>> > Anders Wallin
>>>> >
>>>> > PS. thx for adding commit info to a420d87d3, I updated the patch with
>>>> your
>>>> > commit comments
>>>> >
>>>> >
>>>> > On Mon, Apr 8, 2019 at 3:27 PM Masayoshi Mizuma <
>>>> msys.mizuma@gmail.com>
>>>> > wrote:
>>>> >
>>>> >> Hi Josef,
>>>> >>
>>>> >> I attach two patches to fix the memory inconsistency if the request
>>>> is
>>>> >> resend and timed out.
>>>> >> Could you try them?
>>>> >>
>>>> >> - 0001-agentx-master-Return-when-NETSNMP_CALLBACK_OP_RESEND.patch
>>>> >>
>>>> >>   This patch was posted by Anders, and I tried to add the
>>>> description.
>>>> >>   This patch fixes the missing NETSNMP_CALLBACK_OP_RESEND callback.
>>>> >>
>>>> >> - 0002-snmplib-snmp_api-Remove-the-request-on-the-session-w.patch
>>>> >>
>>>> >>   This patch fixes the race between NETSNMP_CALLBACK_OP_SEND_FAILED
>>>> >>   and NETSNMP_CALLBACK_OP_TIMED_OUT callback. If the request is
>>>> failed,
>>>> >>   then remove the request from the internal session.
>>>> >>
>>>> >> Thanks,
>>>> >> Masa
>>>> >>
>>>> >> On 4/3/19 9:34 AM, Anders Wallin wrote:
>>>> >>> The introduction of that code fixes another issue;
>>>> >>> "commit 56c30b11f3616ea4f0c38a21e08e78f050096020
>>>> >>> Author: Bill Fenner <fenner@gmail.com>
>>>> >>> Date:   Wed Dec 20 21:52:10 2017 +0000
>>>> >>>
>>>> >>>     NEWS: snmplib: PATCH: 1349: Fix perl/other crash against bad
>>>> SNMPv3
>>>> >>> agent
>>>> >>>
>>>> >>>     With the patch in 1214, the snmp_api code assumed that if magic
>>>> was
>>>> >>>     set, it was the "struct synch-state" from snmp_client.  Of
>>>> course,
>>>> >>>     magic belongs to the caller, and the perl library uses it
>>>> >> differently,
>>>> >>>     so reaching into it is verboten.  Introduce a new callback (that
>>>> >>>     was already introduced in 5.8) to report this "retries exceeded"
>>>> >>>     state, and use it in snmp_client."
>>>> >>>
>>>> >>> I think the problem is really about shutting down the agentx
>>>> connection
>>>> >>> when one(1) response is to late. I have
>>>> >>> done 2 patches (one that only write a better log message and one
>>>> that
>>>> >>> removes the "bad" code.
>>>> >>> With these patches I don't get any crash. I think that 5.7.3 has
>>>> this
>>>> >> issue
>>>> >>> as well, but it can not be crashed with the agentofdead code
>>>> >>>
>>>> >>> Can you please try this?
>>>> >>>
>>>> >>> Regards
>>>> >>> Anders Wallin
>>>> >>>
>>>> >>>
>>>> >>> On Wed, Apr 3, 2019 at 12:35 PM Josef Ridky <jridky@redhat.com>
>>>> wrote:
>>>> >>>
>>>> >>>> Hi,
>>>> >>>>
>>>> >>>> I have compared net-snmp-5.7.3 and net-snmp-5.8 and I have found,
>>>> that
>>>> >>>> following callbacks in snmplib/snmp_api.c causes the core dump
>>>> issue:
>>>> >>>>
>>>> >>>> --- old/snmplib/snmp_api.c      2019-04-03 12:13:55.126769866 +0200
>>>> >>>> +++ new/snmplib/snmp_api.c      2019-04-03 12:15:18.353420790 +0200
>>>> >>>> @@ -6731,9 +6731,9 @@ snmp_resend_request(struct session_list
>>>> >>>>          sp->s_snmp_errno = SNMPERR_BAD_SENDTO;
>>>> >>>>          sp->s_errno = errno;
>>>> >>>>          snmp_set_detail(strerror(errno));
>>>> >>>> -        if (rp->callback)
>>>> >>>> +/*        if (rp->callback)
>>>> >>>>              rp->callback(NETSNMP_CALLBACK_OP_SEND_FAILED, sp,
>>>> >>>> -                         rp->pdu->reqid, rp->pdu, rp->cb_data);
>>>> >>>> +                         rp->pdu->reqid, rp->pdu, rp->cb_data);*/
>>>> >>>>          return -1;
>>>> >>>>      } else {
>>>> >>>>          netsnmp_get_monotonic_clock(&now);
>>>> >>>> @@ -6743,9 +6743,9 @@ snmp_resend_request(struct session_list
>>>> >>>>          tv.tv_sec += tv.tv_usec / 1000000L;
>>>> >>>>          tv.tv_usec %= 1000000L;
>>>> >>>>          rp->expireM = tv;
>>>> >>>> -        if (rp->callback)
>>>> >>>> +/*        if (rp->callback)
>>>> >>>>              rp->callback(NETSNMP_CALLBACK_OP_RESEND, sp,
>>>> >>>> -                         rp->pdu->reqid, rp->pdu, rp->cb_data);
>>>> >>>> +                         rp->pdu->reqid, rp->pdu, rp->cb_data);*/
>>>> >>>>      }
>>>> >>>>      return 0;
>>>> >>>>  }
>>>> >>>>
>>>> >>>> Without them, all works as expected.
>>>> >>>>
>>>> >>>> Josef Ridky
>>>> >>>> Software Engineer
>>>> >>>> Core Services Team
>>>> >>>> Red Hat Czech, s.r.o.
>>>> >>>>
>>>> >>>> ----- Original Message -----
>>>> >>>> | From: "Anders Wallin" <wallinux@gmail.com>
>>>> >>>> | To: "Josef Ridky" <jridky@redhat.com>
>>>> >>>> | Cc: "net-snmp-coders" <net-snmp-coders@lists.sourceforge.net>
>>>> >>>> | Sent: Tuesday, April 2, 2019 6:27:54 PM
>>>> >>>> | Subject: Re: Core dump with net-snmp-5.8
>>>> >>>> |
>>>> >>>> | Hi Josef,
>>>> >>>> | I can reproduce the issue using the master branch, I will take a
>>>> look
>>>> >> at
>>>> >>>> it
>>>> >>>> | later tonight or tomorrow
>>>> >>>> |
>>>> >>>> | Regards
>>>> >>>> | Anders Wallin
>>>> >>>> |
>>>> >>>> |
>>>> >>>> | On Tue, Apr 2, 2019 at 3:42 PM Josef Ridky <jridky@redhat.com>
>>>> wrote:
>>>> >>>> |
>>>> >>>> | > Hi,
>>>> >>>> | >
>>>> >>>> | > thanks for your patch. Unfortunately, even when I have applied
>>>> it,
>>>> >> it
>>>> >>>> | > still ends with core dump due of 'double free or corruption
>>>> >> (fasttop)'
>>>> >>>> | >
>>>> >>>> | > When I run snmpd with -Dsnmp_agent,agentx/master it ends with:
>>>> >>>> | >
>>>> >>>> | > agentx/master: sending pdu (req=0x1d4,trans=0x1d3,sess=0x5)
>>>> >>>> | > snmp_agent: delegate session == 0x56207e165240
>>>> >>>> | > snmp_agent: end of handle_snmp_packet, asp = 0x56207e165240
>>>> >>>> | > agentx/master: callback resend
>>>> >>>> | > agentx/master: callback resend
>>>> >>>> | > agentx/master: timeout on session 0x56207dfd5400 req=0x1c9
>>>> >>>> | > agentx/master: close 0x56207dfd5400, -1
>>>> >>>> | > snmp_agent: removed 40 delegated request(s) for session
>>>> >> 0x56207dfce490
>>>> >>>> | > snmp_agent: processing delegated request, asp = 0x56207e165240
>>>> >>>> | > snmp_agent: canceling next walk for asp 0x56207e165240
>>>> >>>> | > snmp_agent: REMOVE session == 0x56207e165240
>>>> >>>> | > snmp_agent: agent_session 0x56207e165240 released
>>>> >>>> | > snmp_agent: processing delegated request, asp = 0x56207e1041a0
>>>> >>>> | > snmp_agent: canceling next walk for asp 0x56207e1041a0
>>>> >>>> | > snmp_agent: REMOVE session == 0x56207e1041a0
>>>> >>>> | > snmp_agent: agent_session 0x56207e1041a0 released
>>>> >>>> | > snmp_agent: processing delegated request, asp = 0x56207e1656c0
>>>> >>>> | > snmp_agent: canceling next walk for asp 0x56207e1656c0
>>>> >>>> | > snmp_agent: REMOVE session == 0x56207e1656c0
>>>> >>>> | > snmp_agent: agent_session 0x56207e1656c0 released
>>>> >>>> | > snmp_agent: processing delegated request, asp = 0x56207e11af40
>>>> >>>> | > snmp_agent: canceling next walk for asp 0x56207e11af40
>>>> >>>> | > snmp_agent: REMOVE session == 0x56207e11af40
>>>> >>>> | > snmp_agent: agent_session 0x56207e11af40 released
>>>> >>>> | > snmp_agent: processing delegated request, asp = 0x56207e118f00
>>>> >>>> | > snmp_agent: canceling next walk for asp 0x56207e118f00
>>>> >>>> | > snmp_agent: REMOVE session == 0x56207e118f00
>>>> >>>> | > snmp_agent: agent_session 0x56207e118f00 released
>>>> >>>> | > snmp_agent: processing delegated request, asp = 0x56207e11b540
>>>> >>>> | > snmp_agent: canceling next walk for asp 0x56207e11b540
>>>> >>>> | > snmp_agent: REMOVE session == 0x56207e11b540
>>>> >>>> | > snmp_agent: agent_session 0x56207e11b540 released
>>>> >>>> | > snmp_agent: processing delegated request, asp = 0x56207e11bd00
>>>> >>>> | > snmp_agent: canceling next walk for asp 0x56207e11bd00
>>>> >>>> | > snmp_agent: REMOVE session == 0x56207e11bd00
>>>> >>>> | > snmp_agent: agent_session 0x56207e11bd00 released
>>>> >>>> | > agentx/master: Continue removing delegated subsession reqests
>>>> >>>> | > agentx/master: close transport
>>>> >>>> | > snmp_agent: REMOVE session == 0x56207dfd5400
>>>> >>>> | > agentx/master: response too late on session 0x56207dfd5400
>>>> >>>> | > agentx/master: response too late on session 0x56207dfd5400
>>>> >>>> | > double free or corruption (fasttop)
>>>> >>>> | > Aborted (core dumped)
>>>> >>>> | >
>>>> >>>> | >
>>>> >>>> | > What's interesting, when I run it with -DALL it pass (at least
>>>> for
>>>> >>>> several
>>>> >>>> | > rounds).
>>>> >>>> | > It looks like some strange race condition.
>>>> >>>> | >
>>>> >>>> | > Regards
>>>> >>>> | >
>>>> >>>> | > Josef Ridky
>>>> >>>> | > Software Engineer
>>>> >>>> | > Core Services Team
>>>> >>>> | > Red Hat Czech, s.r.o.
>>>> >>>> | >
>>>> >>>> | > ----- Original Message -----
>>>> >>>> | > | From: "Anders Wallin" <wallinux@gmail.com>
>>>> >>>> | > | To: "Josef Ridky" <jridky@redhat.com>
>>>> >>>> | > | Cc: "net-snmp-coders" <net-snmp-coders@lists.sourceforge.net
>>>> >
>>>> >>>> | > | Sent: Tuesday, April 2, 2019 1:46:40 PM
>>>> >>>> | > | Subject: Re: Core dump with net-snmp-5.8
>>>> >>>> | > |
>>>> >>>> | > | Hi Josef,
>>>> >>>> | > |
>>>> >>>> | > | I think it's the same issue as
>>>> >>>> | > https://sourceforge.net/p/net-snmp/bugs/2914/
>>>> >>>> | > | (where I also posted the solution)
>>>> >>>> | > | Regards
>>>> >>>> | > | Anders Wallin
>>>> >>>> | > |
>>>> >>>> | > |
>>>> >>>> | > | On Tue, Apr 2, 2019 at 12:43 PM Josef Ridky <
>>>> jridky@redhat.com>
>>>> >>>> wrote:
>>>> >>>> | > |
>>>> >>>> | > | > Hi,
>>>> >>>> | > | >
>>>> >>>> | > | > recently, I have hit to an issue in net-snmp-5.8, that is
>>>> >>>> connected to
>>>> >>>> | > the
>>>> >>>> | > | > bug report [1].
>>>> >>>> | > | >
>>>> >>>> | > | > When I tried to run agentofdeath test from [1], snmpd
>>>> daemon
>>>> >> will
>>>> >>>> crash
>>>> >>>> | > | > with malloc(): smallbin double linked list corrupted or
>>>> double
>>>> >>>> free()
>>>> >>>> | > issue
>>>> >>>> | > | > and dumps core (see bellow).
>>>> >>>> | > | > From log file, I can identified one issue with "Unknown
>>>> >> operation".
>>>> >>>> | > | >
>>>> >>>> | > | > This issue is in the agentx_got_response function
>>>> >>>> | > | > (agent/mibgroup/agentx/master.c). There isn't implemented
>>>> action
>>>> >>>> for
>>>> >>>> | > | > NETSNMP_CALLBACK_OP_RESEND (defined in
>>>> >>>> | > | > include/net-snmp/library/snmp_api.h).
>>>> >>>> | > | > As result "Unknown operation 6 in agentx_got_response" is
>>>> shown
>>>> >> in
>>>> >>>> log
>>>> >>>> | > | > file.
>>>> >>>> | > | >
>>>> >>>> | > | > /var/log/messages
>>>> >>>> | > | > -------------------------------
>>>> >>>> | > | > Mar 28 06:52:42 localhost snmpd[12073]: Unknown operation
>>>> 6 in
>>>> >>>> | > | > agentx_got_response
>>>> >>>> | > | > Mar 28 06:52:43 localhost snmpd[12073]: Unknown operation
>>>> 6 in
>>>> >>>> | > | > agentx_got_response
>>>> >>>> | > | > Mar 28 06:52:43 localhost snmpd[12073]: malloc(): smallbin
>>>> >> double
>>>> >>>> | > linked
>>>> >>>> | > | > list corrupted
>>>> >>>> | > | > Mar 28 06:52:43 localhost systemd[1]: Started Process Core
>>>> Dump
>>>> >>>> (PID
>>>> >>>> | > | > 13652/UID 0).
>>>> >>>> | > | > Mar 28 06:52:48 localhost systemd[1]: snmpd.service: Main
>>>> >> process
>>>> >>>> | > exited,
>>>> >>>> | > | > code=dumped, status=6/ABRT
>>>> >>>> | > | > Mar 28 06:52:48 localhost systemd[1]: snmpd.service:
>>>> Failed with
>>>> >>>> result
>>>> >>>> | > | > 'core-dump'.
>>>> >>>> | > | > -------------------------------
>>>> >>>> | > | >
>>>> >>>> | > | > The "Unknown operation" callback is caused by newly added
>>>> piece
>>>> >> of
>>>> >>>> | > code in
>>>> >>>> | > | > snmplib/snmp_api.c:
>>>> >>>> | > | >
>>>> >>>> | > | >  static int
>>>> >>>> | > | >  snmp_resend_request(struct session_list *slp,
>>>> >> netsnmp_request_list
>>>> >>>> | > *rp,
>>>> >>>> | > | >  int incr_retries)
>>>> >>>> | > | >  {
>>>> >>>> | > | >
>>>> >>>> | > | > ...
>>>> >>>> | > | >
>>>> >>>> | > | >          tv.tv_sec += tv.tv_usec / 1000000L;
>>>> >>>> | > | >          tv.tv_usec %= 1000000L;
>>>> >>>> | > | >          rp->expireM = tv;
>>>> >>>> | > | > +        if (rp->callback)
>>>> >>>> | > | > +            rp->callback(NETSNMP_CALLBACK_OP_RESEND, sp,
>>>> >>>> | > | > +                         rp->pdu->reqid, rp->pdu,
>>>> rp->cb_data);
>>>> >>>> | > | >      }
>>>> >>>> | > | >      return 0;
>>>> >>>> | > | >  }
>>>> >>>> | > | >
>>>> >>>> | > | >
>>>> >>>> | > | > When I tried to remove it, it just stop complaining about
>>>> >>>> operation 6,
>>>> >>>> | > but
>>>> >>>> | > | > the core dump is still present.
>>>> >>>> | > | >
>>>> >>>> | > | > May I ask you for help with this issue? Do you have any
>>>> idea,
>>>> >> what
>>>> >>>> | > causing
>>>> >>>> | > | > this issue in 5.8 and how to fix it?
>>>> >>>> | > | > I know, that Jan Safranek has fixed this for 5.7 by commit
>>>> [2],
>>>> >>>> but it
>>>> >>>> | > | > looks like something other has changed and this issue is
>>>> current
>>>> >>>> again.
>>>> >>>> | > | >
>>>> >>>> | > | > [1] https://sourceforge.net/p/net-snmp/bugs/2411/
>>>> >>>> | > | > [2]
>>>> >>>> | > | >
>>>> >>>> | >
>>>> >>>>
>>>> >>
>>>> https://github.com/net-snmp/net-snmp/commit/793d596838ff7cb48a73b675d62897c56c9e62df
>>>> >>>> | > | >
>>>> >>>> | > | > Regards
>>>> >>>> | > | >
>>>> >>>> | > | > Josef Ridky
>>>> >>>> | > | > Software Engineer
>>>> >>>> | > | > Core Services Team
>>>> >>>> | > | > Red Hat Czech, s.r.o.
>>>> >>>> | > | >
>>>> >>>> | > | >
>>>> >>>> | > | >
>>>> >>>> | > | > _______________________________________________
>>>> >>>> | > | > Net-snmp-coders mailing list
>>>> >>>> | > | > Net-snmp-coders@lists.sourceforge.net
>>>> >>>> | > | >
>>>> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>>>> >>>> | > | >
>>>> >>>> | > |
>>>> >>>> | >
>>>> >>>> |
>>>> >>>>
>>>> >>>
>>>> >>>
>>>> >>>
>>>> >>> _______________________________________________
>>>> >>> Net-snmp-coders mailing list
>>>> >>> Net-snmp-coders@lists.sourceforge.net
>>>> >>> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>>>> >>>
>>>> >>
>>>> >
>>>>
>>> _______________________________________________
>>> Net-snmp-coders mailing list
>>> Net-snmp-coders@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>>>
>>
>>
>> --
>> *Sam Tannous*
>> Engineering
>> Cumulus Networks ®
>> +1 650 383 6700 x 1106
>> <http://www.cumulusnetworks,com>www.cumulusnetworks.com
>>
>> Evaluate Cumulus ® Linux ®
>> https://cumulusnetworks.com/product/secure/evaluate/
>>
>> Become a Partner
>> http://cumulusnetworks.com/partners/become-a-partner/
>>
>
>
> --
> *Sam Tannous*
> Engineering
> Cumulus Networks ®
> +1 650 383 6700 x 1106
> <http://www.cumulusnetworks,com>www.cumulusnetworks.com
>
> Evaluate Cumulus ® Linux ®
> https://cumulusnetworks.com/product/secure/evaluate/
>
> Become a Partner
> http://cumulusnetworks.com/partners/become-a-partner/
>

[Attachment #5 (text/html)]

<div dir="ltr">Hi Sam,<div><br></div><div>I&#39;m not a maintainer for net-snmp, but \
it was merged into 5-8-patches yesterday  </div><div><br></div><div>Regards<br \
clear="all"><div><div dir="ltr" class="gmail_signature" \
data-smartmail="gmail_signature">Anders Wallin</div></div><br></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 10, 2019 at 8:04 PM \
Sam Tannous &lt;<a href="mailto:stannous@cumulusnetworks.com">stannous@cumulusnetworks.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
class="gmail_default" style="font-family:verdana,sans-serif">Hi Anders,</div><div \
class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div \
class="gmail_default" style="font-family:verdana,sans-serif">We&#39;ve been testing \
the patch for  </div><div class="gmail_default" \
style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" \
style="font-family:verdana,sans-serif"><a \
href="https://sourceforge.net/p/net-snmp/bugs/2914/" \
target="_blank">https://sourceforge.net/p/net-snmp/bugs/2914/</a><br></div><div \
class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div \
class="gmail_default" style="font-family:verdana,sans-serif">and this \
works.</div><div class="gmail_default" \
style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" \
style="font-family:verdana,sans-serif">Before the patch, we were getting lots of core \
dumps where the flow in</div><div class="gmail_default" \
style="font-family:verdana,sans-serif">master.c hits the default case and memory gets \
double-freed and a core happens.</div><div class="gmail_default" \
style="font-family:verdana,sans-serif">We&#39;d love to get this into V5-8-patches \
soon.</div><div class="gmail_default" \
style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" \
style="font-family:verdana,sans-serif">Thanks,</div><div class="gmail_default" \
style="font-family:verdana,sans-serif">Sam</div><div class="gmail_default" \
style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" \
style="font-family:verdana,sans-serif"><br></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 9, 2019 at 9:13 AM \
Sam Tannous &lt;<a href="mailto:stannous@cumulusnetworks.com" \
target="_blank">stannous@cumulusnetworks.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" \
style="font-family:verdana,sans-serif">Hi Anders,</div><div class="gmail_default" \
style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" \
style="font-family:verdana,sans-serif">I fixed some snmpv3 (bulkget) coredumps a \
while ago.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><a \
href="https://sourceforge.net/p/net-snmp/patches/1388/" \
target="_blank">https://sourceforge.net/p/net-snmp/patches/1388/</a>  <br></div><div \
class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div \
class="gmail_default" style="font-family:verdana,sans-serif">While not directly \
related, the (double-free memory) core dumps</div><div class="gmail_default" \
style="font-family:verdana,sans-serif">were easily triggered by any error condition \
within a v3 bulkget.</div><div class="gmail_default" \
style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" \
style="font-family:verdana,sans-serif">I&#39;m hoping my patch will get picked up \
soon :-(</div><div class="gmail_default" \
style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" \
style="font-family:verdana,sans-serif">Thanks,</div><div class="gmail_default" \
style="font-family:verdana,sans-serif">Sam</div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 9, 2019 at 6:54 AM \
Anders Wallin &lt;<a href="mailto:wallinux@gmail.com" \
target="_blank">wallinux@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">Now it works \
fine!<div><br></div><div>thx<br clear="all"><div><div dir="ltr" \
class="gmail-m_-8613134433695791110gmail-m_6929598511783199391gmail-m_-1455694735376954073gmail_signature">Anders \
Wallin</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Tue, Apr 9, 2019 at 2:26 AM Masayoshi Mizuma &lt;<a \
href="mailto:msys.mizuma@gmail.com" target="_blank">msys.mizuma@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Anders,<br> <br>
Thank you for your feedback!<br>
I attach the v2 patch. Could you try it?<br>
<br>
On the v1 patch, I missed the check for the request callback. So, the request<br>
gets removed even though the callback doesn&#39;t run.<br>
<br>
Thanks,<br>
Masa<br>
<br>
On 4/8/19 11:06 AM, Anders Wallin wrote:<br>
&gt; Hi Masa,<br>
&gt; <br>
&gt; looks like it solves the problem reported by Josef, BUT it breaks DTLSUDP.<br>
&gt; I run the tests w/o analyzing why.<br>
&gt; To reproduce the issue I did the following using net-snmp master branch,<br>
&gt; plus these patches<br>
&gt; 39485c6f2 - snmplib/snmp_api: Remove the request on the session when the<br>
&gt; sending is failed (10 minutes ago) &lt;Masayoshi Mizuma&gt;<br>
&gt; 06a4d52d8 - agentx: logging to late responses (5 days ago) &lt;Anders \
Wallin&gt;<br> &gt; a420d87d3 - BUG2914: Agent master needs to treat resend as normal \
(5 days<br> &gt; ago) &lt;Anders Wallin&gt;<br>
&gt; eaad09d04 - (origin/master, origin/HEAD, master) Merge branch<br>
&gt; &#39;V5-8-patches&#39; (9 weeks ago) &lt;Bart Van Assche&gt;<br>
&gt; <br>
&gt; $ ./configure --prefix=/usr \<br>
&gt;                          --with-persistent-directory=/var/lib/net-snmp \<br>
&gt;                          --with-mib-modules=&#39;smux tlstm-mib tsm-mib \
examples/example<br> &gt; examples/notification&#39; \<br>
&gt;                          --with-security-modules=&quot;tsm&quot; \<br>
&gt;                          --with-transports=&quot;TLSTCP DTLSUDP&quot; \<br>
&gt;                          --enable-shared \<br>
&gt;                          --with-defaults \<br>
&gt;                          --enable-ipv6 \<br>
&gt;                          --with-cflags=&quot;-g -O2&quot; \<br>
&gt;                          --without-elf<br>
&gt; <br>
&gt; $ make install<br>
&gt; $ cd testing<br>
&gt; $ ./RUNFULLTESTS -g tls<br>
&gt; DTLS-UDP user certificate tests .......................... 41/?<br>
&gt;   This hangs forever in &quot;41&quot; with snmpd.log saying....<br>
&gt; ......<br>
&gt; 2019-04-08 16:29:11<br>
&gt; 2019-04-08 16:29:11<br>
&gt; Received 0 byte packet from DTLSUDP: unknown<br>
&gt; 2019-04-08 16:29:11<br>
&gt; 2019-04-08 16:29:13<br>
&gt; Received 0 byte packet from DTLSUDP: unknown<br>
&gt; 2019-04-08 16:29:13<br>
&gt; 2019-04-08 16:29:15<br>
&gt; Received 0 byte packet from DTLSUDP: unknown<br>
&gt; 2019-04-08 16:29:15<br>
&gt; 2019-04-08 16:29:15 tls verification failure: ok=0 ctx=0x55ee625b4170<br>
&gt; depth=0 err=18:self signed certificate<br>
&gt; 2019-04-08 16:29:15 ---- OpenSSL Related Errors: ----<br>
&gt; 2019-04-08 16:29:15   TLS error: SSL_read: rc=-1, sslerror = 1<br>
&gt; (SSL_ERROR_SSL)<br>
&gt; 2019-04-08 16:29:15   TLS Error: certificate verify failed<br>
&gt; 2019-04-08 16:29:15 ---- End of OpenSSL Errors ----<br>
&gt; 2019-04-08 16:29:15 ---- OpenSSL Related Errors: ----<br>
&gt; 2019-04-08 16:29:15 TLS error: SSL_read: rc=-1, sslerror = 5<br>
&gt; (SSL_ERROR_SYSCALL): system_error=0 (Success)<br>
&gt; 2019-04-08 16:29:15 TLS Error: (null)<br>
&gt; 2019-04-08 16:29:16 ---- OpenSSL Related Errors: ----<br>
&gt; 2019-04-08 16:29:16 TLS error: SSL_read: rc=-1, sslerror = 5<br>
&gt; (SSL_ERROR_SYSCALL): system_error=0 (Success)<br>
&gt; 2019-04-08 16:29:16 TLS Error: (null)<br>
&gt; 2019-04-08 16:29:16 ---- OpenSSL Related Errors: ----<br>
&gt; 2019-04-08 16:29:16 TLS error: SSL_read: rc=-1, sslerror = 5<br>
&gt; (SSL_ERROR_SYSCALL): system_error=0 (Success)<br>
&gt; 2019-04-08 16:29:16 TLS Error: (null)<br>
&gt; <br>
&gt; With the fix suggested på Josef I don&#39;t see the DTLSUDP problem, but \
maybe<br> &gt; there are other problems.<br>
&gt; <br>
&gt; Regards<br>
&gt; Anders Wallin<br>
&gt; <br>
&gt; PS. thx for adding commit info to a420d87d3, I updated the patch with your<br>
&gt; commit comments<br>
&gt; <br>
&gt; <br>
&gt; On Mon, Apr 8, 2019 at 3:27 PM Masayoshi Mizuma &lt;<a \
href="mailto:msys.mizuma@gmail.com" target="_blank">msys.mizuma@gmail.com</a>&gt;<br> \
&gt; wrote:<br> &gt; <br>
&gt;&gt; Hi Josef,<br>
&gt;&gt;<br>
&gt;&gt; I attach two patches to fix the memory inconsistency if the request is<br>
&gt;&gt; resend and timed out.<br>
&gt;&gt; Could you try them?<br>
&gt;&gt;<br>
&gt;&gt; - 0001-agentx-master-Return-when-NETSNMP_CALLBACK_OP_RESEND.patch<br>
&gt;&gt;<br>
&gt;&gt;     This patch was posted by Anders, and I tried to add the description.<br>
&gt;&gt;     This patch fixes the missing NETSNMP_CALLBACK_OP_RESEND callback.<br>
&gt;&gt;<br>
&gt;&gt; - 0002-snmplib-snmp_api-Remove-the-request-on-the-session-w.patch<br>
&gt;&gt;<br>
&gt;&gt;     This patch fixes the race between NETSNMP_CALLBACK_OP_SEND_FAILED<br>
&gt;&gt;     and NETSNMP_CALLBACK_OP_TIMED_OUT callback. If the request is \
failed,<br> &gt;&gt;     then remove the request from the internal session.<br>
&gt;&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt; Masa<br>
&gt;&gt;<br>
&gt;&gt; On 4/3/19 9:34 AM, Anders Wallin wrote:<br>
&gt;&gt;&gt; The introduction of that code fixes another issue;<br>
&gt;&gt;&gt; &quot;commit 56c30b11f3616ea4f0c38a21e08e78f050096020<br>
&gt;&gt;&gt; Author: Bill Fenner &lt;<a href="mailto:fenner@gmail.com" \
target="_blank">fenner@gmail.com</a>&gt;<br> &gt;&gt;&gt; Date:     Wed Dec 20 \
21:52:10 2017 +0000<br> &gt;&gt;&gt;<br>
&gt;&gt;&gt;        NEWS: snmplib: PATCH: 1349: Fix perl/other crash against bad \
SNMPv3<br> &gt;&gt;&gt; agent<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;        With the patch in 1214, the snmp_api code assumed that if magic \
was<br> &gt;&gt;&gt;        set, it was the &quot;struct synch-state&quot; from \
snmp_client.   Of course,<br> &gt;&gt;&gt;        magic belongs to the caller, and \
the perl library uses it<br> &gt;&gt; differently,<br>
&gt;&gt;&gt;        so reaching into it is verboten.   Introduce a new callback \
(that<br> &gt;&gt;&gt;        was already introduced in 5.8) to report this \
&quot;retries exceeded&quot;<br> &gt;&gt;&gt;        state, and use it in \
snmp_client.&quot;<br> &gt;&gt;&gt;<br>
&gt;&gt;&gt; I think the problem is really about shutting down the agentx \
connection<br> &gt;&gt;&gt; when one(1) response is to late. I have<br>
&gt;&gt;&gt; done 2 patches (one that only write a better log message and one \
that<br> &gt;&gt;&gt; removes the &quot;bad&quot; code.<br>
&gt;&gt;&gt; With these patches I don&#39;t get any crash. I think that 5.7.3 has \
this<br> &gt;&gt; issue<br>
&gt;&gt;&gt; as well, but it can not be crashed with the agentofdead code<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Can you please try this?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Regards<br>
&gt;&gt;&gt; Anders Wallin<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Wed, Apr 3, 2019 at 12:35 PM Josef Ridky &lt;<a \
href="mailto:jridky@redhat.com" target="_blank">jridky@redhat.com</a>&gt; wrote:<br> \
&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I have compared net-snmp-5.7.3 and net-snmp-5.8 and I have found, \
that<br> &gt;&gt;&gt;&gt; following callbacks in snmplib/snmp_api.c causes the core \
dump issue:<br> &gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; --- old/snmplib/snmp_api.c         2019-04-03 12:13:55.126769866 \
+0200<br> &gt;&gt;&gt;&gt; +++ new/snmplib/snmp_api.c         2019-04-03 \
12:15:18.353420790 +0200<br> &gt;&gt;&gt;&gt; @@ -6731,9 +6731,9 @@ \
snmp_resend_request(struct session_list<br> &gt;&gt;&gt;&gt;               \
sp-&gt;s_snmp_errno = SNMPERR_BAD_SENDTO;<br> &gt;&gt;&gt;&gt;               \
sp-&gt;s_errno = errno;<br> &gt;&gt;&gt;&gt;               \
snmp_set_detail(strerror(errno));<br> &gt;&gt;&gt;&gt; -            if \
(rp-&gt;callback)<br> &gt;&gt;&gt;&gt; +/*            if (rp-&gt;callback)<br>
&gt;&gt;&gt;&gt;                     rp-&gt;callback(NETSNMP_CALLBACK_OP_SEND_FAILED, \
sp,<br> &gt;&gt;&gt;&gt; -                                      rp-&gt;pdu-&gt;reqid, \
rp-&gt;pdu, rp-&gt;cb_data);<br> &gt;&gt;&gt;&gt; +                                   \
rp-&gt;pdu-&gt;reqid, rp-&gt;pdu, rp-&gt;cb_data);*/<br> &gt;&gt;&gt;&gt;             \
return -1;<br> &gt;&gt;&gt;&gt;         } else {<br>
&gt;&gt;&gt;&gt;               netsnmp_get_monotonic_clock(&amp;now);<br>
&gt;&gt;&gt;&gt; @@ -6743,9 +6743,9 @@ snmp_resend_request(struct session_list<br>
&gt;&gt;&gt;&gt;               tv.tv_sec += tv.tv_usec / 1000000L;<br>
&gt;&gt;&gt;&gt;               tv.tv_usec %= 1000000L;<br>
&gt;&gt;&gt;&gt;               rp-&gt;expireM = tv;<br>
&gt;&gt;&gt;&gt; -            if (rp-&gt;callback)<br>
&gt;&gt;&gt;&gt; +/*            if (rp-&gt;callback)<br>
&gt;&gt;&gt;&gt;                     rp-&gt;callback(NETSNMP_CALLBACK_OP_RESEND, \
sp,<br> &gt;&gt;&gt;&gt; -                                      rp-&gt;pdu-&gt;reqid, \
rp-&gt;pdu, rp-&gt;cb_data);<br> &gt;&gt;&gt;&gt; +                                   \
rp-&gt;pdu-&gt;reqid, rp-&gt;pdu, rp-&gt;cb_data);*/<br> &gt;&gt;&gt;&gt;         \
}<br> &gt;&gt;&gt;&gt;         return 0;<br>
&gt;&gt;&gt;&gt;   }<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Without them, all works as expected.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Josef Ridky<br>
&gt;&gt;&gt;&gt; Software Engineer<br>
&gt;&gt;&gt;&gt; Core Services Team<br>
&gt;&gt;&gt;&gt; Red Hat Czech, s.r.o.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; ----- Original Message -----<br>
&gt;&gt;&gt;&gt; | From: &quot;Anders Wallin&quot; &lt;<a \
href="mailto:wallinux@gmail.com" target="_blank">wallinux@gmail.com</a>&gt;<br> \
&gt;&gt;&gt;&gt; | To: &quot;Josef Ridky&quot; &lt;<a href="mailto:jridky@redhat.com" \
target="_blank">jridky@redhat.com</a>&gt;<br> &gt;&gt;&gt;&gt; | Cc: \
&quot;net-snmp-coders&quot; &lt;<a \
href="mailto:net-snmp-coders@lists.sourceforge.net" \
target="_blank">net-snmp-coders@lists.sourceforge.net</a>&gt;<br> &gt;&gt;&gt;&gt; | \
Sent: Tuesday, April 2, 2019 6:27:54 PM<br> &gt;&gt;&gt;&gt; | Subject: Re: Core dump \
with net-snmp-5.8<br> &gt;&gt;&gt;&gt; |<br>
&gt;&gt;&gt;&gt; | Hi Josef,<br>
&gt;&gt;&gt;&gt; | I can reproduce the issue using the master branch, I will take a \
look<br> &gt;&gt; at<br>
&gt;&gt;&gt;&gt; it<br>
&gt;&gt;&gt;&gt; | later tonight or tomorrow<br>
&gt;&gt;&gt;&gt; |<br>
&gt;&gt;&gt;&gt; | Regards<br>
&gt;&gt;&gt;&gt; | Anders Wallin<br>
&gt;&gt;&gt;&gt; |<br>
&gt;&gt;&gt;&gt; |<br>
&gt;&gt;&gt;&gt; | On Tue, Apr 2, 2019 at 3:42 PM Josef Ridky &lt;<a \
href="mailto:jridky@redhat.com" target="_blank">jridky@redhat.com</a>&gt; wrote:<br> \
&gt;&gt;&gt;&gt; |<br> &gt;&gt;&gt;&gt; | &gt; Hi,<br>
&gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; thanks for your patch. Unfortunately, even when I have \
applied it,<br> &gt;&gt; it<br>
&gt;&gt;&gt;&gt; | &gt; still ends with core dump due of &#39;double free or \
corruption<br> &gt;&gt; (fasttop)&#39;<br>
&gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; When I run snmpd with -Dsnmp_agent,agentx/master it ends \
with:<br> &gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; agentx/master: sending pdu \
(req=0x1d4,trans=0x1d3,sess=0x5)<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: delegate \
session == 0x56207e165240<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: end of \
handle_snmp_packet, asp = 0x56207e165240<br> &gt;&gt;&gt;&gt; | &gt; agentx/master: \
callback resend<br> &gt;&gt;&gt;&gt; | &gt; agentx/master: callback resend<br>
&gt;&gt;&gt;&gt; | &gt; agentx/master: timeout on session 0x56207dfd5400 \
req=0x1c9<br> &gt;&gt;&gt;&gt; | &gt; agentx/master: close 0x56207dfd5400, -1<br>
&gt;&gt;&gt;&gt; | &gt; snmp_agent: removed 40 delegated request(s) for session<br>
&gt;&gt; 0x56207dfce490<br>
&gt;&gt;&gt;&gt; | &gt; snmp_agent: processing delegated request, asp = \
0x56207e165240<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: canceling next walk for asp \
0x56207e165240<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: REMOVE session == \
0x56207e165240<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: agent_session 0x56207e165240 \
released<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: processing delegated request, asp = \
0x56207e1041a0<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: canceling next walk for asp \
0x56207e1041a0<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: REMOVE session == \
0x56207e1041a0<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: agent_session 0x56207e1041a0 \
released<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: processing delegated request, asp = \
0x56207e1656c0<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: canceling next walk for asp \
0x56207e1656c0<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: REMOVE session == \
0x56207e1656c0<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: agent_session 0x56207e1656c0 \
released<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: processing delegated request, asp = \
0x56207e11af40<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: canceling next walk for asp \
0x56207e11af40<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: REMOVE session == \
0x56207e11af40<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: agent_session 0x56207e11af40 \
released<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: processing delegated request, asp = \
0x56207e118f00<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: canceling next walk for asp \
0x56207e118f00<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: REMOVE session == \
0x56207e118f00<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: agent_session 0x56207e118f00 \
released<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: processing delegated request, asp = \
0x56207e11b540<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: canceling next walk for asp \
0x56207e11b540<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: REMOVE session == \
0x56207e11b540<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: agent_session 0x56207e11b540 \
released<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: processing delegated request, asp = \
0x56207e11bd00<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: canceling next walk for asp \
0x56207e11bd00<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: REMOVE session == \
0x56207e11bd00<br> &gt;&gt;&gt;&gt; | &gt; snmp_agent: agent_session 0x56207e11bd00 \
released<br> &gt;&gt;&gt;&gt; | &gt; agentx/master: Continue removing delegated \
subsession reqests<br> &gt;&gt;&gt;&gt; | &gt; agentx/master: close transport<br>
&gt;&gt;&gt;&gt; | &gt; snmp_agent: REMOVE session == 0x56207dfd5400<br>
&gt;&gt;&gt;&gt; | &gt; agentx/master: response too late on session \
0x56207dfd5400<br> &gt;&gt;&gt;&gt; | &gt; agentx/master: response too late on \
session 0x56207dfd5400<br> &gt;&gt;&gt;&gt; | &gt; double free or corruption \
(fasttop)<br> &gt;&gt;&gt;&gt; | &gt; Aborted (core dumped)<br>
&gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; What&#39;s interesting, when I run it with -DALL it pass (at \
least for<br> &gt;&gt;&gt;&gt; several<br>
&gt;&gt;&gt;&gt; | &gt; rounds).<br>
&gt;&gt;&gt;&gt; | &gt; It looks like some strange race condition.<br>
&gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; Regards<br>
&gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; Josef Ridky<br>
&gt;&gt;&gt;&gt; | &gt; Software Engineer<br>
&gt;&gt;&gt;&gt; | &gt; Core Services Team<br>
&gt;&gt;&gt;&gt; | &gt; Red Hat Czech, s.r.o.<br>
&gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; ----- Original Message -----<br>
&gt;&gt;&gt;&gt; | &gt; | From: &quot;Anders Wallin&quot; &lt;<a \
href="mailto:wallinux@gmail.com" target="_blank">wallinux@gmail.com</a>&gt;<br> \
&gt;&gt;&gt;&gt; | &gt; | To: &quot;Josef Ridky&quot; &lt;<a \
href="mailto:jridky@redhat.com" target="_blank">jridky@redhat.com</a>&gt;<br> \
&gt;&gt;&gt;&gt; | &gt; | Cc: &quot;net-snmp-coders&quot; &lt;<a \
href="mailto:net-snmp-coders@lists.sourceforge.net" \
target="_blank">net-snmp-coders@lists.sourceforge.net</a>&gt;<br> &gt;&gt;&gt;&gt; | \
&gt; | Sent: Tuesday, April 2, 2019 1:46:40 PM<br> &gt;&gt;&gt;&gt; | &gt; | Subject: \
Re: Core dump with net-snmp-5.8<br> &gt;&gt;&gt;&gt; | &gt; |<br>
&gt;&gt;&gt;&gt; | &gt; | Hi Josef,<br>
&gt;&gt;&gt;&gt; | &gt; |<br>
&gt;&gt;&gt;&gt; | &gt; | I think it&#39;s the same issue as<br>
&gt;&gt;&gt;&gt; | &gt; <a href="https://sourceforge.net/p/net-snmp/bugs/2914/" \
rel="noreferrer" target="_blank">https://sourceforge.net/p/net-snmp/bugs/2914/</a><br>
 &gt;&gt;&gt;&gt; | &gt; | (where I also posted the solution)<br>
&gt;&gt;&gt;&gt; | &gt; | Regards<br>
&gt;&gt;&gt;&gt; | &gt; | Anders Wallin<br>
&gt;&gt;&gt;&gt; | &gt; |<br>
&gt;&gt;&gt;&gt; | &gt; |<br>
&gt;&gt;&gt;&gt; | &gt; | On Tue, Apr 2, 2019 at 12:43 PM Josef Ridky &lt;<a \
href="mailto:jridky@redhat.com" target="_blank">jridky@redhat.com</a>&gt;<br> \
&gt;&gt;&gt;&gt; wrote:<br> &gt;&gt;&gt;&gt; | &gt; |<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Hi,<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; recently, I have hit to an issue in net-snmp-5.8, that \
is<br> &gt;&gt;&gt;&gt; connected to<br>
&gt;&gt;&gt;&gt; | &gt; the<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; bug report [1].<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; When I tried to run agentofdeath test from [1], snmpd \
daemon<br> &gt;&gt; will<br>
&gt;&gt;&gt;&gt; crash<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; with malloc(): smallbin double linked list corrupted \
or double<br> &gt;&gt;&gt;&gt; free()<br>
&gt;&gt;&gt;&gt; | &gt; issue<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; and dumps core (see bellow).<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; From log file, I can identified one issue with \
&quot;Unknown<br> &gt;&gt; operation&quot;.<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; This issue is in the agentx_got_response function<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; (agent/mibgroup/agentx/master.c). There isn&#39;t \
implemented action<br> &gt;&gt;&gt;&gt; for<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; NETSNMP_CALLBACK_OP_RESEND (defined in<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; include/net-snmp/library/snmp_api.h).<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; As result &quot;Unknown operation 6 in \
agentx_got_response&quot; is shown<br> &gt;&gt; in<br>
&gt;&gt;&gt;&gt; log<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; file.<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; /var/log/messages<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; -------------------------------<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Mar 28 06:52:42 localhost snmpd[12073]: Unknown \
operation 6 in<br> &gt;&gt;&gt;&gt; | &gt; | &gt; agentx_got_response<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Mar 28 06:52:43 localhost snmpd[12073]: Unknown \
operation 6 in<br> &gt;&gt;&gt;&gt; | &gt; | &gt; agentx_got_response<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Mar 28 06:52:43 localhost snmpd[12073]: malloc(): \
smallbin<br> &gt;&gt; double<br>
&gt;&gt;&gt;&gt; | &gt; linked<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; list corrupted<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Mar 28 06:52:43 localhost systemd[1]: Started Process \
Core Dump<br> &gt;&gt;&gt;&gt; (PID<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; 13652/UID 0).<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Mar 28 06:52:48 localhost systemd[1]: snmpd.service: \
Main<br> &gt;&gt; process<br>
&gt;&gt;&gt;&gt; | &gt; exited,<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; code=dumped, status=6/ABRT<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Mar 28 06:52:48 localhost systemd[1]: snmpd.service: \
Failed with<br> &gt;&gt;&gt;&gt; result<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; &#39;core-dump&#39;.<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; -------------------------------<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; The &quot;Unknown operation&quot; callback is caused \
by newly added piece<br> &gt;&gt; of<br>
&gt;&gt;&gt;&gt; | &gt; code in<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; snmplib/snmp_api.c:<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;   static int<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;   snmp_resend_request(struct session_list *slp,<br>
&gt;&gt; netsnmp_request_list<br>
&gt;&gt;&gt;&gt; | &gt; *rp,<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;   int incr_retries)<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;   {<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; ...<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;               tv.tv_sec += tv.tv_usec / 1000000L;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;               tv.tv_usec %= 1000000L;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;               rp-&gt;expireM = tv;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; +            if (rp-&gt;callback)<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; +                  \
rp-&gt;callback(NETSNMP_CALLBACK_OP_RESEND, sp,<br> &gt;&gt;&gt;&gt; | &gt; | &gt; +  \
rp-&gt;pdu-&gt;reqid, rp-&gt;pdu, rp-&gt;cb_data);<br> &gt;&gt;&gt;&gt; | &gt; | &gt; \
}<br> &gt;&gt;&gt;&gt; | &gt; | &gt;         return 0;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;   }<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; When I tried to remove it, it just stop complaining \
about<br> &gt;&gt;&gt;&gt; operation 6,<br>
&gt;&gt;&gt;&gt; | &gt; but<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; the core dump is still present.<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; May I ask you for help with this issue? Do you have \
any idea,<br> &gt;&gt; what<br>
&gt;&gt;&gt;&gt; | &gt; causing<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; this issue in 5.8 and how to fix it?<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; I know, that Jan Safranek has fixed this for 5.7 by \
commit [2],<br> &gt;&gt;&gt;&gt; but it<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; looks like something other has changed and this issue \
is current<br> &gt;&gt;&gt;&gt; again.<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; [1] <a \
href="https://sourceforge.net/p/net-snmp/bugs/2411/" rel="noreferrer" \
target="_blank">https://sourceforge.net/p/net-snmp/bugs/2411/</a><br> \
&gt;&gt;&gt;&gt; | &gt; | &gt; [2]<br> &gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt; <a href="https://github.com/net-snmp/net-snmp/commit/793d596838ff7cb48a73b675d62897c56c9e62df" \
rel="noreferrer" target="_blank">https://github.com/net-snmp/net-snmp/commit/793d596838ff7cb48a73b675d62897c56c9e62df</a><br>
 &gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Regards<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Josef Ridky<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Software Engineer<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Core Services Team<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Red Hat Czech, s.r.o.<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; _______________________________________________<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; Net-snmp-coders mailing list<br>
&gt;&gt;&gt;&gt; | &gt; | &gt; <a href="mailto:Net-snmp-coders@lists.sourceforge.net" \
target="_blank">Net-snmp-coders@lists.sourceforge.net</a><br> &gt;&gt;&gt;&gt; | &gt; \
| &gt; <a href="https://lists.sourceforge.net/lists/listinfo/net-snmp-coders" \
rel="noreferrer" target="_blank">https://lists.sourceforge.net/lists/listinfo/net-snmp-coders</a><br>
 &gt;&gt;&gt;&gt; | &gt; | &gt;<br>
&gt;&gt;&gt;&gt; | &gt; |<br>
&gt;&gt;&gt;&gt; | &gt;<br>
&gt;&gt;&gt;&gt; |<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; Net-snmp-coders mailing list<br>
&gt;&gt;&gt; <a href="mailto:Net-snmp-coders@lists.sourceforge.net" \
target="_blank">Net-snmp-coders@lists.sourceforge.net</a><br> &gt;&gt;&gt; <a \
href="https://lists.sourceforge.net/lists/listinfo/net-snmp-coders" rel="noreferrer" \
target="_blank">https://lists.sourceforge.net/lists/listinfo/net-snmp-coders</a><br> \
&gt;&gt;&gt;<br> &gt;&gt;<br>
&gt; <br>
</blockquote></div>
_______________________________________________<br>
Net-snmp-coders mailing list<br>
<a href="mailto:Net-snmp-coders@lists.sourceforge.net" \
target="_blank">Net-snmp-coders@lists.sourceforge.net</a><br> <a \
href="https://lists.sourceforge.net/lists/listinfo/net-snmp-coders" rel="noreferrer" \
target="_blank">https://lists.sourceforge.net/lists/listinfo/net-snmp-coders</a><br> \
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" \
class="gmail-m_-8613134433695791110gmail-m_6929598511783199391gmail_signature"><div \
dir="ltr"><div style="color:rgb(0,0,0);font-family:Times"><font size="2"><b>Sam \
Tannous</b></font><br><font size="2">Engineering</font><br><span \
style="font-size:small">Cumulus Networks</span><span \
style="font-size:small;font-family:arial,helvetica,sans-serif"> ®</span><br><span \
style="font-size:small"><span style="color:rgb(0,90,149)"><a \
style="color:rgb(0,90,149);text-decoration:none">+1 650 383 6700</a></span>  x \
1106</span><br><span style="font-size:small"><span style="color:rgb(0,90,149)"><a \
href="http://www.cumulusnetworks,com" \
style="color:rgb(0,90,149);text-decoration:none" target="_blank"></a></span><span \
style="color:rgb(0,90,149)"><a href="http://www.cumulusnetworks.com" \
style="color:rgb(0,90,149);text-decoration:none" \
target="_blank">www.cumulusnetworks.com</a></span></span><br></div><div \
style="color:rgb(0,0,0);font-family:Times;font-size:14px"><span \
style="font-family:arial,helvetica,sans-serif;font-size:small">  </span></div><div \
style="color:rgb(0,0,0);font-family:Times;font-size:14px"><span \
style="font-family:arial,helvetica,sans-serif;font-size:small">Evaluate Cumulus ®  \
Linux ®<br><span style="color:rgb(0,90,149)"><span><a \
href="https://cumulusnetworks.com/product/secure/evaluate/" \
style="color:rgb(0,90,149);text-decoration:none" \
target="_blank">https://cumulusnetworks.com/product/secure/evaluate/</a></span></span><br><br>Become \
a Partner<br><span style="color:rgb(0,90,149)"><span><a \
href="http://cumulusnetworks.com/partners/become-a-partner/" \
style="color:rgb(0,90,149);text-decoration:none" \
target="_blank">http://cumulusnetworks.com/partners/become-a-partner/</a></span></span></span></div></div></div>
 </blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" \
class="gmail-m_-8613134433695791110gmail_signature"><div dir="ltr"><div \
style="color:rgb(0,0,0);font-family:Times"><font size="2"><b>Sam \
Tannous</b></font><br><font size="2">Engineering</font><br><span \
style="font-size:small">Cumulus Networks</span><span \
style="font-size:small;font-family:arial,helvetica,sans-serif"> ®</span><br><span \
style="font-size:small"><span style="color:rgb(0,90,149)"><a \
style="color:rgb(0,90,149);text-decoration:none">+1 650 383 6700</a></span>  x \
1106</span><br><span style="font-size:small"><span style="color:rgb(0,90,149)"><a \
href="http://www.cumulusnetworks,com" \
style="color:rgb(0,90,149);text-decoration:none" target="_blank"></a></span><span \
style="color:rgb(0,90,149)"><a href="http://www.cumulusnetworks.com" \
style="color:rgb(0,90,149);text-decoration:none" \
target="_blank">www.cumulusnetworks.com</a></span></span><br></div><div \
style="color:rgb(0,0,0);font-family:Times;font-size:14px"><span \
style="font-family:arial,helvetica,sans-serif;font-size:small">  </span></div><div \
style="color:rgb(0,0,0);font-family:Times;font-size:14px"><span \
style="font-family:arial,helvetica,sans-serif;font-size:small">Evaluate Cumulus ®  \
Linux ®<br><span style="color:rgb(0,90,149)"><span><a \
href="https://cumulusnetworks.com/product/secure/evaluate/" \
style="color:rgb(0,90,149);text-decoration:none" \
target="_blank">https://cumulusnetworks.com/product/secure/evaluate/</a></span></span><br><br>Become \
a Partner<br><span style="color:rgb(0,90,149)"><span><a \
href="http://cumulusnetworks.com/partners/become-a-partner/" \
style="color:rgb(0,90,149);text-decoration:none" \
target="_blank">http://cumulusnetworks.com/partners/become-a-partner/</a></span></span></span></div></div></div>
 </blockquote></div>





_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic