[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [parisc-linux] -pie is broken on hppa

> This is what I see when I do a gcc_update:
> dave@mx3210:~/gnu/gcc-4.3/gcc$ contrib/gcc_update
> Updating SVN tree
> At revision 125275.
> svn: Can't read directory '.': Partial results are valid but processing is incomplete

I spent the day trying to debug why libjava fails to build on this system
with the new glibc.  It seems that scandir is broken on 64-bit kernels.
There seems to be an off by one error in copying dirent structs.  Either
the define in <dirent.h> for _D_ALLOC_NAMLEN is wrong or the kernel
sometimes returns a value for d_reclen that is sometimes too small.  The
code in fs/readdir.c suggests that sys_parisc32.c needs fixing.

The enclosed seems to fix both the libjava build and the svn problem.
Kyle's branch uses ALIGN instead of ROUND_UP.

J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index 29be437..44400e0 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -318,7 +318,7 @@ static int filldir32 (void *__buf, const char *name, int namlen,
 	struct linux32_dirent __user * dirent;
 	struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
-	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
+	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2, 4);
 	u32 d_ino;
 	buf->error = -EINVAL;	/* only used if we fail.. */

Reply to: