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-next>] [day] [month] [year] [list]
Date:	Sun, 12 Apr 2009 15:16:05 +0800
From:	Wu Fengguang <fengguang.wu@...el.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	LKML <linux-kernel@...r.kernel.org>, linux-fsdevel@...r.kernel.org,
	Chenfeng Xu <xcf@...c.edu.cn>
Subject: [RFC][PATCH] vfs: check inode size on no_cached_page

[This patch may not necessarily be merged, but at least we should
 be aware of the problem.]

When user space requests past-EOF data, do_generic_file_read() will
issue a bonus readpage call, which may be unfavorable.

do_generic_file_read:
        -> find_page:
        -> find_get_page()             = NULL
        -> page_cache_sync_readahead()
        -> find_get_page()             = NULL
        -> no_cached_page:
        -> readpage:
                -> nfs_readpage()      = error
        -> readpage_error:

Reported-by: Xu Chenfeng <xcf@...c.edu.cn>
Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
---
 mm/filemap.c |    5 +++++
 1 file changed, 5 insertions(+)

--- mm.orig/mm/filemap.c
+++ mm/mm/filemap.c
@@ -1269,6 +1269,11 @@ readpage_error:
 		goto out;
 
 no_cached_page:
+		isize = i_size_read(inode);
+		end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
+		if (unlikely(!isize || index > end_index))
+			goto out;
+
 		/*
 		 * Ok, it wasn't cached, so we need to create a new
 		 * 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