buglwIP - A Lightweight TCP/IP stack - Bugs: bug #58817, SNTP - MEMP_SYS_TIMEOUT memory...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #58817: SNTP - MEMP_SYS_TIMEOUT memory pool exhaustion when receive KOD packet

Submitter:  Jon Welch <g7jjf>
Submitted:  Fri 24 Jul 2020 11:23:56 AM UTC
Votes: 1
 
Category:  apps Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
lwIP version:  git head

Thu 20 May 2021 10:02:19 AM UTC, comment #1: 


original submission:

> There appears to be an issue when receiving SNTP Kiss Of Death packets. After receiving several KOD packets, I started to see 'sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty' assertions displayed.
>
> Looking at SNTP.C, around line 536, we have two sys_untimeout functions calls to cancel active timeouts when receiving a good packet. However, there isn't a corresponding sys_untimeout(sntp_request) just before the sntp_try_next_server call around line 553 when receiving a KOD packet. Since the timeout isn't cancelled, this appears to reduce the memory pool which eventually results in the assertion displayed above. Changing the code to :
>
>     if (sntp_opmode == SNTP_OPMODE_POLL) {
>       /* Kiss-of-death packet. Use another server or increase UPDATE_DELAY. */
>       sys_untimeout(sntp_request, NULL);
>
>       sntp_try_next_server(NULL);
>     }
>
> appears to solve the problem.
>

yuanjianmin <yuanjm>
Fri 24 Jul 2020 11:23:56 AM UTC, original submission:  

There appears to be an issue when receiving SNTP Kiss Of Death packets. After receiving several KOD packets, I started to see 'sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty' assertions displayed.

Looking at SNTP.C, around line 536, we have two sys_untimeout functions calls to cancel active timeouts when receiving a good packet. However, there isn't a corresponding sys_untimeout(sntp_request) just before the sntp_try_next_server call around line 553 when receiving a KOD packet. Since the timeout isn't cancelled, this appears to reduce the memory pool which eventually results in the assertion displayed above. Changing the code to :

    if (sntp_opmode == SNTP_OPMODE_POLL) {
      /* Kiss-of-death packet. Use another server or increase UPDATE_DELAY. */
      sys_untimeout(sntp_request, NULL);

      sntp_try_next_server(NULL);
    }

appears to solve the problem.

Jon Welch <g7jjf>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by yuanjm (Posted a comment)
  • -email is unavailable- added by yuanjm (Voted in favor of this item)
  • -email is unavailable- added by g7jjf (Submitted the item)
  • -email is unavailable- added by g7jjf
  •  

    There is 1 vote so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-05-20 yuanjm Carbon-Copy- Added yuanjm
    2020-07-24 g7jjf Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code