aarch64 strace decoding of 32-bit arm statfs64...
enh
enh at google.com
Wed Mar 18 05:29:23 UTC 2015
hmm. i wonder if this changed at some point? the arm64 kernel has this:
compat_sys_statfs64_wrapper:
mov w3, #84
cmp w1, #88
csel w1, w3, w1, eq
b compat_sys_statfs64
ENDPROC(compat_sys_statfs64_wrapper)
compat_sys_fstatfs64_wrapper:
mov w3, #84
cmp w1, #88
csel w1, w3, w1, eq
b compat_sys_fstatfs64
ENDPROC(compat_sys_fstatfs64_wrapper)
and the arm kernel has the equivalent:
sys_statfs64_wrapper:
teq r1, #88
moveq r1, #84
b sys_statfs64
ENDPROC(sys_statfs64_wrapper)
sys_fstatfs64_wrapper:
teq r1, #88
moveq r1, #84
b sys_fstatfs64
ENDPROC(sys_fstatfs64_wrapper)
oh, there's a comment in arch/arm/kernel/sys_oabi-compat.c:
* sys_statfs64:
* sys_fstatfs64:
*
* struct statfs64 has extra padding with EABI growing its size from
* 84 to 88. This struct is now __attribute__((packed,aligned(4)))
* with a small assembly wrapper to force the sz argument to 84 if it is 88
* to avoid copying the extra padding over user space unexpecting it.
bionic doesn't have the packed attribute and our sizeof is 88.
adding this in both sys_statfs64 and sys_fstatfs64 fixed things for me
but maybe you have a better idea?
+#if defined ARM || defined AARCH64 /* eabi structs have padding */
+ else if (tcp->u_arg[1] == sizeof(struct compat_statfs64) + 4)
+ printcompat_statfs64(tcp, tcp->u_arg[2]);
+#endif
On Tue, Mar 17, 2015 at 3:32 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> On Tue, Mar 17, 2015 at 03:20:56PM -0700, enh wrote:
>> i think we've regressed with aarch64 strace decoding arm statfs again.
>> i don't think AARCH64 should have been included in this patch.
>
> I have no aarch64 nearby to check this, but, according to kernel headers,
>
> $ git grep -Fw ARCH_PACK_COMPAT_STATFS64 arch/
> arch/arm64/include/uapi/asm/statfs.h:#define ARCH_PACK_COMPAT_STATFS64 __attribute__((packed,aligned(4)))
> arch/ia64/include/uapi/asm/statfs.h:#define ARCH_PACK_COMPAT_STATFS64 __attribute__((packed,aligned(4)))
> arch/x86/include/uapi/asm/statfs.h:#define ARCH_PACK_COMPAT_STATFS64 __attribute__((packed,aligned(4)))
>
>> commit d50949d21c2b07daadc26c7302163dc6066d4a75
>> Author: Dmitry V. Levin <ldv at altlinux.org>
>> Date: Mon Mar 2 21:34:02 2015 +0000
>>
>> aarch64, x32: fix decoding of compat personality statfs64/fstatfs64
>>
>> * statfs.c (struct compat_statfs64) [AARCH64 || X32]: Apply the same
>> attributes as on X86_64.
>>
>> diff --git a/statfs.c b/statfs.c
>> index 6101209..6f5e4d3 100644
>> --- a/statfs.c
>> +++ b/statfs.c
>> @@ -121,7 +121,7 @@ struct compat_statfs64 {
>> uint32_t f_flags;
>> uint32_t f_spare[4];
>> }
>> -#if defined(X86_64) || defined(IA64)
>> +#if defined AARCH64 || defined X86_64 || defined X32 || defined IA64
>> __attribute__ ((packed, aligned(4)))
>> #endif
>> ;
>
>
> --
> ldv
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Strace-devel mailing list
> Strace-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/strace-devel
>
--
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
More information about the Strace-devel
mailing list