[compiler-rt] r326651 - OpenBSD UBsan support enabling SANITIZER_OPENBSD widely

David CARLIER via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 3 10:45:15 PST 2018


I ll in the following minutes push a proposed fix if no one did already.

On 3 March 2018 at 17:58, Krzysztof Parzyszek via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> This broke FreeBSD build:
>
> cd /w/bld/org/projects/compiler-rt/lib/sanitizer_common && /usr/bin/CC
> -DHAVE_RPC_XDR_H=0 -DHAVE_TIRPC_RPC_XDR_H=0 -D_DEBUG
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> -I/w/bld/org/projects/compiler-rt/lib/sanitizer_common -I/w/src/
> llvm.org/projects/compiler-rt/lib/sanitizer_common -I/w/bld/org/include
> -I/w/src/llvm.org/include -isystem /usr/local/include -I/w/src/
> llvm.org/projects/compiler-rt/lib/sanitizer_common/.. -stdlib=libc++
> -fPIC -fvisibility-inlines-hidden -Werror=date-time
> -Werror=unguarded-availability-new -std=c++11 -Wall -W
> -Wno-unused-parameter -Wwrite-strings -Wcast-qual
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor
> -Wno-comment -Wstring-conversion -ffunction-sections -fdata-sections -Wall
> -std=c++11 -Wno-unused-parameter -O3    -UNDEBUG   -stdlib=libc++ -fPIC
> -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new
> -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor
> -Wno-comment -Wstring-conversion -ffunction-sections -fdata-sections -Wall
> -std=c++11 -Wno-unused-parameter -m32 -fPIC -fno-builtin -fno-exceptions
> -fomit-frame-pointer -funwind-tables -fno-stack-protector
> -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3
> -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions
> -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=570
> -Wglobal-constructors -o CMakeFiles/RTSanitizerCommonLi
> bc.i386.dir/sanitizer_common_libcdep.cc.o -c /w/src/
> llvm.org/projects/compiler-rt/lib/sanitizer_common/
> sanitizer_common_libcdep.cc
> In file included from /w/src/llvm.org/projects/compi
> ler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc:14:
> /w/src/llvm.org/projects/compiler-rt/lib/sanitizer_common/
> sanitizer_common.h:948:14: error: 'operator new' takes type size_t
> ('unsigned int') as first parameter
> inline void *operator new(__sanitizer::operator_new_size_type size,
>              ^
> 1 error generated.
> *** [projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSani
> tizerCommonLibc.i386.dir/sanitizer_common_libcdep.cc.o] Error code 1
>
>
> -Krzysztof
>
>
>
> On 3/3/2018 6:12 AM, Kamil Rytarowski via llvm-commits wrote:
>
>> Author: kamil
>> Date: Sat Mar  3 04:12:03 2018
>> New Revision: 326651
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=326651&view=rev
>> Log:
>> OpenBSD UBsan support enabling SANITIZER_OPENBSD widely
>>
>> Summary: Adding OpenBSD platform
>>
>> Patch by: David CARLIER
>>
>> Reviewers: krytarowski, vitalybuka
>>
>> Reviewed By: vitalybuka
>>
>> Subscribers: srhines, kubamracek, fedor.sergeev, llvm-commits, #sanitizers
>>
>> Differential Revision: https://reviews.llvm.org/D44049
>>
>>
>> Modified:
>>      compiler-rt/trunk/lib/sanitizer_common/sanitizer_errno.h
>>      compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
>>      compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc
>>      compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
>>      compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.h
>>      compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
>>      compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
>>      compiler-rt/trunk/lib/sanitizer_common/sanitizer_syscall_generic.inc
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_errno.h
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
>> nitizer_common/sanitizer_errno.h?rev=326651&r1=326650&r2=326651&view=diff
>> ============================================================
>> ==================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_errno.h (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_errno.h Sat Mar  3
>> 04:12:03 2018
>> @@ -24,7 +24,7 @@
>>     #if SANITIZER_FREEBSD || SANITIZER_MAC
>>   #  define __errno_location __error
>> -#elif SANITIZER_ANDROID || SANITIZER_NETBSD
>> +#elif SANITIZER_ANDROID || SANITIZER_NETBSD || SANITIZER_OPENBSD
>>   #  define __errno_location __errno
>>   #elif SANITIZER_SOLARIS
>>   #  define __errno_location ___errno
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_
>> defs.h
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
>> nitizer_common/sanitizer_internal_defs.h?rev=326651&r1=32665
>> 0&r2=326651&view=diff
>> ============================================================
>> ==================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Sat
>> Mar  3 04:12:03 2018
>> @@ -39,7 +39,8 @@
>>   #endif
>>     // TLS is handled differently on different platforms
>> -#if SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_FREEBSD
>> +#if SANITIZER_LINUX || SANITIZER_NETBSD || \
>> +  SANITIZER_FREEBSD || SANITIZER_OPENBSD
>>   # define SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE \
>>       __attribute__((tls_model("initial-exec"))) thread_local
>>   #else
>> @@ -100,7 +101,7 @@
>>   // FIXME: do we have anything like this on Mac?
>>   #ifndef SANITIZER_CAN_USE_PREINIT_ARRAY
>>   #if ((SANITIZER_LINUX && !SANITIZER_ANDROID) || \
>> -  SANITIZER_FREEBSD) && !defined(PIC)
>> +  SANITIZER_FREEBSD || SANITIZER_OPENBSD) && !defined(PIC)
>>   # define SANITIZER_CAN_USE_PREINIT_ARRAY 1
>>   // Before Solaris 11.4, .preinit_array is fully supported only with GNU
>> ld.
>>   // FIXME: Check for those conditions.
>> @@ -159,7 +160,8 @@ typedef long pid_t;
>>   typedef int pid_t;
>>   #endif
>>   -#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_MAC || \
>> +#if SANITIZER_FREEBSD || SANITIZER_NETBSD || \
>> +    SANITIZER_OPENBSD || SANITIZER_MAC || \
>>       (SANITIZER_LINUX && defined(__x86_64__))
>>   typedef u64 OFF_T;
>>   #else
>> @@ -170,7 +172,7 @@ typedef u64  OFF64_T;
>>   #if (SANITIZER_WORDSIZE == 64) || SANITIZER_MAC
>>   typedef uptr operator_new_size_type;
>>   #else
>> -# if defined(__s390__) && !defined(__s390x__)
>> +# if defined(SANITIZER_OPENBSD) || defined(__s390__) &&
>> !defined(__s390x__)
>>   // Special case: 31-bit s390 has unsigned long as size_t.
>>   typedef unsigned long operator_new_size_type;
>>   # else
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
>> nitizer_common/sanitizer_libignore.cc?rev=326651&r1=326650&
>> r2=326651&view=diff
>> ============================================================
>> ==================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc Sat
>> Mar  3 04:12:03 2018
>> @@ -9,7 +9,8 @@
>>     #include "sanitizer_platform.h"
>>   -#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC ||
>> SANITIZER_NETBSD
>> +#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC || \
>> +    SANITIZER_NETBSD || SANITIZER_OPENBSD
>>     #include "sanitizer_libignore.h"
>>   #include "sanitizer_flags.h"
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
>> nitizer_common/sanitizer_platform.h?rev=326651&r1=326650&r2=
>> 326651&view=diff
>> ============================================================
>> ==================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h Sat Mar
>> 3 04:12:03 2018
>> @@ -14,8 +14,8 @@
>>   #define SANITIZER_PLATFORM_H
>>     #if !defined(__linux__) && !defined(__FreeBSD__) &&
>> !defined(__NetBSD__) && \
>> -  !defined(__APPLE__) && !defined(_WIN32) && !defined(__Fuchsia__) && \
>> -  !(defined(__sun__) && defined(__svr4__))
>> +  !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(_WIN32) && \
>> +  !defined(__Fuchsia__) && !(defined(__sun__) && defined(__srv4__))
>>   # error "This operating system is not supported"
>>   #endif
>>   @@ -37,6 +37,12 @@
>>   # define SANITIZER_NETBSD 0
>>   #endif
>>   +#if defined(__OpenBSD__)
>> +# define SANITIZER_OPENBSD 1
>> +#else
>> +# define SANITIZER_OPENBSD 0
>> +#endif
>> +
>>   #if defined(__sun__) && defined(__svr4__)
>>   # define SANITIZER_SOLARIS 1
>>   #else
>> @@ -100,7 +106,7 @@
>>     #define SANITIZER_POSIX \
>>     (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC || \
>> -    SANITIZER_NETBSD || SANITIZER_SOLARIS)
>> +    SANITIZER_NETBSD || SANITIZER_OPENBSD || SANITIZER_SOLARIS)
>>     #if __LP64__ || defined(_WIN64)
>>   #  define SANITIZER_WORDSIZE 64
>> @@ -296,7 +302,8 @@
>>   # define SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT 0
>>   #endif
>>   -#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD ||
>> SANITIZER_SOLARIS
>> +#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD || \
>> +  SANITIZER_OPENBSD || SANITIZER_SOLARIS
>>   # define SANITIZER_MADVISE_DONTNEED MADV_FREE
>>   #else
>>   # define SANITIZER_MADVISE_DONTNEED MADV_DONTNEED
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.h
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
>> nitizer_common/sanitizer_posix.h?rev=326651&r1=326650&r2=326651&view=diff
>> ============================================================
>> ==================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.h (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.h Sat Mar  3
>> 04:12:03 2018
>> @@ -17,6 +17,7 @@
>>   // This header should NOT include any other headers from sanitizer
>> runtime.
>>   #include "sanitizer_internal_defs.h"
>>   #include "sanitizer_platform_limits_netbsd.h"
>> +#include "sanitizer_platform_limits_openbsd.h"
>>   #include "sanitizer_platform_limits_posix.h"
>>   #include "sanitizer_platform_limits_solaris.h"
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_
>> libcdep.cc
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
>> nitizer_common/sanitizer_posix_libcdep.cc?rev=326651&r1=
>> 326650&r2=326651&view=diff
>> ============================================================
>> ==================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
>> Sat Mar  3 04:12:03 2018
>> @@ -19,6 +19,7 @@
>>   #include "sanitizer_common.h"
>>   #include "sanitizer_flags.h"
>>   #include "sanitizer_platform_limits_netbsd.h"
>> +#include "sanitizer_platform_limits_openbsd.h"
>>   #include "sanitizer_platform_limits_posix.h"
>>   #include "sanitizer_platform_limits_solaris.h"
>>   #include "sanitizer_posix.h"
>> @@ -42,7 +43,7 @@
>>   #if SANITIZER_FREEBSD
>>   // The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even
>> before
>>   // that, it was never implemented.  So just define it to zero.
>> -#undef  MAP_NORESERVE
>> +#undef MAP_NORESERVE
>>   #define MAP_NORESERVE 0
>>   #endif
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
>> nitizer_common/sanitizer_stacktrace.h?rev=326651&r1=326650&
>> r2=326651&view=diff
>> ============================================================
>> ==================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h Sat
>> Mar  3 04:12:03 2018
>> @@ -23,6 +23,8 @@ static const u32 kStackTraceMax = 256;
>>   # define SANITIZER_CAN_FAST_UNWIND 0
>>   #elif SANITIZER_WINDOWS
>>   # define SANITIZER_CAN_FAST_UNWIND 0
>> +#elif SANITIZER_OPENBSD
>> +# define SANITIZER_CAN_FAST_UNWIND 0
>>   #else
>>   # define SANITIZER_CAN_FAST_UNWIND 1
>>   #endif
>> @@ -30,7 +32,7 @@ static const u32 kStackTraceMax = 256;
>>   // Fast unwind is the only option on Mac for now; we will need to
>>   // revisit this macro when slow unwind works on Mac, see
>>   // https://github.com/google/sanitizers/issues/137
>> -#if SANITIZER_MAC
>> +#if SANITIZER_MAC || SANITIZER_OPENBSD
>>   # define SANITIZER_CAN_SLOW_UNWIND 0
>>   #else
>>   # define SANITIZER_CAN_SLOW_UNWIND 1
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_syscall_
>> generic.inc
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
>> nitizer_common/sanitizer_syscall_generic.inc?rev=326651&r1=
>> 326650&r2=326651&view=diff
>> ============================================================
>> ==================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_syscall_generic.inc
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_syscall_generic.inc
>> Sat Mar  3 04:12:03 2018
>> @@ -11,7 +11,8 @@
>>   //
>>   //===-------------------------------------------------------
>> ---------------===//
>>   -#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD ||
>> SANITIZER_SOLARIS
>> +#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD || \
>> +  SANITIZER_OPENBSD || SANITIZER_SOLARIS
>>   # define SYSCALL(name) SYS_ ## name
>>   #else
>>   # define SYSCALL(name) __NR_ ## name
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>>
>> ---
>> This email has been checked for viruses by AVG.
>> http://www.avg.com
>>
>>
> _______________________________________________
> 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/20180303/59d070de/attachment.html>


More information about the llvm-commits mailing list