buglwIP - A Lightweight TCP/IP stack - Bugs: bug #52719, sys_timeouts synchronization issue...

 
 

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

bug #52719: sys_timeouts synchronization issue with core locking (NO_SYS == 0)

Submitted by:  Joel Cunningham <jcunningham>
Submitted on:  Thu 21 Dec 2017 09:50:59 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenPlanned Release: None
lwIP version: git head

Thu 21 Dec 2017 09:50:59 PM UTC, original submission:

I've found a synchronization issue with sys_timeouts and core locking for NO_SYS == 0. This was found during code inspection.

The TCP/IP thread calls sys_timeouts_mbox_fetch() with the core lock explicitly released. Within this function, next_timeout is read/modified in sys_timeouts_sleeptime and sys_check_timeouts.

Since sys_timeout/untimeout also read/modify next_timeout, this can only be safely called from the TCP/IP thread. I believe I've found instances with core locking where sys_timeout/untimeout will be called on another thread.

The macro TCP_REG will be executed in a number of cases from other threads and it calls tcp_timer_needed(). If tcpip_tcp_timer_active is 0 and tcp_active_pcbs or tcp_tw_pcbs are non-NULL, sys_timeout will be called to start the TCP timer.

In one of my test environments, I put a breakpoint on when this particular sys_timeout is called and I found an application thread inside lwip_connect() which triggered it

I also see a lot of calls to sys_timeout in PPP code, which may also be executed on another thread with core locking (I'm not that familiar with the PPP architecture though)

Joel Cunningham <jcunningham>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jcunningham (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1