lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #34429] In RAW/NO_SYS mode, with LWIP_ALLOW_MEM_FREE_F


From: Min Xu
Subject: [lwip-devel] [bug #34429] In RAW/NO_SYS mode, with LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT set to 1, memory gets corrupted
Date: Thu, 29 Sep 2011 02:22:05 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:7.0) Gecko/20100101 Firefox/7.0

URL:
  <http://savannah.nongnu.org/bugs/?34429>

                 Summary: In RAW/NO_SYS mode, with
LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT set to 1, memory gets corrupted
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: maximalmin
            Submitted on: Thu 29 Sep 2011 02:22:04 AM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: 1.4.0

    _______________________________________________________

Details:

Wen building an application with LwIP on the TI/DSP where the the Transmit
interrupt routine (where EMAC module reports it has sent out packet[s]) calls
the pbuf_free function on PBUF_RAM and PBUF_POOL type pbufs, setting the stock
LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT flag still results in memory
corruption.

Currently work around by renaming the mem_malloc, mem_trim and mem_free
functions and then add wrap around functions that calls 

        LWIP_MEM_ALLOC_DECL_PROTECT();
        LWIP_MEM_ALLOC_PROTECT();
and 
        LWIP_MEM_ALLOC_UNPROTECT();

around the original routine.

If there is someone more familiar with this section of code in race condition
and more qualified can work on fixing it.

My current guess is that in mem_alloc, inside the for loop
for (ptr = (mem_size_t)((u8_t *)lfree - ram); ptr < MEM_SIZE_ALIGNED - size;
         ptr = ((struct mem *)(void *)&ram[ptr])->next)


It's possible that the mem_free code that may have run between the
LWIP_MEM_ALLOC_UNPROTECT() and LWIP_MEM_ALLOC_PROTECT() has possibly
invalidated mem (e.g., plug holes etc)




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?34429>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]