[v3] manual: Document unsupported cases for interposition

Message ID 20210721080453.1368114-1-siddhesh@sourceware.org
State Committed
Commit d34ed66f96fa9316654d7adb2afcce4be1d1c4f5
Headers
Series [v3] manual: Document unsupported cases for interposition |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Siddhesh Poyarekar July 21, 2021, 8:04 a.m. UTC
  These functions call the core allocator functions (realloc and malloc
respectively) and are hence guaranteed to allocate memory using the
correct functions when multiple allocators are interposed.  Having
these functions interposed in one allocator and not another may result
in confusion, hence discourage interposing them altogether.
---
 manual/memory.texi | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Florian Weimer July 23, 2021, 11:43 a.m. UTC | #1
* Siddhesh Poyarekar:

> These functions call the core allocator functions (realloc and malloc
> respectively) and are hence guaranteed to allocate memory using the
> correct functions when multiple allocators are interposed.  Having
> these functions interposed in one allocator and not another may result
> in confusion, hence discourage interposing them altogether.
> ---
>  manual/memory.texi | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/manual/memory.texi b/manual/memory.texi
> index 31ee36be8c..1ca0c83327 100644
> --- a/manual/memory.texi
> +++ b/manual/memory.texi
> @@ -2033,6 +2033,13 @@ when a replacement @code{malloc} is in use.  However, failure to replace
>  these functions typically does not result in crashes or other incorrect
>  application behavior, but may result in static linking failures.
>  
> +There are other functions (@code{reallocarray}, @code{strdup}, etc.) in
> +@theglibc{} that are not listed above but return newly allocated memory to
> +callers.  Replacement of these functions is not supported and may produce
> +incorrect results.  @Theglibc{} implementations of these functions call
> +the replacement allocator functions whenever available, so they will work
> +correctly with @code{malloc} replacement.

Looks good to me.  Carlos?

Florian
  

Patch

diff --git a/manual/memory.texi b/manual/memory.texi
index 31ee36be8c..1ca0c83327 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -2033,6 +2033,13 @@  when a replacement @code{malloc} is in use.  However, failure to replace
 these functions typically does not result in crashes or other incorrect
 application behavior, but may result in static linking failures.
 
+There are other functions (@code{reallocarray}, @code{strdup}, etc.) in
+@theglibc{} that are not listed above but return newly allocated memory to
+callers.  Replacement of these functions is not supported and may produce
+incorrect results.  @Theglibc{} implementations of these functions call
+the replacement allocator functions whenever available, so they will work
+correctly with @code{malloc} replacement.
+
 @node Obstacks
 @subsection Obstacks
 @cindex obstacks