[v2] manual: Document unsupported cases for interposition

Message ID 20210721071823.1364166-1-siddhesh@sourceware.org
State Superseded
Headers show
Series
  • [v2] manual: Document unsupported cases for interposition
Related show

Commit Message

Florian Weimer via Libc-alpha July 21, 2021, 7:18 a.m.
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(+)

-- 
2.31.1

Comments

Andreas Schwab July 21, 2021, 7:47 a.m. | #1
On Jul 21 2021, Siddhesh Poyarekar via Libc-alpha wrote:

> diff --git a/manual/memory.texi b/manual/memory.texi

> index 31ee36be8c..5fb58af736 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


@Theglibc{} at the sentence beginning.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Patch

diff --git a/manual/memory.texi b/manual/memory.texi
index 31ee36be8c..5fb58af736 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