From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: Chris Mason <mason@suse.com>,
linux-kernel@vger.kernel.org, andrea@suse.de
Subject: [PATCH INTRO] Re: [RFC] copy_from_user races with readpage
Subject: [PATCH 000 of 2] Introduction
Date: Fri, 28 Apr 2006 12:04:25 +1000 [thread overview]
Message-ID: <20060428114321.21969.patches@notabene> (raw)
In-Reply-To: message from Andrew Morton on Wednesday April 19
On Wednesday April 19, akpm@osdl.org wrote:
> Chris Mason <mason@suse.com> wrote:
> >
> > Hello everyone,
> >
> > I've been working with IBM on a long standing bug where zeros unexpectedly pop
> > up during a disk certification test. We tracked it down to copy_from_user.
....
>
> I'd have thought that a sufficient fix would be to change
> __copy_from_user_inatomic() to not do the zeroing, then review all users to
> make sure that they cannot leak uninitialised memory.
So I'm following this up and trying to figure out how best to make this
"right".
Following are two patches.
The first is the result of the suggested "review".
The only users of copy_from_user_inatomic that cannot safely lose the
zeroing are two separate (but similar:-() implmentations of
copy_from_user_iovec
These I have 'fixed'.
It is unfortunate that both chose to "know" exactly the difference between
the _inatomic and the regular versions, and call _inatomic not in atomic context.
It seems to suggest poor interface design, but I'm not sure exactly what
the poor choice is.
Also after reading this code I am very aware that on architectures that
aren't saddled with highmem (e.g. 64bit) the duplication of copy_from_user
is simply wasted icache space. Possibly it might make sense to guard the first
_inatomic copy with "if(PageHighMem(page))" which should complie it away to
nothing when highmem isn't present.
The second patch changes __copy_from_user_inatomic to not do zeroing
in i386. I'm quite open to the possiblity of being told that something
I did there is either very silly or very ugly or both. However not being
very experienced in arch/asm code I'm not sure what. Constructive
criticism very welcome.
If happiness is achieved with these patches, we then need to look at similar
patches for powerpc, mips, and sparc.
Thanks for your time.
NeilBrown
[PATCH 001 of 2] Prepare for __copy_from_user_inatomic to not zero missed bytes.
[PATCH 002 of 2] Make copy_from_user_inatomic NOT zero the tail on i386
next prev parent reply other threads:[~2006-04-28 2:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-19 17:18 [RFC] copy_from_user races with readpage Chris Mason
2006-04-19 20:41 ` Andrew Morton
2006-04-19 21:38 ` Andrew Morton
2006-04-19 22:18 ` Neil Brown
2006-04-19 23:36 ` Andrea Arcangeli
2006-04-28 2:04 ` NeilBrown [this message]
2006-04-28 2:10 ` [PATCH 001 of 2] Prepare for __copy_from_user_inatomic to not zero missed bytes NeilBrown
2006-04-28 2:10 ` [PATCH 002 of 2] Make copy_from_user_inatomic NOT zero the tail on i386 NeilBrown
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=20060428114321.21969.patches@notabene \
--to=neilb@suse.de \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@suse.com \
/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