lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] memp_overflow_check_element_overflow assertion in debug bui


From: Axel Lin
Subject: [lwip-devel] memp_overflow_check_element_overflow assertion in debug build (MEMP_OVERFLOW_CHECK=2)
Date: Thu, 3 Nov 2016 11:24:31 +0800

Hi list,
I hit memp_overflow_check_element_overflow assertion in debug build
(MEMP_OVERFLOW_CHECK=2)
with the code in current git tree.

I don't figure out why this happen, below shows my debug print.
Appreciate if someone can give me some suggestions to address this issue.

memp_init: 0 RAW_PCB
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x2000eff4   desc->base:0x2000eff4 desc->size:28
memp(0):0x2000f03c
memp(1):0x2000f084
memp(2):0x2000f0cc
memp(3):0x2000f114
memp_init: 1 UDP_PCB
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x200029bc   desc->base:0x200029bc desc->size:40
memp(0):0x20002a10
memp(1):0x20002a64
memp(2):0x20002ab8
memp(3):0x20002b0c
memp_init: 2 TCP_PCB
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x2000e60c   desc->base:0x2000e60c desc->size:160
memp(0):0x2000e6d8
memp(1):0x2000e7a4
memp(2):0x2000e870
memp(3):0x2000e93c
memp(4):0x2000ea08
memp(5):0x2000ead4
memp(6):0x2000eba0
memp(7):0x2000ec6c
memp(8):0x2000ed38
memp(9):0x2000ee04
memp(10):0x2000eed0
memp(11):0x2000ef9c
memp_init: 3 TCP_PCB_LISTEN
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x20003f3c   desc->base:0x20003f39 desc->size:32 <<< Here
memp(0):0x20003f88
memp(1):0x20003fd4
memp(2):0x20004020
memp(3):0x2000406c
memp(4):0x200040b8
memp(5):0x20004104
memp(6):0x20004150
memp(7):0x2000419c
memp_init: 4 TCP_SEG
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x2000d044   desc->base:0x2000d044 desc->size:20
memp(0):0x2000d084
memp(1):0x2000d0c4
memp(2):0x2000d104
memp(3):0x2000d144
memp(4):0x2000d184
memp(5):0x2000d1c4
memp(6):0x2000d204
memp(7):0x2000d244
memp(8):0x2000d284
memp(9):0x2000d2c4
memp(10):0x2000d304
memp(11):0x2000d344
memp(12):0x2000d384
memp(13):0x2000d3c4
memp(14):0x2000d404
memp(15):0x2000d444
memp(16):0x2000d484
memp(17):0x2000d4c4
memp(18):0x2000d504
memp(19):0x2000d544
memp(20):0x2000d584
memp(21):0x2000d5c4
memp(22):0x2000d604
memp(23):0x2000d644
memp(24):0x2000d684
memp_init: 5 REASSDATA
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x200034ec   desc->base:0x200034ec desc->size:32
memp(0):0x20003538
memp(1):0x20003584
memp(2):0x200035d0
memp_init: 6 NETBUF
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x200030d8   desc->base:0x200030d7 desc->size:16
memp(0):0x20003114
memp(1):0x20003150
memp(2):0x2000318c
memp(3):0x200031c8
memp(4):0x20003204
memp(5):0x20003240
memp(6):0x2000327c
memp(7):0x200032b8
memp(8):0x200032f4
memp(9):0x20003330
memp(10):0x2000336c
memp(11):0x200033a8
memp(12):0x200033e4
memp(13):0x20003420
memp(14):0x2000345c
memp(15):0x20003498
memp_init: 7 NETCONN
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x2000d7f4   desc->base:0x2000d7f4 desc->size:48
memp(0):0x2000d850
memp(1):0x2000d8ac
memp(2):0x2000d908
memp(3):0x2000d964
memp(4):0x2000d9c0
memp(5):0x2000da1c
memp(6):0x2000da78
memp(7):0x2000dad4
memp(8):0x2000db30
memp(9):0x2000db8c
memp(10):0x2000dbe8
memp(11):0x2000dc44
memp(12):0x2000dca0
memp(13):0x2000dcfc
memp(14):0x2000dd58
memp(15):0x2000ddb4
memp(16):0x2000de10
memp(17):0x2000de6c
memp_init: 8 TCPIP_MSG_API
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x200037b8   desc->base:0x200037b6 desc->size:16
memp(0):0x200037f4
memp(1):0x20003830
memp(2):0x2000386c
memp(3):0x200038a8
memp(4):0x200038e4
memp(5):0x20003920
memp(6):0x2000395c
memp(7):0x20003998
memp(8):0x200039d4
memp(9):0x20003a10
memp(10):0x20003a4c
memp(11):0x20003a88
memp(12):0x20003ac4
memp(13):0x20003b00
memp(14):0x20003b3c
memp(15):0x20003b78
memp(16):0x20003bb4
memp(17):0x20003bf0
memp(18):0x20003c2c
memp(19):0x20003c68
memp(20):0x20003ca4
memp(21):0x20003ce0
memp(22):0x20003d1c
memp(23):0x20003d58
memp(24):0x20003d94
memp(25):0x20003dd0
memp(26):0x20003e0c
memp(27):0x20003e48
memp(28):0x20003e84
memp(29):0x20003ec0
memp(30):0x20003efc
memp(31):0x20003f38 << Here, the latest one has overlap with memp:0x20003f3c
memp_init: 9 TCPIP_MSG_INPKT
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x2000de70   desc->base:0x2000de6f desc->size:16
memp(0):0x2000deac
memp(1):0x2000dee8
memp(2):0x2000df24
memp(3):0x2000df60
memp(4):0x2000df9c
memp(5):0x2000dfd8
memp(6):0x2000e014
memp(7):0x2000e050
memp(8):0x2000e08c
memp(9):0x2000e0c8
memp(10):0x2000e104
memp(11):0x2000e140
memp(12):0x2000e17c
memp(13):0x2000e1b8
memp(14):0x2000e1f4
memp(15):0x2000e230
memp(16):0x2000e26c
memp(17):0x2000e2a8
memp(18):0x2000e2e4
memp(19):0x2000e320
memp(20):0x2000e35c
memp(21):0x2000e398
memp(22):0x2000e3d4
memp(23):0x2000e410
memp(24):0x2000e44c
memp(25):0x2000e488
memp(26):0x2000e4c4
memp(27):0x2000e500
memp(28):0x2000e53c
memp(29):0x2000e578
memp(30):0x2000e5b4
memp(31):0x2000e5f0
memp_init: 10 IGMP_GROUP
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x2000f138   desc->base:0x2000f138 desc->size:16
memp(0):0x2000f174
memp(1):0x2000f1b0
memp(2):0x2000f1ec
memp(3):0x2000f228
memp(4):0x2000f264
memp(5):0x2000f2a0
memp(6):0x2000f2dc
memp(7):0x2000f318
memp_init: 11 SYS_TIMEOUT
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x200035d4   desc->base:0x200035d3 desc->size:16
memp(0):0x20003610
memp(1):0x2000364c
memp(2):0x20003688
memp(3):0x200036c4
memp(4):0x20003700
memp(5):0x2000373c
memp(6):0x20003778
memp(7):0x200037b4
memp_init: 12 NETDB
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x2000d68c   desc->base:0x2000d68c desc->size:308
memp(0):0x2000d7ec
memp_init: 13 PBUF_REF/ROM
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x20002b14   desc->base:0x20002b14 desc->size:48
memp(0):0x20002b70
memp(1):0x20002bcc
memp(2):0x20002c28
memp(3):0x20002c84
memp(4):0x20002ce0
memp(5):0x20002d3c
memp(6):0x20002d98
memp(7):0x20002df4
memp(8):0x20002e50
memp(9):0x20002eac
memp(10):0x20002f08
memp(11):0x20002f64
memp(12):0x20002fc0
memp(13):0x2000301c
memp(14):0x20003078
memp(15):0x200030d4
memp_init: 14 PBUF_POOL
MEM_ALIGNMENT:4 MEMP_SIZE:28 MEMP_SANITY_REGION_AFTER_ALIGNED:16
memp:0x2000419c   desc->base:0x2000419c desc->size:1612
memp(0):0x20004814
memp(1):0x20004e8c
memp(2):0x20005504
memp(3):0x20005b7c
memp(4):0x200061f4
memp(5):0x2000686c
memp(6):0x20006ee4
memp(7):0x2000755c
memp(8):0x20007bd4
memp(9):0x2000824c
memp(10):0x200088c4
memp(11):0x20008f3c
memp(12):0x200095b4
memp(13):0x20009c2c
memp(14):0x2000a2a4
memp(15):0x2000a91c
detected memp overflow in pool TCP_PCB_LISTEN 0x20003f75

