[PATCH 2/2] ntdll: Add DECLSPEC_HOTPATCH to strrchr.

Roman Pišl rpisl at seznam.cz
Wed Dec 8 16:52:59 CST 2021


I see no other way how to make Clang ASAN work.
ASAN recognizes first instruction(s) and inserts trampoline, but the loop
in the function body jumps back to the start of the function (and hangs)
or somewhere inside the trampoline (that leads to invalid instruction).

Other fixes can be performed on the ASAN side, see the bug report.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50993
Signed-off-by: Roman Pišl <rpisl at seznam.cz>
---
 dlls/ntdll/string.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/string.c b/dlls/ntdll/string.c
index 0fa83821d21..e58320790cf 100644
--- a/dlls/ntdll/string.c
+++ b/dlls/ntdll/string.c
@@ -339,7 +339,7 @@ char * __cdecl strpbrk( const char *str, const char *accept )
 /*********************************************************************
  *                  strrchr   (NTDLL.@)
  */
-char * __cdecl strrchr( const char *str, int c )
+char * __cdecl DECLSPEC_HOTPATCH strrchr( const char *str, int c )
 {
     char *ret = NULL;
     do { if (*str == (char)c) ret = (char *)(ULONG_PTR)str; } while (*str++);
-- 
2.30.2




More information about the wine-devel mailing list