buglwIP - A Lightweight TCP/IP stack - Bugs: bug #39683, Assertion "seg->tcphdr not...

 
 

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

bug #39683: Assertion "seg->tcphdr not aligned" failed with MEM_ALIGNMENT = 8

Submitted by:  Christian Prochaska <cproc>
Submitted on:  Sat 03 Aug 2013 08:17:30 PM UTC  
 
Category: TCPSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

(Jump to the original submission Jump to the original submission)

Mon 11 May 2015 09:15:30 AM UTC, comment #7:

I guess you are right, LWIP_MIN(MEM_ALIGNMENT, 4) should do the trick.

Sylvain Rochet <gradator>
Project Member
Sun 10 May 2015 10:38:08 PM UTC, comment #6:

I've been using

((mem_ptr_t)seg->tcphdr % (MEM_ALIGNMENT < 4 ? MEM_ALIGNMENT : 4)) == 0)

(which should probably be expressed with LWIP_MIN)

Valery Ushakov <uwe>
Fri 08 May 2015 05:33:19 PM UTC, comment #5:

It also breaks things for MEM_ALIGNMENT==1, MEM_ALIGNMENT is historically set to 1 in unix port minimal example by default.

Most x86_64 CPUs are able to do unaligned access without any cost penalty so that's actually a fine default for unix ports.

Sylvain Rochet <gradator>
Project Member
Wed 01 Apr 2015 11:35:39 AM UTC, comment #4:

The proposed/applied fix breaks things for MEM_ALIGNMENT==2.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 20 Feb 2014 09:35:56 PM UTC, comment #3:

Fixed, thanks.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 17 Sep 2013 07:09:31 PM UTC, comment #2:

> We have a similar problem here, and I just wanted to file a
> similar bug.
>
> Our ethernet driver needs 32 byte alignment because of cache
> and DMA issues.
>
> Did you find a solution yet?


I've set MEM_ALIGNENT to 4 for x86_64 for now to avoid the assertions. So, not a real solution so far.

Christian Prochaska <cproc>
Sun 08 Sep 2013 09:23:35 PM UTC, comment #1:

We have a similar problem here, and I just wanted to file a similar bug.

Our ethernet driver needs 32 byte alignment because of cache and DMA issues.

Did you find a solution yet?

Thomas Kindler <thomask77>
Sat 03 Aug 2013 08:17:30 PM UTC, original submission:

'seg->tcphdr' often gets calculated as 'p->payload - TCP_HLEN', where 'p->payload' is aligned to MEM_ALIGNMENT and TCP_HLEN is a constant 20. So, with MEM_ALIGNMENT = 8 (for x86_64), the result cannot be aligned to MEM_ALIGNMENT.

From the commit log of 'tcp_out.c' I've seen that the assertion's condition got changed from 4 to MEM_ALIGNMENT a while ago. So, does this mean that MEM_ALIGNMENT should not be set to 8 for x86_64?

Christian Prochaska <cproc>

 

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 uwe (Posted a comment)
  • -unavailable- added by gradator (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by thomask77
  • -unavailable- added by thomask77 (Posted a comment)
  • -unavailable- added by cproc (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):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 11 May 2015 09:25:15 AM UTCgradatorStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Wed 01 Apr 2015 11:35:39 AM UTCgoldsimonStatusFixed=>In Progress
      Open/ClosedClosed=>Open
    Thu 20 Feb 2014 09:35:56 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
    Sun 08 Sep 2013 09:24:44 PM UTCthomask77Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1