lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 08 May 2008 08:47:09 +0200
From:	Miklos Szeredi <miklos@...redi.hu>
To:	trond.myklebust@....uio.no, npiggin@...e.de
CC:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	linux-mm@...ck.org
Subject: Re: NFS infinite loop in filemap_fault()

> Page fault on NFS apparently goes into an infinite loop if the read on
> the server fails.
> 
> I don't understand the NFS readpage code, but the filemap_fault() code
> looks somewhat suspicious:
> 
> 	/*
> 	 * Umm, take care of errors if the page isn't up-to-date.
> 	 * Try to re-read it _once_. We do this synchronously,
> 	 * because there really aren't any performance issues here
> 	 * and we need to check for errors.
> 	 */
> 	ClearPageError(page);
> 	error = mapping->a_ops->readpage(file, page);
> 	page_cache_release(page);
> 
> 	if (!error || error == AOP_TRUNCATED_PAGE)
> 		goto retry_find;
> 
> The comment doesn't seem to match what the it actually does: if
> ->readpage() is asynchronous, then this will just repeat everything,
> without any guarantee that it will re-read once.

This patch fixes it.  It's probably wrong in some subtle way though...

Miklos


---
 mm/filemap.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux.git/mm/filemap.c
===================================================================
--- linux.git.orig/mm/filemap.c	2008-05-08 08:17:22.000000000 +0200
+++ linux.git/mm/filemap.c	2008-05-08 08:19:59.000000000 +0200
@@ -1461,6 +1461,12 @@ page_not_uptodate:
 	 */
 	ClearPageError(page);
 	error = mapping->a_ops->readpage(file, page);
+	if (!error && !PageUptodate(page)) {
+		lock_page(page);
+		if (!PageUptodate(page))
+			error = -EIO;
+		unlock_page(page);
+	}
 	page_cache_release(page);
 
 	if (!error || error == AOP_TRUNCATED_PAGE)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