mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Bug in 2.2 update_vm_cache_conditional?
@ 2001-03-14 17:49 Ulrich.Weigand
  2001-03-15 18:19 ` Andrea Arcangeli
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich.Weigand @ 2001-03-14 17:49 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel



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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug in 2.2 update_vm_cache_conditional?
  2001-03-14 17:49 Bug in 2.2 update_vm_cache_conditional? Ulrich.Weigand
@ 2001-03-15 18:19 ` Andrea Arcangeli
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Arcangeli @ 2001-03-15 18:19 UTC (permalink / raw)
  To: Ulrich.Weigand; +Cc: alan, linux-kernel

On Wed, Mar 14, 2001 at 06:49:33PM +0100, Ulrich.Weigand@de.ibm.com wrote:
> that manifests itself only on S/390:

I guess it could trigger also on sparc.

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

That's a severe bug, fix is obviously right.

Andrea

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-03-15 18:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-14 17:49 Bug in 2.2 update_vm_cache_conditional? Ulrich.Weigand
2001-03-15 18:19 ` Andrea Arcangeli

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®