[ASAN/AArch64] Fix kernel_old_Xid_t type

Christophe Lyon christophe.lyon at linaro.org
Wed Oct 29 03:02:44 PDT 2014


Hi,

As a follow-up to this thread, some people have complained because the
patch discussed here prevents from building libsanitizer when using
"old" kernel headers.

Indeed, the kernel was modified here:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34c65c4

In practice, I've noticed that the change appeared in linux-3.15.3,
but users have reported using 3.10 and 3.14 stable ones on aarch64
machines.

I want to fix this, and I have a patch ready, but it does not seem to
follow the libsanitizer conventions:
in sanitizer_platform_limits_posix.h, we currently have:
#if defined(__powerpc__) || defined(__aarch64__) || defined(__mips__)
  typedef unsigned int __sanitizer___kernel_old_uid_t;
  typedef unsigned int __sanitizer___kernel_old_gid_t;
#else
  typedef unsigned short __sanitizer___kernel_old_uid_t;
  typedef unsigned short __sanitizer___kernel_old_gid_t;
#endif

Why not simply have an unconditional
#if SANITIZER_LINUX
#include <linux/posix_types.h>
#endif

typedef __kernel_old_uid_t __sanitizer___kernel_old_uid_t;
typedef __kernel_old_gid_t __sanitizer___kernel_old_gid_t;

(I don't know what the corresponding FREEBSD code would be though).

Sorry if the question is obvious, but why are many types/sizes
hardcodes in sanitizer_platform_limits_posix.h rather than inherited?

Thanks,

Christophe.



More information about the llvm-commits mailing list