public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug manual/26959] New: __malloc_hook example does not adhere to documented usage
@ 2020-11-27  8:38 vries at gcc dot gnu.org
  2021-07-14  3:06 ` [Bug manual/26959] " siddhesh at sourceware dot org
  2021-07-14  4:15 ` siddhesh at sourceware dot org
  0 siblings, 2 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-27  8:38 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26959

            Bug ID: 26959
           Summary: __malloc_hook example does not adhere to documented
                    usage
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: manual
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
                CC: mtk.manpages at gmail dot com
  Target Milestone: ---

Consider
https://www.gnu.org/software/libc/manual/html_node/Hooks-for-Malloc.html .

It states:
...
An issue to look out for is the time at which the malloc hook functions can be
safely installed. If the hook functions call the malloc-related functions
recursively, it is necessary that malloc has already properly initialized
itself at the time when __malloc_hook etc. is assigned to.
...

Then an example follows, which does call malloc recursively, but does nothing
specific before __malloc_hook is assigned to for the first time.

[ My guess is that the doc list two solutions for the same problem: the first
call to malloc may change __malloc_hook from malloc_hook_ini to malloc_check,
say if you run with GLIBC_TUNABLES=glibc.malloc.check=3.

The first solution is to ensure that malloc is called once before saving and
then assigning __malloc_hook, such that the saved __malloc_hook value can be
assumed to remain constant, and does not need to be saved again after every
recursive call to malloc.

The second solution is to make sure the __malloc_hook value is saved again
after every recursive call to malloc. ]

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug manual/26959] __malloc_hook example does not adhere to documented usage
  2020-11-27  8:38 [Bug manual/26959] New: __malloc_hook example does not adhere to documented usage vries at gcc dot gnu.org
@ 2021-07-14  3:06 ` siddhesh at sourceware dot org
  2021-07-14  4:15 ` siddhesh at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: siddhesh at sourceware dot org @ 2021-07-14  3:06 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26959

Siddhesh Poyarekar <siddhesh at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siddhesh at sourceware dot org
           Assignee|unassigned at sourceware dot org   |siddhesh at sourceware dot org

--- Comment #1 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
Malloc hooks have been deprecated fo a while and are going to be removed soon. 
This documentation snippet will be removed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug manual/26959] __malloc_hook example does not adhere to documented usage
  2020-11-27  8:38 [Bug manual/26959] New: __malloc_hook example does not adhere to documented usage vries at gcc dot gnu.org
  2021-07-14  3:06 ` [Bug manual/26959] " siddhesh at sourceware dot org
@ 2021-07-14  4:15 ` siddhesh at sourceware dot org
  1 sibling, 0 replies; 3+ messages in thread
From: siddhesh at sourceware dot org @ 2021-07-14  4:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26959

Siddhesh Poyarekar <siddhesh at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #2 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
Sorry, forgot to update bug status with my last comment.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-07-14  4:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27  8:38 [Bug manual/26959] New: __malloc_hook example does not adhere to documented usage vries at gcc dot gnu.org
2021-07-14  3:06 ` [Bug manual/26959] " siddhesh at sourceware dot org
2021-07-14  4:15 ` siddhesh at sourceware dot org

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