This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: d_off field in struct dirent and 32-on-64 emulation



On 04/01/2019 07:22, Florian Weimer wrote:
> * Mao Han:
> 
>> I'm still not clear what's the problem of using getdent64 on csky, seems
>> getdent64 may fail when LFS is used. I haven't seen any our customer use
>> LFS before, so no one will be affected by this issue at present?
> 
> Could you post “strace -v” output from something calling getdents64 on
> an ext4 file system, please?
> 
> It may be that the problem does not exist because ext4 always uses
> 31-bit hashes for d_off on csky.
> 
> Thanks,
> Florian
> 

My understanding is ext4 on csky will set 32bit API since it does not
need to support compat mode:

fs/ext4/dir.c:

293 static inline int is_32bit_api(void)
294 {
295 #ifdef CONFIG_COMPAT
296         return in_compat_syscall();
297 #else
298         return (BITS_PER_LONG == 32);
299 #endif
300 }
301 
302 /*
303  * These functions convert from the major/minor hash to an f_pos
304  * value for dx directories
305  *
306  * Upper layer (for example NFS) should specify FMODE_32BITHASH or
307  * FMODE_64BITHASH explicitly. On the other hand, we allow ext4 to be mounted
308  * directly on both 32-bit and 64-bit nodes, under such case, neither
309  * FMODE_32BITHASH nor FMODE_64BITHASH is specified.
310  */
311 static inline loff_t hash2pos(struct file *filp, __u32 major, __u32 minor)
312 {
313         if ((filp->f_mode & FMODE_32BITHASH) ||
314             (!(filp->f_mode & FMODE_64BITHASH) && is_32bit_api()))
315                 return major >> 1;
316         else
317                 return ((__u64)(major >> 1) << 32) | (__u64)minor;
318 }

> I'm still not clear what's the problem of using getdent64 on csky, seems
> getdent64 may fail when LFS is used. I haven't seen any our customer use
> LFS before, so no one will be affected by this issue at present? 
> AFAICS these posix interfaces on c-sky alway get problem when large d_off
> is given, by extending d_off field inside struct dirent, the return value
> and filepos field inside DIR are always 32-bit for C-SKY, readdir stills
> fail due to the truncation overflow check form d_off to filepos.
> Although I got the C-SKY port without 64-bit support into 2.29 for some company
> concern, is it still posible to add 64-bit off_t and 64-bit time_t support
> either break the compatibility(we can ensure our customer will not use
> incompat binarys) or use some configurations? Seems lots of potential problems
> can be solved with the 64 bit support.

My point is why still use non-LFS interfaces as default for new 32 bits ports
when kernel has moved on a long time ago. From glibc standpoint tt requires 
support two entrypoints with different semantic for the same  function which
in the end will use the same syscall (besides the inherent issue with non-LFS 
support).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]