Above are print by adding debug code in memp_init_pool:

void
memp_init_pool(const struct memp_desc *desc)
{
#if MEMP_MEM_MALLOC
  LWIP_UNUSED_ARG(desc);
#else
  int i;
  struct memp *memp;

  *desc->tab = NULL;
LWIP_PLATFORM_DIAG(("MEM_ALIGNMENT:%u MEMP_SIZE:%u
MEMP_SANITY_REGION_AFTER_ALIGNED:%u\r\n",
                MEM_ALIGNMENT, MEMP_SIZE, MEMP_SANITY_REGION_AFTER_ALIGNED));
  memp = (struct memp*)LWIP_MEM_ALIGN(desc->base);
LWIP_PLATFORM_DIAG(("memp:%p   desc->base:%p desc->size:%u\r\n", (void
*)memp, (void *) desc->base, (unsigned) desc->size));
  /* create a linked list of memp elements */
  for (i = 0; i < desc->num; ++i) {
    memp->next = *desc->tab;
    *desc->tab = memp;
#if MEMP_OVERFLOW_CHECK
    memp_overflow_init_element(memp, desc);
#endif /* MEMP_OVERFLOW_CHECK */
   /* cast through void* to get rid of alignment warnings */
   memp = (struct memp *)(void *)((u8_t *)memp + MEMP_SIZE + desc->size
#if MEMP_OVERFLOW_CHECK
      + MEMP_SANITY_REGION_AFTER_ALIGNED
#endif
    );
LWIP_PLATFORM_DIAG(("memp(%d):%p\r\n", i, (void *)memp));
  }

Thanks,
Axel



reply via email to

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