Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: netdev@vger.kernel.org, kaber@trash.net
Subject: Re: [PATCH] af_packet: prevent information leak
Date: Mon, 06 Jun 2011 22:24:16 -0700 (PDT)	[thread overview]
Message-ID: <20110606.222416.1114593259198630297.davem@davemloft.net> (raw)
In-Reply-To: <1307422939.2642.57.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 07 Jun 2011 07:02:19 +0200

> In 2.6.27, commit 393e52e33c6c2 (packet: deliver VLAN TCI to userspace)
> added a small information leak.
> 
> Add padding field and make sure its zeroed before copy to user.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Patrick McHardy <kaber@trash.net>

I fear this will change the size of these structures on some weird
architecture.  Doesn't ARM, for example, have weird rules
wrt. alignment and structure sizing when "smaller than word" elements
are involved?

That's why we need __packed on:

struct nd_opt_hdr {
	__u8		nd_opt_type;
	__u8		nd_opt_len;
} __packed;

for example.

Probably safe to just do a memset of the tail, and the constant length
will evaluate to zero on these weird platforms.  On others, where the
padding does matter, the memset will emit the same code as your new
assignments do.

  reply	other threads:[~2011-06-07  5:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07  5:02 [PATCH] af_packet: prevent information leak Eric Dumazet
2011-06-07  5:24 ` David Miller [this message]
2011-06-07  5:38   ` Eric Dumazet
2011-06-07  5:41     ` Eric Dumazet
2011-06-07  5:42     ` 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=20110606.222416.1114593259198630297.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kaber@trash.net \
    --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