summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
Commit message (Collapse)AuthorAgeFilesLines
* [compiler-rt] [netbsd] Add support for versioned statvfs interceptorsKamil Rytarowski2019-12-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add support for NetBSD 9.0 and newer versions of interceptors operating on struct statvfs: fstatvfs, fstatvfs1, getmntinfo, getvfsstat, statvfs, statvfs1. The default promoted interceptors are for NetBSD 9.99.26. Older ones (currently 9.0) are kept in a new NetBSD specific file: /sanitizer_common_interceptors_netbsd_compat.inc. This file defines compat interceptors and mangles `INIT_*` macros, concatenating the current interceptors and the compat ones. This redefinition is not elegant, but it avoids preprocessor madness. Define struct_statvfs90_sz for the compat purposes. Reviewers: mgorny, kcc, vitalybuka, joerg Reviewed By: mgorny Subscribers: dberris, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71700
* Temporarily Revert "[compiler-rt] [netbsd] Add support for versioned statvfs ↵Eric Christopher2019-12-261-3/+0
| | | | | | | | | | | interceptors" as it's failing the netbsd specific linter parts of the sanitizer linter: llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_netbsd_compat.inc:23: Lines should be <= 80 characters long [whitespace/line_length] llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:2450: Do not use variable-length arrays. Use an appropriately named ('k' followed by CamelCase) compile-time constant for the size. This reverts commit 78f714f824fac8aa3fdd85908c41538bccefb959.
* [compiler-rt] [netbsd] Add support for versioned statvfs interceptorsKamil Rytarowski2019-12-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add support for NetBSD 9.0 and newer versions of interceptors operating on struct statvfs: fstatvfs, fstatvfs1, getmntinfo, getvfsstat, statvfs, statvfs1. The default promoted interceptors are for NetBSD 9.99.26. Older ones (currently 9.0) are kept in a new NetBSD specific file: /sanitizer_common_interceptors_netbsd_compat.inc. This file defines compat interceptors and mangles `INIT_*` macros, concatenating the current interceptors and the compat ones. This redefinition is not elegant, but it avoids preprocessor madness. Define struct_statvfs90_sz for the compat purposes. Reviewers: mgorny, kcc, vitalybuka, joerg Reviewed By: mgorny Subscribers: dberris, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71700
* [compiler-rt] Adapt for ptrace(2) changes in NetBSD-9.99.30Kamil Rytarowski2019-12-241-0/+11
| | | | | Enable compat support for now legacy PT_LWPINFO. Support PT_LWPSTATUS and PT_LWPNEXT.
* [compiler-rt] Sync NetBSD ioctl definitions with 9.99.26Kamil Rytarowski2019-12-181-0/+3
| | | | Document the minimal version supported to 9.0.
* [compiler-rt] Harmonize __sanitizer_addrinfo with the NetBSD headersKamil Rytarowski2019-11-031-0/+6
| | | | Add missing pad for sparc, alpha and a variation of i386.
* Sync ioctl(2) list with NetBSD 9.99.3Kamil Rytarowski2019-08-081-1/+46
| | | | | | | | Register 36 new ioctl(2) calls. Enable NVMM for amd64 as the API has been stabilized. llvm-svn: 368247
* Update the ioctl(2) list in sanitizers with NetBSD 8.99.34Kamil Rytarowski2019-02-051-4/+0
| | | | llvm-svn: 353224
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [Sanitizer] Intercept sl_add api on FreeBSD/NetBSDDavid Carlier2019-01-151-0/+1
| | | | | | | | | | Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D56670 llvm-svn: 351189
* [sanitizer_common] Define __sanitizer_FILE on NetBSDMichal Gorny2019-01-101-2/+30
| | | | | | Differential Revision: https://reviews.llvm.org/D56109 llvm-svn: 350882
* Update NetBSD ioctl(2) entries with 8.99.28Kamil Rytarowski2018-12-271-0/+17
| | | | | | | | | Add SIOCSETHERCAP. Add commented out NVMM (NetBSD Virtual Machine Monitor) operations as this interface is still WIP and a subject to change. llvm-svn: 350107
* [Sanitizer] Add fstab api to FreeBSD/LinuxDavid Carlier2018-12-271-0/+2
| | | | | | | | | | | | Interception of /etc/fstab function parsers. Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D56099 llvm-svn: 350099
* Add a new interceptors for cdbr(3) and cdbw(3) API from NetBSDKamil Rytarowski2018-12-131-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: cdb - formats of the constant database. cdbr, cdbr_open, cdbr_open_mem, cdbr_entries, cdbr_get, cdbr_find, cdbr_close - constant database access methods. cdbw_open, cdbw_put, cdbw_put_data, cdbw_put_key, cdbw_stable_seeder, cdbw_output, cdbw_close - creates constant databases. Add a dedicated test for this API. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55167 llvm-svn: 349021
* Add new interceptors for vis(3) API in NetBSDKamil Rytarowski2018-12-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add interceptors for the NetBSD style of vis(3) present inside libc: - vis - nvis - strvis - stravis - strnvis - strvisx - strnvisx - strenvisx - svis - snvis - strsvis - strsnvis - strsvisx - strsnvisx - strsenvisx - unvis - strunvis - strnunvis - strunvisx - strnunvisx Add a dedicated test verifying the installed interceptors. Based on original work by Yang Zheng. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54594 llvm-svn: 349018
* Add data types needed for md2(3)/NetBSD interceptorsKamil Rytarowski2018-12-101-0/+3
| | | | | | Missing part of D55469. llvm-svn: 348747
* Add interceptors for the sha2(3) from NetBSDKamil Rytarowski2018-12-101-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: SHA224_Init, SHA224_Update, SHA224_Final, SHA224_End, SHA224_File, SHA224_FileChunk, SHA224_Data, SHA256_Init, SHA256_Update, SHA256_Final, SHA256_End, SHA256_File, SHA256_FileChunk, SHA256_Data, SHA384_Init, SHA384_Update, SHA384_Final, SHA384_End, SHA384_File, SHA384_FileChunk, SHA384_Data, SHA512_Init, SHA512_Update, SHA512_Final, SHA512_End, SHA512_File, SHA512_FileChunk, SHA512_Data – calculates the NIST Secure Hash Standard (version 2) Add tests for new interceptors. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54987 llvm-svn: 348745
* Add new interceptors for FILE repositioning streamKamil Rytarowski2018-12-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: Add new interceptors for a set of functions to reposition a stream: fgetpos, fseek, fseeko, fsetpos, ftell, ftello, rewind . Add a dedicated test. Enable this interface on NetBSD. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55471 llvm-svn: 348743
* Revert a chunk of previous change in sanitizer_platform_limits_netbsd.hKamil Rytarowski2018-12-081-2/+0
| | | | | | | Undefining INLINE breaks the build. The invalid change in this file has been overlooked in D55386. llvm-svn: 348680
* Add interceptors for md5(3) from NetBSDKamil Rytarowski2018-12-081-0/+3
| | | | | | | | | | | | | | | | | | | | Summary: MD5Init, MD5Update, MD5Final, MD5End, MD5File, MD5Data - calculates the RSA Data Security, Inc., "MD5" message digest. Add a dedicated test. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54993 llvm-svn: 348679
* Add interceptors for the rmd160(3) from NetBSDKamil Rytarowski2018-12-081-0/+3
| | | | | | | | | | | | | | | | | | | | Summary: RMD160Init, RMD160Update, RMD160Final, RMD160Transform, RMD160End, RMD160File, RMD160Data - calculates the ``RIPEMD-160'' message digest. Add a dedicated test for this API. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54991 llvm-svn: 348678
* Add interceptors for the md4(3) from NetBSDKamil Rytarowski2018-12-081-0/+3
| | | | | | | | | | | | | | | | | | | | Summary: MD4Init, MD4Update, MD4Final, MD4End, MD4File, MD4Data - calculates the RSA Data Security, Inc., "MD4" message digest. Add dedicated test. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54990 llvm-svn: 348677
* Add interceptors for the sha1(3) from NetBSDKamil Rytarowski2018-12-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add interceptors for: - SHA1Init - SHA1Update - SHA1Final - SHA1Transform - SHA1End - SHA1File - SHA1FileChunk - SHA1Data Add a dedicated regression test for this API. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: mgorny, llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54927 llvm-svn: 348676
* [Sanitizer] Separate FreeBSD interception data structuresDavid Carlier2018-12-071-0/+2
| | | | | | | | | | Reviewers: vitalybuka, krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D55386 llvm-svn: 348634
* Add a new interceptor for modctl(2) from NetBSDKamil Rytarowski2018-12-051-0/+11
| | | | | | | | | | | | | | | | | | | Summary: modctl - controls loadable kernel modules. Skip tests as this call uses privileged operations. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55025 llvm-svn: 348370
* Update GET_LINK_MAP_BY_DLOPEN_HANDLE() for NetBSD x86Kamil Rytarowski2018-12-051-2/+2
| | | | | | | | | | NetBSD 8.99.26 changed the layout of internal structure returned by dlopen(3), switch to it. Set new values for amd64 and i386 based on the results of &((struct Struct_Obj_Entry*)0)->linkmap. llvm-svn: 348329
* Add interceptors for the fts(3) API family from NetBSDKamil Rytarowski2018-12-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: fts(3) is API to traverse a file hierarchy. Cover this interface with interceptors. Add a test to validate the interface reading the number of regular files in /etc. Based on original work by Yang Zheng. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54247 llvm-svn: 348227
* Add new interceptor for regex(3) in NetBSDKamil Rytarowski2018-12-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add interceptors for the NetBSD style of regex(3) present inside libc: - regcomp - regexec - regerror - regfree - regnsub - regasub Add a dedicated test verifying the installed interceptors. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54584 llvm-svn: 348224
* [Sanitizer] Adding setvbuf in supported platforms and other stream buffer ↵David Carlier2018-11-211-0/+2
| | | | | | | | | | | | | | | functions - Enabling setvbuf interceptions for non NetBSD platforms. - setbuf, setbuffer, setlinebuf as well. Reviewers: vitalybuka, krytarowski Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D54779 llvm-svn: 347426
* Update ioctl(2) operations for NetBSD 8.99.25Kamil Rytarowski2018-10-311-11/+17
| | | | | | | | | | | | Eliminate dropped operations, add new operations. Update included headers for newer need. Add a fallback definition of nvlist_ref_t, becaue this type is internal to libnpf and the kernel, not exported into public headers. llvm-svn: 345726
* Remove obsolete ptrace(2) operations from NetBSDKamil Rytarowski2018-03-031-2/+0
| | | | | | | | | PT_SET_SIGMASK and PT_GET_SIGMASK will be removed from NetBSD without backward compat (it shortlived in a development branch). Sponsored by <The NetBSD Foundation> llvm-svn: 326657
* Add new interceptors: getnetent(3) familyKamil Rytarowski2018-02-271-0/+7
| | | | | | | | | | | | | | | | | | | | | Summary: getnetent, getnetbyaddr, getnetbyname - get network entry Reuse them on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43543 llvm-svn: 326163
* Add new interceptors: getprotoent(3) familyKamil Rytarowski2018-02-271-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: getprotoent, getprotobynumber, getprotobyname - get protocol entry Reuse them on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43541 llvm-svn: 326162
* Add new interceptors: getttyent(3) familyKamil Rytarowski2018-02-271-0/+12
| | | | | | | | | | | | | | | | | | | | | Summary: getttyent, getttynam, setttyentpath - get ttys file entry Reuse them on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43539 llvm-svn: 326161
* Teach sanitizer about NetBSD specific ioctl(2) callsKamil Rytarowski2018-02-151-166/+1770
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Introduce handling of 1200 NetBSD specific ioctl(2) calls. Over 100 operations are disabled as unavailable or conflicting with the existing ones (the same operation number). Add a script that generates the rules to detect ioctls on NetBSD. The generate_netbsd_ioctls.awk script has been written in NetBSD awk(1) (patched nawk) and is compatible with gawk. Generate lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc with the awk(1) script. Update sanitizer_platform_limits_netbsd accordingly to add the needed definitions. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis, dvyukov Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, fedor.sergeev, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D41636 llvm-svn: 325212
* Correct the setitimer interceptor on NetBSDKamil Rytarowski2018-01-121-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: itimerval can contain padding that may be legitimately uninitialized. On NetBSD there are four integers of type "long, int, long, int", the int argument stands for __sanitizer_suseconds_t. Compiler adds extra padding in this layout. Check every field of struct itimerval separately. Define __sanitizer_suseconds_t as long on FreeBSD, Linux and SmartOS, and int on NetBSD. Define __sanitizer_timeval and __sanitizer_itimerval. Sponsored by <The NetBSD Foundation> Reviewers: eugenis, joerg, vitalybuka Reviewed By: vitalybuka Subscribers: emaste, kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D41502 llvm-svn: 322399
* Set of corrections for MSan/NetBSDKamil Rytarowski2017-12-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Changes: - Don't attempt to intercept GLIBC specific functions like __strtol_internal. This is required to stop intercepting it as we leak dlerror(3) for dlsym(3) that cannot manage to find a symbol. - Correct interception of fstatat(2). - Don't run a test for fgetgrent_r() that is missing on NetBSD. - Correct link_map location (offset) in Obj_Entry on x86_64 and i386. - Stop intercepting getpshared-like functions in pthread(3). This is feature is not enabled by default on NetBSD as it's unfinished. - Switch intercepting from UTMP to UTMPX functions. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis, kcc Reviewed By: vitalybuka Subscribers: llvm-commits, srhines, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D41053 llvm-svn: 320663
* Handle NetBSD symbol renaming in msan_interceptors.ccKamil Rytarowski2017-12-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: NetBSD renames symbols for historical and compat reasons. Add required symbol renames in sanitizer_common_interceptors.inc: - gettimeofday -> __gettimeofday50 - getrusage -> __getrusage50 - shmctl -> __shmctl50 Additionally handle sigaction symbol mangling. Rename the function symbol in the file to SIGACTION_SYMNAME and define it as __sigaction14 for NetBSD and sigaction for !NetBSD. We cannot use simple renaming with the proprocessor, as there are valid fields named sigaction and they must be left intact. Sponsored by <The NetBSD Foundation> Reviewers: joerg, eugenis, vitalybuka, dvyukov Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40766 llvm-svn: 319966
* Correct NetBSD support in pthread_once(3)/TSanKamil Rytarowski2017-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The pthread_once(3)/NetBSD type is built with the following structure: struct __pthread_once_st { pthread_mutex_t pto_mutex; int pto_done; }; Set the pto_done position as shifted by __sanitizer::pthread_mutex_t_sz from the beginning of the pthread_once struct. This corrects deadlocks when the pthread_once(3) function is used. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, vitalybuka Reviewed By: dvyukov Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40262 llvm-svn: 318742
* [tsan] Move out more types to sanitizer_commonVitaly Buka2017-11-101-5/+11
| | | | | | https://github.com/google/sanitizers/issues/637 llvm-svn: 317946
* [tsan] Use __sanitizer_siginfo from sanitizer_commonVitaly Buka2017-11-101-1/+6
| | | | llvm-svn: 317872
* Add NetBSD improvements in sanitizersKamil Rytarowski2017-10-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Changes: * Add initial msan stub support. * Handle NetBSD specific pthread_setname_np(3). * NetBSD supports __attribute__((tls_model("initial-exec"))), define it in SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE. * Add ReExec() specific bits for NetBSD. * Simplify code and add syscall64 and syscall_ptr for !NetBSD. * Correct bunch of syscall wrappers for NetBSD. * Disable test/tsan/map32bit on NetBSD as not applicable. * Port test/tsan/strerror_r to a POSIX-compliant OSes. * Disable __libc_stack_end on NetBSD. * Disable ReadNullSepFileToArray() on NetBSD. * Define struct_ElfW_Phdr_sz, detected missing symbol by msan. * Change type of __sanitizer_FILE from void to char. This helps to reuse this type as an array. Long term it will be properly implemented along with SANITIZER_HAS_STRUCT_FILE setting to 1. * Add initial NetBSD support in lib/tsan/go/buildgo.sh. * Correct referencing stdout and stderr in tsan_interceptors.cc on NetBSD. * Document NetBSD x86_64 specific virtual memory layout in tsan_platform.h. * Port tests/rtl/tsan_test_util_posix.cc to NetBSD. * Enable NetBSD tests in test/msan/lit.cfg. * Enable NetBSD tests in test/tsan/lit.cfg. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis, kcc, dvyukov Reviewed By: dvyukov Subscribers: #sanitizers, llvm-commits, kubamracek Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39124 llvm-svn: 316591
* Add NetBSD specific version of sanitizer_platform_limits_posixKamil Rytarowski2017-08-281-0/+568
Summary: NetBSD is an Open-Source POSIX-like BSD Operating System. Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas. Sponsored by <The NetBSD Foundation> Reviewers: joerg, kcc, vitalybuka, filcab, fjricci Reviewed By: kcc Subscribers: llvm-commits, kubamracek, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D37193 llvm-svn: 311933
OpenPOWER on IntegriCloud