[PATCH] Fix stat decoding for LP64 bionic.

enh enh at google.com
Wed Mar 12 21:00:13 UTC 2014


On Wed, Mar 12, 2014 at 1:52 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> On Wed, Mar 12, 2014 at 01:44:06PM -0700, enh wrote:
>> On Wed, Mar 12, 2014 at 1:36 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
>> > On Wed, Mar 12, 2014 at 10:41:42AM -0700, enh wrote:
>> > [...]
>> >> In patch fb642bb6d63f7ffe2228bf48a6008bc8f56f67ff I fixed aarch64 but broke
>> >> x86_64.
>> >
>> > No code added under #ifdef AARCH64 can ever break x86_64.
>>
>> true. the full story is that we need HAVE_STAT64 for a multi-arch
>> strace so it can decode stat syscalls correctly. so really it was me
>> turning on HAVE_STAT64 (in our Android makefile) after applying this
>> aarch64-only fix that broke x86_64. strictly speaking, this was the
>> change that broke the build:
>> https://android-review.googlesource.com/#/c/83896/
>
> Could you then update the wording of your commit message, please?

done.

>> >> The workaround needed to be applied to all LP64 architectures, not
>> >> just aarch64. This patch fixes that and adds an explanatory comment.
>> >>
>> >> Change-Id: I73d495c7c52a72c5d34a803e106244e187c23e32
>> >
>> > What is Change-Id?
>>
>> it's an Android git/gerrit thing. i wanted to use "git format-patch"
>> to send you the patch rather than just "git diff" which means i have
>> to commit, and committing automatically assigns a Change-Id. since
>> i'll just abandon my change and then cherrypick and submit whatever
>> you submit upstream, this is meaningless. the cherrypick will get a
>> new Change-Id.
>
> In other words, it has no meaning in strace.git and I can safely drop it.

correct. i've manually edited the second version to remove it.

>From a4d723cae8507f39228f9ca19b06790b819fd012 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <enh at google.com>
Date: Wed, 12 Mar 2014 10:31:04 -0700
Subject: [PATCH] Fix stat decoding for LP64 bionic.

Patch fb642bb6d63f7ffe2228bf48a6008bc8f56f67ff fixed building with HAVE_STAT64
for aarch64 with uapi kernel headers but not x86_64. The workaround needed to
be applied to all LP64 architectures, not just aarch64. This patch fixes that
and adds an explanatory comment.

Signed-off-by: Elliott Hughes <enh at google.com>
---
 file.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/file.c b/file.c
index 7e0773d..03fbfaa 100644
--- a/file.c
+++ b/file.c
@@ -181,9 +181,13 @@ struct __old_kernel_stat {
 #undef st_mtime
 #undef st_ctime

-#ifdef AARCH64
+#if defined(__BIONIC__) && defined(__LP64__)
+/* Bionic's "libc" struct stat and struct stat64 are identical.
+ * LP64 bionic doesn't have a "kernel" stat64, so for LP64 we need to use the
+ * kernel stat.
+ */
 #define stat64 stat
-#endif /* AARCH64 */
+#endif /* defined(__BIONIC__) && defined(__LP64__) */

 #include <fcntl.h>
 #ifdef HAVE_SYS_VFS_H
-- 
1.9.0.279.gdc9e3eb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-stat-decoding-for-LP64-bionic.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140312/42c4063a/attachment.bin>


More information about the Strace-devel mailing list