4 byte mem alignment
I wished someone to confirm the following: Is it a requirement for the user space buffer that is provided to the recvfrom() socket call, be 4 byte aligned?. Note that sockets are raw sockets (PF_PACKET type). I am running linux 2.4.18-10 on a dual xeon P4 (x86) box. At the lowest level, i think this translates to how strong the requirements are for copy_to_user(). does it fault to byte-by-byte mode gracefully when given a non-4byte aligned buffer?.
Please include me in all replies, since i'm not subscribed to the list
Thanks
-Arvind
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
From: Arvind Gopalan <[email protected]>
Date: Sat, 28 Sep 2002 23:26:46 -0700 (PDT)
how strong the requirements are for copy_to_user(). does it fault to byte-by-byte mode gracefully when given a non-4byte aligned buffer?.
The x86 processor handles unaligned memory accesses in hw.
On any platform, copy_to_user() must handle any user and kernel buffer alignment.
Thanks Dave, for confirming my doubt. I have some user level code that uses raw sockets on
linux. The code ran on several dual PIII x86 machines without any issues. But since the time we started running (the same code with no changes) on the dual x86 xeons, i have seen some wierd corruption issues with the packets. This kernel already has the patch for the xeon TLB flush bug. On some of the eth packets that I dumped, i found that 8 bytes of data being "copied and inserted"!. As in after a certain offset into the packet, there would be a sequence of 8 bytes that would be an exact copy of the 8 bytes that appeared just before. All other following bytes were literally shifted down by 8. How can i proceed to debug this sort of a problem. if its a xeon specific issue, how can i isolate it?.
Thanks
-Arvind
Quoted 9 lines · --- "David S. Miller
From: Arvind Gopalan <[email protected]>
Date: Sat, 28 Sep 2002 23:26:46 -0700 (PDT)how strong the requirements are for
copy_to_user().
does it fault to byte-by-byte mode gracefully
when
given a non-4byte aligned buffer?.
Quoted 6 lines
The x86 processor handles unaligned memory accesses in hw.
On any platform,
copy_to_user()must handle any user and kernel buffer
alignment.
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com