The o32 fstatat syscall behaves differently on 32 and 64 bit kernels
PATCH 1/1 The o32 fstatat syscall behaves differently on 32 and 64 bit kernels
While working on a glibc patch to support the fstatat() functions[1], I noticed that the o32 implementation behaves differently on 32-bit and 64-bit kernels; the former provides a stat64 while the latter provides a plain (o32) stat. I think the former is what's intended, as there is no separate fstatat64. It's also what x86 does.
I think this is just a case of a compat too far. The o32 stat64 is the same as plain stat on n64, so 64-bit kernels can just use newfstatat. (n32 already does this, and works correctly as-is.)
Tested with the glibc patch, where it fixes the test I'd written. Please install if OK.
Richard
[1] I've seen Khem's patch, but I don't think it's right.
arch/mips/kernel/scall64-o32.S +1 -1
@@ -498,7 +498,7 @@ sys_call_table: PTR sys_mknodat /* 4290 */ PTR sys_fchownat PTR compat_sys_futimesat - PTR compat_sys_newfstatat + PTR sys_newfstatat PTR sys_unlinkat PTR sys_renameat /* 4295 */ PTR sys_linkat
Quoted 3 lines · Richard Sandiford
I think this is just a case of a compat too far. The o32 stat64 is the same as plain stat on n64, so 64-bit kernels can just use newfstatat. (n32 already does this, and works correctly as-is.)
Huh. The last sentence sounded like a really useful addition when I wrote it, but even so soon after the fact, I've no idea why. It sounds like I was implying that stat calls require conversion on n32, but that certainly wasn't my intention. Please ignore. ;)
Richard