Re: Check for memset_explicit() and explicit_memset() - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Check for memset_explicit() and explicit_memset()
Date
Msg-id aZ0+SLZ+1DQtD0yD@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Check for memset_explicit() and explicit_memset()  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Responses Re: Check for memset_explicit() and explicit_memset()
List pgsql-hackers
Hi,

On Mon, Feb 23, 2026 at 03:22:22PM +0000, Bertrand Drouvot wrote:
> Could we hit the same kind of issue as in [1] (when using -std=c11)?
> 
> Asking because I can see (in [2]), that in glibc 2.43, memset_explicit is guarded
> that way (string/string.h):
> 
> "
> #if defined __USE_MISC || __GLIBC_USE (ISOC23)
> /* Like memset, but the compiler will not delete a call to this
>    function, even if S is dead after the call.  */
> extern void *memset_explicit (void *__s, int __c, size_t __n)
>      __THROW __nonnull ((1)) __fortified_attr_access (__write_only__, 1, 3);
> #endif
> "

I did more research on it and that seems to work with -std=c11. While 
-std=c11 does not define __USE_MISC, the fact that we add -D_GNU_SOURCE by
default enables __USE_MISC.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: "Jonathan S. Katz"
Date:
Subject: Re: 2026-02-26 release announcement draft
Next
From: Chao Li
Date:
Subject: Re: client_connection_check_interval default value