Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-141770: Annotate anonymous mmap usage if "-X dev" is used#142079
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
0e3933d8b7023e816d962979ce02b3d85470c5a495e757dd9cb9509b855742b32cc00749b4f951b88b75e2eedbca6806778ec4d73c0e08b6e66e650b0ca751c9138de8f77e0d8706fce8ce8281d71a7444dd1ee4fee757ea240b3c805c539795d31cbe4d550290864ab287e0c1619f95a1ad592e4e48350429a0aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #ifndef Py_INTERNAL_MMAP_H | ||
| #define Py_INTERNAL_MMAP_H | ||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
| #ifndef Py_BUILD_CORE | ||
| # error "this header requires Py_BUILD_CORE define" | ||
| #endif | ||
| #include "pycore_pystate.h" | ||
| #if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__) | ||
| # include <linux/prctl.h> | ||
| # include <sys/prctl.h> | ||
| #endif | ||
| #if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__) | ||
| static inline void | ||
| _PyAnnotateMemoryMap(void *addr, size_t size, const char *name) | ||
| { | ||
| #ifndef Py_DEBUG | ||
| if (!_Py_GetConfig()->dev_mode) { | ||
| return; | ||
| } | ||
| #endif | ||
| assert(strlen(name) < 80); | ||
| int old_errno = errno; | ||
| prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)addr, size, name); | ||
| /* Ignore errno from prctl */ | ||
| /* See: https://bugzilla.redhat.com/show_bug.cgi?id=2302746 */ | ||
| errno = old_errno; | ||
| } | ||
| #else | ||
| static inline void | ||
| _PyAnnotateMemoryMap(void *Py_UNUSED(addr), size_t Py_UNUSED(size), const char *Py_UNUSED(name)) | ||
| { | ||
| } | ||
| #endif | ||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
| #endif // !Py_INTERNAL_MMAP_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Annotate anonymous mmap usage only when supported by the | ||
| Linux kernel and if ``-X dev`` is used or Python is built in debug mode. Patch by Donghee Na. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.