Message ID | 87pn9334wr.fsf@oldenburg2.str.redhat.com |
---|---|
State | Committed |
Headers | show |
Series | malloc: Deprecate more hook-related functionality | expand |
On 7/10/20 8:56 AM, Florian Weimer via Libc-alpha wrote: OK for 2.32 with commit message fixed. Reviewed-by: Carlos O'Donell <carlos@redhat.com> > __morecore, __after_morecore_hook and __after_morecore_hook had not Suggest: __morecore, __after_morecore_hook, and __default_morecore had not ... > been deprecated in commit 7d17596c198f11fa85cbcf9587443f262e63b616 > ("Mark malloc hook variables as deprecated"), probably by accident. In my original patch to remove the malloc hooks: https://sourceware.org/pipermail/libc-alpha/2018-June/095230.html I note the following: ~~~ The functionality which is no longer supported is that provided by __morecore, and __after_morecore_hook. The morecore related hooking is entirely removed, and __default_morecore is always called with no interposition possible (now named __glibc_morecore). ... __morecore@GLIBC_2.2.5 (unused) __default_morecore@GLIBC_2.2.5 (default) __after_morecore_hook@GLIBC_2.2.5 (unused) ~~~ Your deprecation matches my expectations for additional functions which would need deprecation, and matches my comments in the 2018 patch. I appreciate your help here moving this interface towards removal. > Tested on i686-linux-gnu. > > --- > NEWS | 7 +++++++ > malloc/malloc.h | 7 ++++--- > 2 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/NEWS b/NEWS > index 0b25b4fde9..8fb1dac36d 100644 > --- a/NEWS > +++ b/NEWS > @@ -131,6 +131,13 @@ Deprecated and removed features, and other changes affecting compatibility: > storing RPC keys only supported the obsolete and insecure AUTH_DES > flavor of secure RPC.) > > +* The __morecore and __after_morecore_hook malloc hooks and the default > + implementation __default_morecore have been deprecated. Applications > + should use malloc interposition to change malloc behavior, and mmap to > + allocate anonymous memory. A future version of glibc may require that > + applications which use the malloc hooks must preload a special shared > + object, to enable the hooks. OK. > + > Changes to build and runtime requirements: > > * powerpc64le requires GCC 7.4 or newer. This is required for supporting > diff --git a/malloc/malloc.h b/malloc/malloc.h > index a6903fdd54..e0e91a9331 100644 > --- a/malloc/malloc.h > +++ b/malloc/malloc.h > @@ -75,11 +75,11 @@ extern void *pvalloc (size_t __size) __THROW __attribute_malloc__ __wur; > > /* Underlying allocation function; successive calls should return > contiguous pieces of memory. */ > -extern void *(*__morecore) (ptrdiff_t __size); > +extern void *(*__morecore) (ptrdiff_t __size) __MALLOC_DEPRECATED; OK. > > /* Default value of `__morecore'. */ > extern void *__default_morecore (ptrdiff_t __size) > -__THROW __attribute_malloc__; > +__THROW __attribute_malloc__ __MALLOC_DEPRECATED; OK. > > /* SVID2/XPG mallinfo structure */ > > @@ -156,7 +156,8 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment, > size_t __size, > const void *) > __MALLOC_DEPRECATED; > -extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void); > +extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void) > + __MALLOC_DEPRECATED; OK. > > > __END_DECLS >
diff --git a/NEWS b/NEWS index 0b25b4fde9..8fb1dac36d 100644 --- a/NEWS +++ b/NEWS @@ -131,6 +131,13 @@ Deprecated and removed features, and other changes affecting compatibility: storing RPC keys only supported the obsolete and insecure AUTH_DES flavor of secure RPC.) +* The __morecore and __after_morecore_hook malloc hooks and the default + implementation __default_morecore have been deprecated. Applications + should use malloc interposition to change malloc behavior, and mmap to + allocate anonymous memory. A future version of glibc may require that + applications which use the malloc hooks must preload a special shared + object, to enable the hooks. + Changes to build and runtime requirements: * powerpc64le requires GCC 7.4 or newer. This is required for supporting diff --git a/malloc/malloc.h b/malloc/malloc.h index a6903fdd54..e0e91a9331 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -75,11 +75,11 @@ extern void *pvalloc (size_t __size) __THROW __attribute_malloc__ __wur; /* Underlying allocation function; successive calls should return contiguous pieces of memory. */ -extern void *(*__morecore) (ptrdiff_t __size); +extern void *(*__morecore) (ptrdiff_t __size) __MALLOC_DEPRECATED; /* Default value of `__morecore'. */ extern void *__default_morecore (ptrdiff_t __size) -__THROW __attribute_malloc__; +__THROW __attribute_malloc__ __MALLOC_DEPRECATED; /* SVID2/XPG mallinfo structure */ @@ -156,7 +156,8 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment, size_t __size, const void *) __MALLOC_DEPRECATED; -extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void); +extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void) + __MALLOC_DEPRECATED; __END_DECLS