From: "Oliver Pinter (Pintér Olivér)" <oliver.pntr@gmail.com>
To: "Linux Kernel" <linux-kernel@vger.kernel.org>,
stable@kernel.org, stable-commits@vger.kernel.org
Cc: "chrisw@sous-sol.org" <chrisw@sous-sol.org>,
"Greg KH" <gregkh@suse.de>, "Willy Tarreau" <w@1wt.eu>,
"Adrian Bunk" <bunk@kernel.org>,
"Andrea Arcangeli" <andrea@suse.de>
Subject: [2.6.22.y] {01/17} - do_anonymous_page-race - series for stable kernel
Date: Tue, 29 Jan 2008 00:13:16 +0100 [thread overview]
Message-ID: <6101e8c40801281513i74a39743j2dbfe764545cb834@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 19 bytes --]
--
Thanks,
Oliver
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: do_anonymous_page-race --]
[-- Type: text/x-diff; name=do_anonymous_page-race, Size: 1123 bytes --]
commit 8327e0f191341cc32fb89bf4d7bee7c2524ae4e0
Author: Andrea Arcangeli <andrea@suse.de>
Date: Mon Jan 28 20:52:29 2008 +0100
Subject: Race condition in userspace testcase
References: 46948, LTC11574
Additional Comment #103 From Andrea Arcangeli 2004-10-15 19:41
the last patch I attached is the safest I believe.
I'm not sure if a lock_unlock or lock_unlock is always guaranteed to happen
after the I/O, and this makes sure no race can happen anymore.
diff --git a/fs/bio.c b/fs/bio.c
index 093345f..984d589 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1028,6 +1028,15 @@ void bio_endio(struct bio *bio, unsigned int bytes_done, int error)
bio->bi_size -= bytes_done;
bio->bi_sector += (bytes_done >> 9);
+ if (bio_data_dir(bio) == READ)
+ /*
+ * If the current cpu has written to the page by hand
+ * without dma, we must enforce ordering to be sure
+ * this written data will be visible before we expose
+ * the page contents to other cpus (for example with
+ * a set_pte).
+ */
+ smp_wmb();
if (bio->bi_end_io)
bio->bi_end_io(bio, bytes_done, error);
}
reply other threads:[~2008-01-28 23:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=6101e8c40801281513i74a39743j2dbfe764545cb834@mail.gmail.com \
--to=oliver.pntr@gmail.com \
--cc=andrea@suse.de \
--cc=bunk@kernel.org \
--cc=chrisw@sous-sol.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=stable-commits@vger.kernel.org \
--cc=stable@kernel.org \
--cc=w@1wt.eu \
/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®