public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
@ 2011-04-16 15:35 ` clausen at econ dot upenn.edu
2011-04-16 16:03 ` ppluzhnikov at google dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: clausen at econ dot upenn.edu @ 2011-04-16 15:35 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
Andrew Clausen <clausen at econ dot upenn.edu> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |clausen at econ dot
| |upenn.edu
Resolution|INVALID |
--- Comment #3 from Andrew Clausen <clausen at econ dot upenn.edu> 2011-04-16 15:34:58 UTC ---
I agree that this is a real bug. I want to memset(ptr, 0,
malloc_usable_size(ptr)) my memory on free(3), so that my computer forgets all
of my private information. This should work with mcheck() and friends.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
2011-04-16 15:35 ` [Bug libc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0 clausen at econ dot upenn.edu
@ 2011-04-16 16:03 ` ppluzhnikov at google dot com
2012-02-06 14:07 ` aj at suse dot de
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: ppluzhnikov at google dot com @ 2011-04-16 16:03 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
Paul Pluzhnikov <ppluzhnikov at google dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppluzhnikov at google dot
| |com
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
2011-04-16 15:35 ` [Bug libc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0 clausen at econ dot upenn.edu
2011-04-16 16:03 ` ppluzhnikov at google dot com
@ 2012-02-06 14:07 ` aj at suse dot de
2012-02-21 1:21 ` [Bug malloc/1349] " jsm28 at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: aj at suse dot de @ 2012-02-06 14:07 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
Andreas Jaeger <aj at suse dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aj at suse dot de
AssignedTo|gotom at debian dot or.jp |drepper.fsp at gmail dot
| |com
--- Comment #4 from Andreas Jaeger <aj at suse dot de> 2012-02-06 14:06:43 UTC ---
Looking at the documentation of malloc_usable_size, I agree this is a bug in
glibc.
IMO for the snippet in the report, usable should be 7 with MALLOC_CHECK_>0.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug malloc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
` (2 preceding siblings ...)
2012-02-06 14:07 ` aj at suse dot de
@ 2012-02-21 1:21 ` jsm28 at gcc dot gnu.org
2012-05-06 9:04 ` aj at suse dot de
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-02-21 1:21 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
Joseph Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|libc |malloc
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug malloc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
` (3 preceding siblings ...)
2012-02-21 1:21 ` [Bug malloc/1349] " jsm28 at gcc dot gnu.org
@ 2012-05-06 9:04 ` aj at suse dot de
2012-08-30 14:13 ` siddhesh at redhat dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: aj at suse dot de @ 2012-05-06 9:04 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
Andreas Jaeger <aj at suse dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2012-05-06
AssignedTo|drepper.fsp at gmail dot |unassigned at sourceware
|com |dot org
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug malloc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
` (4 preceding siblings ...)
2012-05-06 9:04 ` aj at suse dot de
@ 2012-08-30 14:13 ` siddhesh at redhat dot com
2012-09-05 16:23 ` siddhesh at redhat dot com
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: siddhesh at redhat dot com @ 2012-08-30 14:13 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
Siddhesh Poyarekar <siddhesh at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |siddhesh at redhat dot com
AssignedTo|unassigned at sourceware |siddhesh at redhat dot com
|dot org |
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug malloc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
` (5 preceding siblings ...)
2012-08-30 14:13 ` siddhesh at redhat dot com
@ 2012-09-05 16:23 ` siddhesh at redhat dot com
2014-02-16 17:50 ` jackie.rosen at hushmail dot com
2014-05-28 19:45 ` schwab at sourceware dot org
8 siblings, 0 replies; 11+ messages in thread
From: siddhesh at redhat dot com @ 2012-09-05 16:23 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
Siddhesh Poyarekar <siddhesh at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
--- Comment #5 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2012-09-05 16:22:31 UTC ---
Fixed in master: 6ef9cc37f0ea151a54e5c8a19950a6d5b6ff8a96
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug malloc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
` (6 preceding siblings ...)
2012-09-05 16:23 ` siddhesh at redhat dot com
@ 2014-02-16 17:50 ` jackie.rosen at hushmail dot com
2014-05-28 19:45 ` schwab at sourceware dot org
8 siblings, 0 replies; 11+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 17:50 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=1349
Jackie Rosen <jackie.rosen at hushmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jackie.rosen at hushmail dot com
--- Comment #6 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug malloc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
` (7 preceding siblings ...)
2014-02-16 17:50 ` jackie.rosen at hushmail dot com
@ 2014-05-28 19:45 ` schwab at sourceware dot org
8 siblings, 0 replies; 11+ messages in thread
From: schwab at sourceware dot org @ 2014-05-28 19:45 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=1349
Andreas Schwab <schwab at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|jackie.rosen at hushmail dot com |
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libc/1349] New: malloc_usable_size() incorrect when MALLOC_CHECK_>0
@ 2005-09-17 18:09 jkearney at endeca dot com
2005-09-28 22:46 ` [Bug libc/1349] " drepper at redhat dot com
2005-09-29 1:22 ` jkearney at endeca dot com
0 siblings, 2 replies; 11+ messages in thread
From: jkearney at endeca dot com @ 2005-09-17 18:09 UTC (permalink / raw)
To: glibc-bugs
When MALLOC_CHECK_>0, an extra byte is added to each allocation for checking.
malloc_usable_size() doesn't take this extra byte off the return value in this
case. Try the following with MALLOC_CHECK_=2:
void* p = malloc(7);
size_t usable = malloc_usable_size(p);
memset(p, 0, usable);
p = realloc(p, 7);
--
Summary: malloc_usable_size() incorrect when MALLOC_CHECK_>0
Product: glibc
Version: 2.3.5
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: gotom at debian dot or dot jp
ReportedBy: jkearney at endeca dot com
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
2005-09-17 18:09 [Bug libc/1349] New: " jkearney at endeca dot com
@ 2005-09-28 22:46 ` drepper at redhat dot com
2005-09-29 1:22 ` jkearney at endeca dot com
1 sibling, 0 replies; 11+ messages in thread
From: drepper at redhat dot com @ 2005-09-28 22:46 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From drepper at redhat dot com 2005-09-28 22:45 -------
You are misusing malloc_usable_size(). The function gives you information on
how much memory a really call can provide you in place. It does not
automagically extends the memory block. The realloc call is needed.
Admittedly, the information returned by malloc_usable_size() doesn't take the
magic byte into account and therefore a really call, which would normally be
extended in place, can require a repositioning. But this is no big issue and
not worth changing.
In summary: your test code is wrong and deserves to crash.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0
2005-09-17 18:09 [Bug libc/1349] New: " jkearney at endeca dot com
2005-09-28 22:46 ` [Bug libc/1349] " drepper at redhat dot com
@ 2005-09-29 1:22 ` jkearney at endeca dot com
1 sibling, 0 replies; 11+ messages in thread
From: jkearney at endeca dot com @ 2005-09-29 1:22 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From jkearney at endeca dot com 2005-09-29 01:22 -------
Subject: RE: malloc_usable_size() incorrect when MALLOC_CHECK_>0
Ulrich, I'm not sure that we're communicating here. The comment for malloc_usable_size() says:
Returns the number of bytes you can actually use in
an allocated chunk, which may be more than you requested (although
often not) due to alignment and minimum size constraints.
You can use this many bytes without worrying about
overwriting other allocated objects.
The code sample given conforms to this contract, and works fine when MALLOC_CHECK_=0. When MALLOC_CHECK_ is not 0, the magic byte is overwritten because it is not accounted for. Therefore, *any* operation that checks the magic bytes after the memset() will report an error and/or abort. Change realloc() to free() and the same thing will happen. It has nothing to do with "extension" or "repositioning".
Granted, it's a usage which is not very nice, but I don't think it's "misusing malloc_usable_size()".
-----Original Message-----
From: drepper at redhat dot com
[mailto:sourceware-bugzilla@sourceware.org]
Sent: Wednesday, September 28, 2005 6:46 PM
To: Jim Kearney
Subject: [Bug libc/1349] malloc_usable_size() incorrect when
MALLOC_CHECK_>0
------- Additional Comments From drepper at redhat dot com 2005-09-28 22:45 -------
You are misusing malloc_usable_size(). The function gives you information on
how much memory a really call can provide you in place. It does not
automagically extends the memory block. The realloc call is needed.
Admittedly, the information returned by malloc_usable_size() doesn't take the
magic byte into account and therefore a really call, which would normally be
extended in place, can require a repositioning. But this is no big issue and
not worth changing.
In summary: your test code is wrong and deserves to crash.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
This email message and any attachments are confidential to Endeca. If you are not the intended recipient, please notify Endeca immediately -- by replying to this message or by sending an email to: legal@endeca.com -- and destroy all copies of this message and any attachments. Thank you.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=1349
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-05-28 19:45 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-1349-131@http.sourceware.org/bugzilla/>
2011-04-16 15:35 ` [Bug libc/1349] malloc_usable_size() incorrect when MALLOC_CHECK_>0 clausen at econ dot upenn.edu
2011-04-16 16:03 ` ppluzhnikov at google dot com
2012-02-06 14:07 ` aj at suse dot de
2012-02-21 1:21 ` [Bug malloc/1349] " jsm28 at gcc dot gnu.org
2012-05-06 9:04 ` aj at suse dot de
2012-08-30 14:13 ` siddhesh at redhat dot com
2012-09-05 16:23 ` siddhesh at redhat dot com
2014-02-16 17:50 ` jackie.rosen at hushmail dot com
2014-05-28 19:45 ` schwab at sourceware dot org
2005-09-17 18:09 [Bug libc/1349] New: " jkearney at endeca dot com
2005-09-28 22:46 ` [Bug libc/1349] " drepper at redhat dot com
2005-09-29 1:22 ` jkearney at endeca dot com
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).