From: Patrick McHardy <kaber@trash.net>
To: cndougla@linux.vnet.ibm.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] AF_PACKET: Fix PACKET_MMAP on 64-bit kernel/32-bit user systems
Date: Mon, 10 Aug 2009 19:17:06 +0200 [thread overview]
Message-ID: <4A805612.5080709@trash.net> (raw)
In-Reply-To: <20090810130359.p2hixk2eoow8kwg8@imap.linux.ibm.com>
cndougla@linux.vnet.ibm.com wrote:
> PACKET_MMAP sets up a ring buffer at a memory location so that kernel
> and user space can read from it without extra overhead. However, the
> data is written with a header, struct tpacket_hdr, which begins with an
> unsigned long field, tp_status. This means in a split 64-bit/32-bit
> environment the kernel- and user-space reads from the mmap'd region will
> be different, since in kernel-space the field is 64-bit while in
> user-space the field is 32-bit.
>
> The following patch makes the size of the structure constant by changing
> the tp_status field to 32-bits. It does not appear to need 64-bits,
> since only 4-bits are actually used throughout the AF_PACKET code.
>
> Signed-off-by: Chase Douglas <cndougla@linux.vnet.ibm.com>
> --- a/include/linux/if_packet.h 2009-08-10 16:53:11.000000000 +0000
> +++ b/include/linux/if_packet.h 2009-08-10 16:53:28.000000000 +0000
> @@ -65,7 +65,7 @@ struct tpacket_auxdata
>
> struct tpacket_hdr
> {
> - unsigned long tp_status;
> + unsigned int tp_status;
This changes the layout on 64 bit and thus breaks compatibility.
The tpacket2_hdr doesn't suffer from this problem.
next prev parent reply other threads:[~2009-08-10 17:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-10 17:03 [PATCH] AF_PACKET: Fix PACKET_MMAP on 64-bit kernel/32-bit user systems cndougla
2009-08-10 17:17 ` Patrick McHardy [this message]
2009-08-10 18:52 ` Chase Douglas
2009-08-11 1:06 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A805612.5080709@trash.net \
--to=kaber@trash.net \
--cc=cndougla@linux.vnet.ibm.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).