[compiler-rt] r323834 - [sanitizer] Fix tests on Android and Darwin

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 14:26:28 PST 2018


Ugh, it should be PATH_MAX everywhere. I'll update.

On Wed, Jan 31, 2018 at 4:44 PM, Kuba Mracek <mracek at apple.com> wrote:

> Hi Vitaly,
>
> NAME_MAX is 255 on Darwin and this actually overflows on one of out bot
> machines, where the directory name is longer than that :)
>
> Can you switch back to PATH_MAX?
>
> Kuba
>
> > On Jan 30, 2018, at 3:51 PM, Vitaly Buka via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> >
> > Author: vitalybuka
> > Date: Tue Jan 30 15:51:44 2018
> > New Revision: 323834
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=323834&view=rev
> > Log:
> > [sanitizer] Fix tests on Android and Darwin
> >
> > Modified:
> >    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_in
> terceptors.h
> >    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/name
> _to_handle_at.cc
> >    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/readlinkat.c
> >    compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c
> >
> > Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_in
> terceptors.h
> > URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
> nitizer_common/sanitizer_platform_interceptors.h?rev=323834&
> r1=323833&r2=323834&view=diff
> > ============================================================
> ==================
> > --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
> (original)
> > +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
> Tue Jan 30 15:51:44 2018
> > @@ -442,10 +442,17 @@
> > #define SANITIZER_INTERCEPT_FACCESSAT SI_NETBSD
> > #define SANITIZER_INTERCEPT_GETGROUPLIST SI_NETBSD
> >
> > -#define SANITIZER_INTERCEPT_NAME_TO_HANDLE_AT SI_LINUX
> > -#define SANITIZER_INTERCEPT_OPEN_BY_HANDLE_AT SI_LINUX
> > +#define SANITIZER_INTERCEPT_NAME_TO_HANDLE_AT SI_LINUX_NOT_ANDROID
> > +#define SANITIZER_INTERCEPT_OPEN_BY_HANDLE_AT SI_LINUX_NOT_ANDROID
> >
> > #define SANITIZER_INTERCEPT_READLINK SI_POSIX
> > -#define SANITIZER_INTERCEPT_READLINKAT SI_POSIX
> > +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
> > +    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101000
> > +# define SI_MAC_DEPLOYMENT_BELOW_10_10 1
> > +#else
> > +# define SI_MAC_DEPLOYMENT_BELOW_10_10 0
> > +#endif
> > +#define SANITIZER_INTERCEPT_READLINKAT \
> > +  (SI_POSIX && !SI_MAC_DEPLOYMENT_BELOW_10_10)
> >
> > #endif  // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
> >
> > Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/name
> _to_handle_at.cc
> > URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/s
> anitizer_common/TestCases/Linux/name_to_handle_at.cc?rev=
> 323834&r1=323833&r2=323834&view=diff
> > ============================================================
> ==================
> > --- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/name_to_handle_at.cc
> (original)
> > +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/name_to_handle_at.cc
> Tue Jan 30 15:51:44 2018
> > @@ -1,4 +1,5 @@
> > // RUN: %clangxx -O0 %s -o %t && %run %t
> > +// UNSUPPORTED: android
> >
> > #include <assert.h>
> > #include <fcntl.h>
> >
> > Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/read
> linkat.c
> > URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/s
> anitizer_common/TestCases/Linux/readlinkat.c?rev=323834&r1=
> 323833&r2=323834&view=diff
> > ============================================================
> ==================
> > --- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/readlinkat.c
> (original)
> > +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/readlinkat.c
> Tue Jan 30 15:51:44 2018
> > @@ -2,19 +2,19 @@
> >
> > #include <assert.h>
> > #include <fcntl.h>
> > -#include <linux/limits.h>
> > +#include <limits.h>
> > #include <stdio.h>
> > #include <string.h>
> > #include <unistd.h>
> >
> > int main(int argc, char **argv) {
> > -  char symlink_path[PATH_MAX];
> > +  char symlink_path[NAME_MAX];
> >   snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
> >            getpid());
> >   int res = symlink(argv[0], symlink_path);
> >   assert(!res);
> >
> > -  char readlinkat_path[PATH_MAX];
> > +  char readlinkat_path[NAME_MAX];
> >   int res2 = readlinkat(AT_FDCWD, symlink_path, readlinkat_path,
> >                         sizeof(readlinkat_path));
> >   assert(res2 >= 0);
> >
> > Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/read
> link.c
> > URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/s
> anitizer_common/TestCases/Posix/readlink.c?rev=323834&r1=
> 323833&r2=323834&view=diff
> > ============================================================
> ==================
> > --- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c
> (original)
> > +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c
> Tue Jan 30 15:51:44 2018
> > @@ -2,26 +2,26 @@
> >
> > #include <assert.h>
> > #include <fcntl.h>
> > -#include <linux/limits.h>
> > +#include <limits.h>
> > #include <stdio.h>
> > #include <string.h>
> > #include <sys/types.h>
> > #include <unistd.h>
> >
> > int main(int argc, char **argv) {
> > -  char symlink_path[PATH_MAX];
> > +  char symlink_path[NAME_MAX];
> >   snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
> >            getpid());
> >   int res = symlink(argv[0], symlink_path);
> >   assert(!res);
> >
> > -  char readlink_path[PATH_MAX];
> > +  char readlink_path[NAME_MAX];
> >   ssize_t res2 = readlink(symlink_path, readlink_path,
> sizeof(readlink_path));
> >   assert(res2 >= 0);
> >   readlink_path[res2] = '\0';
> >   assert(!strcmp(readlink_path, argv[0]));
> >
> > -  char readlinkat_path[PATH_MAX];
> > +  char readlinkat_path[NAME_MAX];
> >   res2 = readlinkat(AT_FDCWD, symlink_path, readlinkat_path,
> >                     sizeof(readlink_path));
> >   assert(res2 >= 0);
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180201/92e89b9f/attachment.html>


More information about the llvm-commits mailing list