[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bug-205957-13602-ilzvZjRWFg@https.bugzilla.kernel.org/>
Date: Sat, 28 Dec 2019 11:20:10 +0000
From: bugzilla-daemon@...zilla.kernel.org
To: linux-ext4@...r.kernel.org
Subject: [Bug 205957] Ext4 64 bit hash breaks 32 bit glibc 2.28+
https://bugzilla.kernel.org/show_bug.cgi?id=205957
--- Comment #12 from Andreas Dilger (adilger.kernelbugzilla@...ger.ca) ---
Created attachment 286491
--> https://bugzilla.kernel.org/attachment.cgi?id=286491&action=edit
add ioctl(EXT4_IOC_SET_DIRLIMIT) to limit directory cookie size
Totally untested prototype patch to add ioctl(fd, EXT4_IOC_SET_DIRLIMIT, 32)
that could be used by glibc/QEMU to force ext4 to return a 32-bit directory
offset cookie for the 64-bit getdirent64() syscall on a per-fd basis.
The glibc patch would look something like the following, though this could
potentially be done only once per open:
+ // It is affected by "__USE_FILE_OFFSET64" and "__USE_LARGEFILE64".
+ if (sizeof (outp->u.d_off) != sizeof (inp->k.d_off))
+ (void *) ioctl (fd, EXT4_IOC_SET_DIRLIMIT, 32); // ignore error return
+
retval = INLINE_SYSCALL_CALL (getdents64, fd, kbuf, kbytes);
If glibc/QEMU want ext4 to be totally transparent w.r.t. the behavior of the
syscalls, then glibc/QEMU would need set the kernel task state so that
is_32bit_api()->in_compat_syscall() return true and hash2pos() and related
functions can determine this directly to return a 32-bit pos in a manner
similar to x86. That is outside my area of expertise, so I can't really
suggest how it might be done. It would also be possible to add some different
logic to is_32bit_api() for ARM/etc. so that it is more transparent to
userspace, but I don't know what it should check.
--
You are receiving this mail because:
You are watching the assignee of the bug.
Powered by blists - more mailing lists