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]
Message-ID: <20080223083044.GA24136@1wt.eu>
Date:	Sat, 23 Feb 2008 09:30:44 +0100
From:	Willy Tarreau <w@....eu>
To:	Unknown <borg@....net>
Cc:	linux-kernel@...r.kernel.org, dann frazier <dannf@...ian.org>
Subject: Re: PROBLEM: 2.4.36.1 hangs.

Hello,

first, thanks for your detailed report.

On Fri, Feb 22, 2008 at 03:08:30PM +0100, Unknown wrote:
> 1) 2.4.36.1 hangs (probably during ext2_readdir())
> 
> 2) 2.4.36.1 hangs during compilation of lighttpd-1.4.18.
>    It is probably during ext2_readdir() but I cannot confirm that..
>    Currently it only happens during compilation of lighttpd-1.4.18, always
>    in the same place.
>    Kernel 2.4.36 w/ same options (make oldconfig) works fine.
> 
> Last few lines of 'strace -f make' just before hang:
> [pid 12817] open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
> [pid 12817] fstat64(3, {st_mode=S_IFDIR|0777, st_size=8192, ...}) = 0
> [pid 12817] fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
> [pid 12817] getdents64(3, /* 114 entries */, 4096) = 4088
> [pid 12817] getdents64(3, /* 63 entries */, 4096) = 2424
> [pid 12817] getdents64(3,

OK, could you please try to revert the attached patch (patch -Rp1) to see if
this fixes the problem for you ? Please keep Dann and me in CC as it's not
easy to spot 2.4-related threads on LKML these days!

Thanks,
Willy

----

commit c30306fb287323591c854a0982d9fa5351859b45
Author: dann frazier <dannf@...ian.org>
Date:   Mon Jan 21 17:13:06 2008 -0700

    ext2_readdir() filp->f_pos fix
    
    This is a 2.4 backport of a linux-2.6 change by Jan Blunck
    (old-2.6-bkcvs commit 2196b4744393d4f6c06fc4d63b98556d05b90933)
    
    Commit log from 2.6 follows.
    
      [PATCH] ext2_readdir() filp->f_pos fix
    
      If the whole directory is read, ext2_readdir() sets the f_pos to a multiple
      of the page size (because of the conditions of the outer for loop).  This
      sets the wrong f_pos for directory inodes on ext2 partitions with a block
      size differing from the page size.
    
    Signed-off-by: dann frazier <dannf@...com>

diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 58b76dd..b158e60 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -240,7 +240,7 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
 	loff_t pos = filp->f_pos;
 	struct inode *inode = filp->f_dentry->d_inode;
 	struct super_block *sb = inode->i_sb;
-	unsigned offset = pos & ~PAGE_CACHE_MASK;
+	unsigned int offset = pos & ~PAGE_CACHE_MASK;
 	unsigned long n = pos >> PAGE_CACHE_SHIFT;
 	unsigned long npages = dir_pages(inode);
 	unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
@@ -258,8 +258,13 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
 		ext2_dirent *de;
 		struct page *page = ext2_get_page(inode, n);
 
-		if (IS_ERR(page))
+		if (IS_ERR(page)) {
+			ext2_error(sb, __FUNCTION__,
+				   "bad page in #%lu",
+				   inode->i_ino);
+			filp->f_pos += PAGE_CACHE_SIZE - offset;
 			continue;
+		}
 		kaddr = page_address(page);
 		if (need_revalidate) {
 			offset = ext2_validate_entry(kaddr, offset, chunk_mask);
@@ -283,12 +288,12 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
 					ext2_put_page(page);
 					goto done;
 				}
+			filp->f_pos += le16_to_cpu(de->rec_len);
 			}
 		ext2_put_page(page);
 	}
 
 done:
-	filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
 	filp->f_version = inode->i_version;
 	UPDATE_ATIME(inode);
 	return 0;
--
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