From: David Brownell <david-b@pacbell.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Vasiliy Kulikov <segooon@gmail.com>,
kernel-janitors@vger.kernel.org,
Greg Kroah-Hartman <gregkh@suse.de>,
Oliver Neukum <oliver@neukum.org>,
Andi Kleen <ak@linux.intel.com>,
Chris Frey <cdfrey@foursquare.net>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: core: fix information leak to userland
Date: Sat, 6 Nov 2010 12:07:57 -0700 (PDT) [thread overview]
Message-ID: <305211.72066.qm@web180314.mail.gq1.yahoo.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1011061441150.28403-100000@netrider.rowland.org>
--- On Sat, 11/6/10, Alan Stern <stern@rowland.harvard.edu> wrote:
> >
>
> Unfortunately I don't have a copy of the C standard here to
> consult.
> However... Although I'm perfectly willing to believe
> that the standard
> requires fields in a structure to be initialized to 0 if
> they
> aren't mentioned explicitly in the initializer, I'm
> considerably more
> doubtful that it also requires padding to be initialized!
ISTR initialization-to-zero is the standard
behavior defined for all _memory_ that gets
initialized ... not just named fields ...
whether the init is "static", "bss", or not.
>
> And I certainly wouldn't want to depend on compilers
> _always_ using
> memset to do this initialization.
Of course not; just rely on init-to-zero, and
let the compiler worry about efficiency. In
some cases memset(); in others, the result
might be as if memset were inlined, so only
a few "write a zero at this address" type
instructions would be needed.
>
> > There's certainly a fair amount of code I've seen
> > that uses runtime initializers like that, to zero
> > memory. I can't believe i's _all_ broken!
> ;)
>
> Zeroing memory that belongs to a declared field is
> different from
> zeroing padding bytes. Maybe what you remember seeing
> is the first and
> not the second.
I remember seeing both, and at one point looking
at the issue to verify that padding was treated
uniformly (like other memory). Also, writing code
that relied on zero-initted padding.
- Dave
prev parent reply other threads:[~2010-11-06 19:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-06 14:41 Vasiliy Kulikov
2010-11-06 18:21 ` Alan Stern
2010-11-06 18:30 ` David Brownell
2010-11-06 18:47 ` Alan Stern
2010-11-06 19:07 ` David Brownell [this message]
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=305211.72066.qm@web180314.mail.gq1.yahoo.com \
--to=david-b@pacbell.net \
--cc=ak@linux.intel.com \
--cc=cdfrey@foursquare.net \
--cc=gregkh@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=segooon@gmail.com \
--cc=stern@rowland.harvard.edu \
/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
all inboxes | Powered by JetHome®