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  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 20 Dec 2013 11:45:29 +0800
From:	Wanlong Gao <>
To:	LKML <>,
	Andrew Morton <>
CC:	Jan Stancek <>,
	Cong Wang <>,
	Wu Fengguang <>,
	Wanlong Gao <>
Subject: [BUG] LTP test case readahead01 fails after commit 63d0f0a3c7

Hi AKPM and folks,

LTP test readahead syscall return value like this:

static void test_invalid_fd(void)
	int fd[2];

	tst_resm(TINFO, "test_invalid_fd pipe");
	if (pipe(fd) < 0)
		tst_resm(TBROK | TERRNO, "Failed to create pipe");
	TEST(ltp_syscall(__NR_readahead, fd[0], 0, getpagesize()));

	tst_resm(TINFO, "test_invalid_fd socket");
	fd[0] = socket(AF_INET, SOCK_STREAM, 0);
	if (fd[0] < 0)
		tst_resm(TBROK | TERRNO, "Failed to create socket");
	TEST(ltp_syscall(__NR_readahead, fd[0], 0, getpagesize()));
FULL case code:

This case passed before the following kernel commit[1],
it means kernel will return -1 with errno=EINVAL. But after
this commit[1], kernel will return 0 here.

The different between before and after this commit[1] is that:
if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
	return EINVAL;

if (!mapping || !mapping->a_ops)
	return EINVAL;

And followed with:

if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages))
		return -EINVAL;

I think you must know which is right?

Wanlong Gao

commit 63d0f0a3c7e1281fd79268a8d988167eff607fb6
Author: Andrew Morton <>
Date:   Tue Nov 12 15:07:09 2013 -0800

    mm/readahead.c:do_readhead(): don't check for ->readpage
    The callee force_page_cache_readahead() already does this and unlike
    do_readahead(), force_page_cache_readahead() remembers to check for
    ->readpages() as well.
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Linus Torvalds <>

diff --git a/mm/readahead.c b/mm/readahead.c
index e4ed041..5024183 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -569,7 +569,7 @@ static ssize_t
 do_readahead(struct address_space *mapping, struct file *filp,
             pgoff_t index, unsigned long nr)
-       if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
+       if (!mapping || !mapping->a_ops)
                return -EINVAL;
        force_page_cache_readahead(mapping, filp, index, nr);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists