FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-149165: Support HWASan in _testinternalcapi.c. by fmayer · Pull Request #149166 · python/cpython · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .h  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions Include/internal/pycore_pythonrun.h
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
Expand Up @@ -46,6 +46,7 @@ extern PyObject * _Py_CompileStringObjectWithModule(
* stack consumption of PyEval_EvalDefault */
#if (defined(Py_DEBUG) \
|| defined(_Py_ADDRESS_SANITIZER) \
|| defined(_Py_HWADDRESS_SANITIZER) \
|| defined(_Py_THREAD_SANITIZER))
# define _PyOS_LOG2_STACK_MARGIN 12
#else
Expand Down
10 changes: 10 additions & 0 deletions Include/pyport.h
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
Expand Up @@ -561,6 +561,12 @@ extern "C" {
# define _Py_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
# endif
# endif
# if __has_feature(hwaddress_sanitizer)
# if !defined(_Py_HWADDRESS_SANITIZER)
# define _Py_HWADDRESS_SANITIZER
# define _Py_NO_SANITIZE_HWADDRESS __attribute__((no_sanitize("hwaddress")))
# endif
# endif
# if __has_feature(thread_sanitizer)
# if !defined(_Py_THREAD_SANITIZER)
# define _Py_THREAD_SANITIZER
Expand All @@ -572,6 +578,10 @@ extern "C" {
# define _Py_ADDRESS_SANITIZER
# define _Py_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
# endif
# if defined(__SANITIZE_HWADDRESS__)
# define _Py_HWADDRESS_SANITIZER
# define _Py_NO_SANITIZE_HWADDRESS __attribute__((no_sanitize("hwaddress")))
# endif
# if defined(__SANITIZE_THREAD__)
# define _Py_THREAD_SANITIZER
# define _Py_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread))
Expand Down
3 changes: 2 additions & 1 deletion Modules/_testinternalcapi.c
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
Expand Up @@ -1863,7 +1863,8 @@ static PyObject *
check_pyobject_freed_is_freed(PyObject *self, PyObject *Py_UNUSED(args))
{
/* ASan or TSan would report an use-after-free error */
#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER)
#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER) || \
defined(_Py_HWADDRESS_SANITIZER)
Py_RETURN_NONE;
#else
PyObject *op = PyObject_CallNoArgs((PyObject *)&PyBaseObject_Type);
Expand Down
Loading

Back | FazBrowse Home | New Git URL