[Question]fstat overflow error in opendir

김민형 minhyoung.kim at lge.com
Tue Jan 11 06:58:05 UTC 2011


Hi,

 

I need your help to solve a problem I met, that is, fstat overflow error
when calling opendir with LFS(Large File Support).

 

My environment :

Uclibc version 0.9.29

Linux kernel version 2.6.31

processor : BMIPS4380

NAS(Network Attached Storage) is mounted with CIFS VFS. (No mount options
are used except for user name and password.)

Large File Support is enabled for application, kernel, and uclibc.

 

Test Case :

When I tried to open a directory by calling opendir, EOVERFLOW error
happened.

 

My analysis : 

NAS returns 64 bits unique ID for TRANS2_QUERY_PATH_INFORMATION SMB request
with information level, SMB_QUERY_FILE_INTERNAL_INFO.

This unique ID is used for inode number and has a value larger than
0xFFFF_FFFF in my test environment.

So, EOVERFLOW error happened in cp_new_stat function.

 

Question :

1.     Why opendir calls stat/fstat instead of stat64/fstat64 even though
LFS is enabled?

I just guess this is because it is enough 32 bits stat information for
directory. Right?

           Or did I miss some compile options?

2.     If opendir always calls stat/fstat instead of stat64/fstat64 even
though LFS is enabled, how can I avoid this EOVERFLOW error?

I temporally modified ino check statement in cp_new_stat function like the
below. What do you think about this modification?

Original :

 static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)

{

   ……

 if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino)

          return -EOVERFLOW;

   ……

What I modified :

static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)

{

   ……

  if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino &&
!S_ISDIR(stat->mode))

          return -EOVERFLOW;

    ……

 

Thanks for your reading and attention!

 

Kim Minhyoung



More information about the uClibc mailing list