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

Submitter:  Christian Prochaska <cproc>
Submitted:  Sat 03 Aug 2013 08:17:30 PM UTC
   
 
Category:  TCP Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

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>
Group 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>
Group 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>
Group administrator
Thu 20 Feb 2014 09:35:56 PM UTC, comment #3: 

Fixed, thanks.

Simon Goldschmidt <goldsimon>
Group administrator
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>

 

(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 uwe (Posted a comment)
  • -email is unavailable- added by gradator (Posted a comment)
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by thomask77
  • -email is unavailable- added by thomask77 (Posted a comment)
  • -email is unavailable- added by cproc (Submitted the item)
  •  

    There are 0 votes 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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-05-11 gradator StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2015-04-01 goldsimon StatusFixed In Progress
        Open/ClosedClosed Open
    2014-02-20 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2013-09-08 thomask77 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code