https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64435

            Bug ID: 64435
           Summary: [5.0.0 Regression] Bootstrap failure in libsanitizer
                    on AArch64 with Linux kernel <= 3.15
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.abdurachmanov at gmail dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

I finally started testing GCC trunk (5.0.0) on AArch64 before release is made.

I quickly find out that I couldn't bootstrap GCC on APM Mustang board with APM
Linux images (F19 + 3.12 kernel), but it worked fine with QEMU + F21 + 3.17
kernel). Failure details are below.

The culprit is 34c65c43f1518bf85f93526ad373adc6a683b4c5 from Linux repository.
Commit details are provided below.

Simply put __sanitizer___kernel_{uid,gid}_t depends on kernel version. <=3.15
it's unsigned int and >=3.16 it's unsigned short.

##### GCC trunk failure #####

In file included from
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:176:0:
../../../../libsanitizer/sanitizer_common/sanitizer_internal_defs.h:272:72:
error: size of array 'assertion_failed__1006' is negative
     typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                                        ^
../../../../libsanitizer/sanitizer_common/sanitizer_internal_defs.h:266:30:
note: in expansion of macro 'IMPL_COMPILER_ASSERT'
 #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
                              ^
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1285:3:
note: in expansion of macro 'COMPILER_CHECK'
   COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
   ^
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:1006:1:
note: in expansion of macro 'CHECK_TYPE_SIZE'
 CHECK_TYPE_SIZE(__kernel_old_uid_t);
 ^
../../../../libsanitizer/sanitizer_common/sanitizer_internal_defs.h:272:72:
error: size of array 'assertion_failed__1007' is negative
     typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                                        ^
../../../../libsanitizer/sanitizer_common/sanitizer_internal_defs.h:266:30:
note: in expansion of macro 'IMPL_COMPILER_ASSERT'
 #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
                              ^
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1285:3:
note: in expansion of macro 'COMPILER_CHECK'
   COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
   ^
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:1007:1:
note: in expansion of macro 'CHECK_TYPE_SIZE'
 CHECK_TYPE_SIZE(__kernel_old_gid_t);
 ^
make[4]: *** [sanitizer_platform_limits_posix.lo] Error 1
make[4]: *** Waiting for unfinished jobs....

##### Linux Commit #####

commit 34c65c43f1518bf85f93526ad373adc6a683b4c5
Author: Will Deacon <will.dea...@arm.com>
Date:   Mon Jun 2 11:47:29 2014 +0100

    arm64: uid16: fix __kernel_old_{gid,uid}_t definitions

    Whilst native arm64 applications don't have the 16-bit UID/GID syscalls
    wired up, compat tasks can still access them. The 16-bit wrappers for
    these syscalls use __kernel_old_uid_t and __kernel_old_gid_t, which must
    be 16-bit data types to maintain compatibility with the 16-bit UIDs used
    by compat applications.

    This patch defines 16-bit __kernel_old_{gid,uid}_t types for arm64
    instead of using the 32-bit types provided by asm-generic.

    Signed-off-by: Will Deacon <will.dea...@arm.com>
    Acked-by: Arnd Bergmann <a...@arndb.de>
    Cc: <sta...@vger.kernel.org>
    Signed-off-by: Catalin Marinas <catalin.mari...@arm.com>

diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 42c7eec..0b3fcf8 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -30,7 +30,6 @@ generic-y += msgbuf.h
 generic-y += mutex.h
 generic-y += pci.h
 generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
 generic-y += resource.h
 generic-y += rwsem.h
diff --git a/arch/arm64/include/uapi/asm/posix_types.h
b/arch/arm64/include/uapi/asm/posix_types.h
new file mode 100644
index 0000000..7985ff6
--- /dev/null
+++ b/arch/arm64/include/uapi/asm/posix_types.h
@@ -0,0 +1,10 @@
+#ifndef __ASM_POSIX_TYPES_H
+#define __ASM_POSIX_TYPES_H
+
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+#define __kernel_old_uid_t __kernel_old_uid_t
+
+#include <asm-generic/posix_types.h>
+
+#endif /*  __ASM_POSIX_TYPES_H */

Reply via email to