unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] manual: reallocarray and str*dup interposition is not supported
@ 2021-07-20  1:43 Siddhesh Poyarekar via Libc-alpha
  2021-07-20  8:05 ` Florian Weimer via Libc-alpha
  0 siblings, 1 reply; 6+ messages in thread
From: Siddhesh Poyarekar via Libc-alpha @ 2021-07-20  1:43 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer

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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/manual/memory.texi b/manual/memory.texi
index 31ee36be8c..4560781f64 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -2033,6 +2033,11 @@ 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.
 
+Replacing the @code{reallocarray} function and the @code{strdup} family of
+functions is not supported and may produce incorrect results. @theglibc{}
+implementations of these functions call the replacement @code{malloc} and
+@code{realloc} functions whenever available.
+
 @node Obstacks
 @subsection Obstacks
 @cindex obstacks
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] manual: reallocarray and str*dup interposition is not supported
  2021-07-20  1:43 [PATCH] manual: reallocarray and str*dup interposition is not supported Siddhesh Poyarekar via Libc-alpha
@ 2021-07-20  8:05 ` Florian Weimer via Libc-alpha
  2021-07-21  7:18   ` [PATCH v2] manual: Document unsupported cases for interposition Siddhesh Poyarekar via Libc-alpha
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer via Libc-alpha @ 2021-07-20  8:05 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: libc-alpha

* 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 | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/manual/memory.texi b/manual/memory.texi
> index 31ee36be8c..4560781f64 100644
> --- a/manual/memory.texi
> +++ b/manual/memory.texi
> @@ -2033,6 +2033,11 @@ 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.
>  
> +Replacing the @code{reallocarray} function and the @code{strdup} family of
> +functions is not supported and may produce incorrect results. @theglibc{}
> +implementations of these functions call the replacement @code{malloc} and
> +@code{realloc} functions whenever available.

There are other examples: realpath, getcwd, asprintf, and more.  So
please rephrase this in such a way that reallocarray and strdup are just
examples of memory-allocating library functions that call the
replacement malloc implementation.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] manual: Document unsupported cases for interposition
  2021-07-20  8:05 ` Florian Weimer via Libc-alpha
@ 2021-07-21  7:18   ` Siddhesh Poyarekar via Libc-alpha
  2021-07-21  7:47     ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Siddhesh Poyarekar via Libc-alpha @ 2021-07-21  7:18 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer

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..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
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] manual: Document unsupported cases for interposition
  2021-07-21  7:18   ` [PATCH v2] manual: Document unsupported cases for interposition Siddhesh Poyarekar via Libc-alpha
@ 2021-07-21  7:47     ` Andreas Schwab
  2021-07-21  8:04       ` [PATCH v3] " Siddhesh Poyarekar via Libc-alpha
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2021-07-21  7:47 UTC (permalink / raw)
  To: Siddhesh Poyarekar via Libc-alpha; +Cc: fweimer, Siddhesh Poyarekar

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."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3] manual: Document unsupported cases for interposition
  2021-07-21  7:47     ` Andreas Schwab
@ 2021-07-21  8:04       ` Siddhesh Poyarekar via Libc-alpha
  2021-07-23 11:43         ` Florian Weimer via Libc-alpha
  0 siblings, 1 reply; 6+ messages in thread
From: Siddhesh Poyarekar via Libc-alpha @ 2021-07-21  8:04 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, schwab

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.
+
 @node Obstacks
 @subsection Obstacks
 @cindex obstacks
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] manual: Document unsupported cases for interposition
  2021-07-21  8:04       ` [PATCH v3] " Siddhesh Poyarekar via Libc-alpha
@ 2021-07-23 11:43         ` Florian Weimer via Libc-alpha
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer via Libc-alpha @ 2021-07-23 11:43 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: schwab, libc-alpha

* 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-23 11:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20  1:43 [PATCH] manual: reallocarray and str*dup interposition is not supported Siddhesh Poyarekar via Libc-alpha
2021-07-20  8:05 ` Florian Weimer via Libc-alpha
2021-07-21  7:18   ` [PATCH v2] manual: Document unsupported cases for interposition Siddhesh Poyarekar via Libc-alpha
2021-07-21  7:47     ` Andreas Schwab
2021-07-21  8:04       ` [PATCH v3] " Siddhesh Poyarekar via Libc-alpha
2021-07-23 11:43         ` Florian Weimer via Libc-alpha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).