- Notifications
You must be signed in to change notification settings - Fork 15.3k
[sanitizer_common] Implement address sanitizer on AIX: platform specific support #131866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jakeegan wants to merge 5 commits into llvm:main Choose a base branch from jakeegan:asan_common1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits Select commit Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -24,7 +24,7 @@ | |
| // Must go after undef _FILE_OFFSET_BITS. | ||
| #include "sanitizer_platform.h" | ||
| | ||
| #if SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU | ||
| Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe sanitizer_platform_limits_aix.cpp ? Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why though? AIX is a POSIX platform and the logic (and structure) here seems to be common except for the usual type/structure size/layout differences. | ||
| #if SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU || SANITIZER_AIX | ||
| // Must go after undef _FILE_OFFSET_BITS. | ||
| #include "sanitizer_glibc_version.h" | ||
| | ||
| | @@ -61,11 +61,11 @@ | |
| #endif | ||
| | ||
| #if !SANITIZER_ANDROID | ||
| #if !SANITIZER_HAIKU | ||
| #include <sys/mount.h> | ||
| #endif | ||
| #include <sys/timeb.h> | ||
| #include <utmpx.h> | ||
| # if !SANITIZER_HAIKU && !SANITIZER_AIX | ||
| # include <sys/mount.h> | ||
| # endif | ||
| # include <sys/timeb.h> | ||
| # include <utmpx.h> | ||
| #endif | ||
| | ||
| #if SANITIZER_LINUX | ||
| | @@ -112,11 +112,15 @@ typedef struct user_fpregs elf_fpregset_t; | |
| #endif | ||
| | ||
| #if !SANITIZER_ANDROID | ||
| #include <ifaddrs.h> | ||
| #if !SANITIZER_HAIKU | ||
| #include <sys/ucontext.h> | ||
| #include <wordexp.h> | ||
| #endif | ||
| # if !SANITIZER_AIX | ||
| # include <ifaddrs.h> | ||
| # else | ||
| # include <netinet/in.h> | ||
| # endif | ||
| # if !SANITIZER_HAIKU | ||
| # include <sys/ucontext.h> | ||
| # include <wordexp.h> | ||
| # endif | ||
| #endif | ||
| | ||
| #if SANITIZER_LINUX | ||
| | @@ -182,6 +186,17 @@ typedef struct user_fpregs elf_fpregset_t; | |
| #include <sys/ioctl.h> | ||
| #endif | ||
| | ||
| # if SANITIZER_AIX | ||
| # include <netinet/ip_mroute.h> | ||
| # include <stropts.h> | ||
| # include <sys/ioctl.h> | ||
| # include <sys/statfs.h> | ||
| # include <unistd.h> | ||
| # if HAVE_RPC_XDR_H | ||
| # include <tirpc/rpc/xdr.h> | ||
| # endif | ||
| # endif | ||
| | ||
| // Include these after system headers to avoid name clashes and ambiguities. | ||
| # include "sanitizer_common.h" | ||
| # include "sanitizer_internal_defs.h" | ||
| | @@ -557,14 +572,14 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); | |
| | ||
| const unsigned IOCTL_NOT_PRESENT = 0; | ||
| | ||
| unsigned IOCTL_FIONBIO = FIONBIO; | ||
| #if !SANITIZER_HAIKU | ||
| unsigned IOCTL_FIOASYNC = FIOASYNC; | ||
| ioctl_alttype IOCTL_FIONBIO = FIONBIO; | ||
| # if !SANITIZER_HAIKU | ||
| ioctl_alttype IOCTL_FIOASYNC = FIOASYNC; | ||
| unsigned IOCTL_FIOCLEX = FIOCLEX; | ||
| unsigned IOCTL_FIOGETOWN = FIOGETOWN; | ||
| unsigned IOCTL_FIONCLEX = FIONCLEX; | ||
| unsigned IOCTL_FIOSETOWN = FIOSETOWN; | ||
| #endif | ||
| ioctl_alttype IOCTL_FIOSETOWN = FIOSETOWN; | ||
| # endif | ||
| unsigned IOCTL_SIOCADDMULTI = SIOCADDMULTI; | ||
| unsigned IOCTL_SIOCATMARK = SIOCATMARK; | ||
| unsigned IOCTL_SIOCDELMULTI = SIOCDELMULTI; | ||
| | @@ -584,30 +599,32 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); | |
| unsigned IOCTL_SIOCSIFMETRIC = SIOCSIFMETRIC; | ||
| unsigned IOCTL_SIOCSIFMTU = SIOCSIFMTU; | ||
| unsigned IOCTL_SIOCSIFNETMASK = SIOCSIFNETMASK; | ||
| unsigned IOCTL_SIOCSPGRP = SIOCSPGRP; | ||
| ioctl_alttype IOCTL_SIOCSPGRP = SIOCSPGRP; | ||
| | ||
| #if !SANITIZER_HAIKU | ||
| unsigned IOCTL_TIOCCONS = TIOCCONS; | ||
| # if !SANITIZER_HAIKU | ||
| ioctl_alttype IOCTL_TIOCCONS = TIOCCONS; | ||
| unsigned IOCTL_TIOCGETD = TIOCGETD; | ||
| unsigned IOCTL_TIOCNOTTY = TIOCNOTTY; | ||
| unsigned IOCTL_TIOCPKT = TIOCPKT; | ||
| unsigned IOCTL_TIOCSETD = TIOCSETD; | ||
| unsigned IOCTL_TIOCSTI = TIOCSTI; | ||
| #endif | ||
| ioctl_alttype IOCTL_TIOCPKT = TIOCPKT; | ||
| ioctl_alttype IOCTL_TIOCSETD = TIOCSETD; | ||
| ioctl_alttype IOCTL_TIOCSTI = TIOCSTI; | ||
| # endif | ||
| | ||
| unsigned IOCTL_TIOCEXCL = TIOCEXCL; | ||
| unsigned IOCTL_TIOCGPGRP = TIOCGPGRP; | ||
| unsigned IOCTL_TIOCGWINSZ = TIOCGWINSZ; | ||
| unsigned IOCTL_TIOCMBIC = TIOCMBIC; | ||
| unsigned IOCTL_TIOCMBIS = TIOCMBIS; | ||
| ioctl_alttype IOCTL_TIOCMBIC = TIOCMBIC; | ||
| ioctl_alttype IOCTL_TIOCMBIS = TIOCMBIS; | ||
| unsigned IOCTL_TIOCMGET = TIOCMGET; | ||
| unsigned IOCTL_TIOCMSET = TIOCMSET; | ||
| ioctl_alttype IOCTL_TIOCMSET = TIOCMSET; | ||
| unsigned IOCTL_TIOCNXCL = TIOCNXCL; | ||
| unsigned IOCTL_TIOCOUTQ = TIOCOUTQ; | ||
| # if !SANITIZER_AIX | ||
| unsigned IOCTL_TIOCSCTTY = TIOCSCTTY; | ||
| unsigned IOCTL_TIOCSPGRP = TIOCSPGRP; | ||
| unsigned IOCTL_TIOCSWINSZ = TIOCSWINSZ; | ||
| #if SANITIZER_LINUX && !SANITIZER_ANDROID | ||
| # endif | ||
| ioctl_alttype IOCTL_TIOCSPGRP = TIOCSPGRP; | ||
| ioctl_alttype IOCTL_TIOCSWINSZ = TIOCSWINSZ; | ||
| # if SANITIZER_LINUX && !SANITIZER_ANDROID | ||
| unsigned IOCTL_SIOCGETSGCNT = SIOCGETSGCNT; | ||
| unsigned IOCTL_SIOCGETVIFCNT = SIOCGETVIFCNT; | ||
| #endif | ||
| | @@ -1069,6 +1086,9 @@ CHECK_SIZE_AND_OFFSET(addrinfo, ai_protocol); | |
| CHECK_SIZE_AND_OFFSET(addrinfo, ai_addrlen); | ||
| CHECK_SIZE_AND_OFFSET(addrinfo, ai_canonname); | ||
| CHECK_SIZE_AND_OFFSET(addrinfo, ai_addr); | ||
| # if SANITIZER_AIX | ||
| CHECK_SIZE_AND_OFFSET(addrinfo, ai_eflags); | ||
| # endif | ||
| | ||
| CHECK_TYPE_SIZE(hostent); | ||
| CHECK_SIZE_AND_OFFSET(hostent, h_name); | ||
| | @@ -1115,11 +1135,13 @@ COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent)); | |
| CHECK_SIZE_AND_OFFSET(dirent, d_ino); | ||
| #if SANITIZER_APPLE | ||
| CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); | ||
| #elif SANITIZER_FREEBSD || SANITIZER_HAIKU | ||
| # elif SANITIZER_AIX | ||
| CHECK_SIZE_AND_OFFSET(dirent, d_offset); | ||
| # elif SANITIZER_FREEBSD || SANITIZER_HAIKU | ||
| // There is no 'd_off' field on FreeBSD. | ||
| #else | ||
| # else | ||
| CHECK_SIZE_AND_OFFSET(dirent, d_off); | ||
| #endif | ||
| # endif | ||
| CHECK_SIZE_AND_OFFSET(dirent, d_reclen); | ||
| | ||
| #if SANITIZER_GLIBC | ||
| | @@ -1194,6 +1216,10 @@ CHECK_SIZE_AND_OFFSET(wordexp_t, we_wordc); | |
| CHECK_SIZE_AND_OFFSET(wordexp_t, we_wordv); | ||
| CHECK_SIZE_AND_OFFSET(wordexp_t, we_offs); | ||
| #endif | ||
| # if SANITIZER_AIX | ||
| CHECK_SIZE_AND_OFFSET(wordexp_t, we_sflags); | ||
| CHECK_SIZE_AND_OFFSET(wordexp_t, we_soffs); | ||
| # endif | ||
| | ||
| CHECK_TYPE_SIZE(tm); | ||
| CHECK_SIZE_AND_OFFSET(tm, tm_sec); | ||
| | @@ -1205,10 +1231,12 @@ CHECK_SIZE_AND_OFFSET(tm, tm_year); | |
| CHECK_SIZE_AND_OFFSET(tm, tm_wday); | ||
| CHECK_SIZE_AND_OFFSET(tm, tm_yday); | ||
| CHECK_SIZE_AND_OFFSET(tm, tm_isdst); | ||
| # if !SANITIZER_AIX | ||
| CHECK_SIZE_AND_OFFSET(tm, tm_gmtoff); | ||
| CHECK_SIZE_AND_OFFSET(tm, tm_zone); | ||
| # endif | ||
| | ||
| #if SANITIZER_LINUX | ||
| # if SANITIZER_LINUX | ||
| CHECK_TYPE_SIZE(mntent); | ||
| CHECK_SIZE_AND_OFFSET(mntent, mnt_fsname); | ||
| CHECK_SIZE_AND_OFFSET(mntent, mnt_dir); | ||
| | @@ -1258,7 +1286,7 @@ CHECK_TYPE_SIZE(clock_t); | |
| CHECK_TYPE_SIZE(clockid_t); | ||
| #endif | ||
| | ||
| #if !SANITIZER_ANDROID && !SANITIZER_HAIKU | ||
| # if !SANITIZER_ANDROID && !SANITIZER_HAIKU && !SANITIZER_AIX | ||
| CHECK_TYPE_SIZE(ifaddrs); | ||
| CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_next); | ||
| CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_name); | ||
| | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not specific to this patch: I am a bit concerned about this. If the CI or build system does not have this header, then changes that break the correspondence in layout would not be identified.
A separate patch should be posted to require the presence of this header (with an opt-out via CMake option). @vitalybuka, what process would you advise in terms of giving advance warning for buildbot maintainers?