[PATCH v2 0/1] MR4323: pdh: Introduce memory barrier in destroy operations.
gcc tends to optimize away the magic field cleanup, leading to believe the query is still allocated. Signed-off-by: Eric Pouech <epouech(a)codeweavers.com> -- v2: pdh: Zero out magic fields with SecureZeroMemory(). https://gitlab.winehq.org/wine/wine/-/merge_requests/4323
From: Eric Pouech <epouech(a)codeweavers.com> gcc tends to optimize away the magic field cleanup, leading to believe the query is still allocated. Signed-off-by: Eric Pouech <epouech(a)codeweavers.com> --- dlls/pdh/pdh_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/pdh/pdh_main.c b/dlls/pdh/pdh_main.c index 073a74e1b52..a63c18e0bb4 100644 --- a/dlls/pdh/pdh_main.c +++ b/dlls/pdh/pdh_main.c @@ -97,7 +97,7 @@ static struct counter *create_counter( void ) static void destroy_counter( struct counter *counter ) { - counter->magic = 0; + SecureZeroMemory( &counter->magic, sizeof( counter->magic ) ); free( counter->path ); free( counter ); } @@ -130,7 +130,7 @@ static struct query *create_query( void ) static void destroy_query( struct query *query ) { - query->magic = 0; + SecureZeroMemory( &query->magic, sizeof( query->magic ) ); free( query ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4323
On Tue Nov 7 09:31:12 2023 +0000, Hans Leidekker wrote:
We use [Rtl]SecureZeroMemory() elsewhere. V2 pushed
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4323#note_51281
Can we please have a comment in the code explaining why that's there? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4323#note_51347
participants (3)
-
Eric Pouech -
eric pouech (@epo) -
Zebediah Figura (@zfigura)