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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 28 Jan 2014 13:09:10 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	"Kirill A. Shutemov" <kirill@...temov.name>
Cc:	Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: readahead: fix do_readahead for no readpage(s)

On Tue, 28 Jan 2014 23:01:26 +0200 "Kirill A. Shutemov" <kirill@...temov.name> wrote:

> On Tue, Jan 28, 2014 at 12:03:01PM -0800, Andrew Morton wrote:
> > On Tue, 28 Jan 2014 11:14:19 +0000 Mark Rutland <mark.rutland@....com> wrote:
> > 
> > > Commit 63d0f0a3c7e1 (mm/readahead.c:do_readhead(): don't check for
> > > ->readpage) unintentionally made do_readahead return 0 for all valid
> > > files regardless of whether readahead was supported, rather than the
> > > expected -EINVAL. This gets forwarded on to userspace, and results in
> > > sys_readahead appearing to succeed in cases that don't make sense (e.g.
> > > when called on pipes or sockets). This issue is detected by the LTP
> > > readahead01 testcase.
> > 
> > How can this be?
> > 
> > : static ssize_t
> > : do_readahead(struct address_space *mapping, struct file *filp,
> > : 	     pgoff_t index, unsigned long nr)
> > : {
> > : 	if (!mapping || !mapping->a_ops)
> > : 		return -EINVAL;
> > : 
> > : 	return force_page_cache_readahead(mapping, filp, index, nr);
> 
> It's not what we have in Linus' tree. force_page_cache_readahead() return
> code is unused:
> 
> 	force_page_cache_readahead(mapping, filp, index, nr);
> 	return 0;
> 

ah, oops, I was looking at the code with Mark's patch applied.

Yes, the force_page_cache_readahead() return value should be propagated.

And I guess the lobotomising of the force_page_cache_readahead() return
value is OK.  force_page_cache_readahead() presently returns an errno
even if it has performed some reads.  A read()-style function shouldn't
do that - it should return a short read in that case.

--
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