mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ulrich.Weigand@de.ibm.com
To: alan@lxorguk.ukuu.org.uk
Cc: linux-kernel@vger.kernel.org
Subject: Bug in 2.2 update_vm_cache_conditional?
Date: Wed, 14 Mar 2001 18:49:33 +0100	[thread overview]
Message-ID: <C1256A0F.0061EC62.00@d12mta11.de.ibm.com> (raw)



Hi Alan,

there appears to a bug in update_vm_cache_conditional
that manifests itself only on S/390:

update_vm_cache_conditional is called with a source_address
parameter that can either be a kernel or a user space virtual
address, depending on how get_fs() is set.

update_vm_cache_conditional wants to check whether the
source_address is in fact equal to the destination address
in the page cache.  This check should hit only when the
source_address is actually a *kernel* space address; if the
source is a user space address the page cache must always
be updated.

However, update_vm_cache_conditional never checks whether the
address is a kernel address, it does just a
  if ((unsigned long)dest != source_address)

On Intel, this is not a problem, as every user space address
is different from every kernel space address anyway.

On S/390, however, the kernel lives in a separate address space,
so shares the same range of addresses as the user spaces.  This
means that in certain rare cases, this check can accidentally
hit even if the source lives in user space.

This leads to the page cache update being skipped, and the
page cache is inconsistent with the buffer cache afterwards :-(

Do you agree that this is a bug?  What do you think of this fix:

Index: filemap.c
===================================================================
RCS file: /home/cvs/linux/mm/filemap.c,v
retrieving revision 1.3
diff -u -r1.3 filemap.c
--- filemap.c  2000/06/09 19:15:25 1.3
+++ filemap.c  2001/03/14 16:52:29
@@ -252,7 +252,8 @@
          if (page) {
               char *dest = (char*) (offset + page_address(page));

-              if ((unsigned long)dest != source_address) {
+              if (   (unsigned long)dest != source_address
+                            || !segment_eq(get_fs(), KERNEL_DS)) {
                    wait_on_page(page);
                    memcpy(dest, buf, len);
                    flush_dcache_page(page_address(page));


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email: Ulrich.Weigand@de.ibm.com



             reply	other threads:[~2001-03-14 17:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-14 17:49 Ulrich.Weigand [this message]
2001-03-15 18:19 ` Andrea Arcangeli

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=C1256A0F.0061EC62.00@d12mta11.de.ibm.com \
    --to=ulrich.weigand@de.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®