[PATCH] Use size_t for mallinfo fields.

classic Classic list List threaded Threaded
39 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Martin Liška
PING^1

On 8/12/20 2:29 PM, Martin Liška wrote:

> On 8/11/20 7:08 PM, DJ Delorie wrote:
>> Florian Weimer <[hidden email]> writes:
>>> DJ, what do you think about this patch?
>>
>> I have no real problems with the patch, but two minor things that could
>> be handled in a follow-up patch...
>
> Thank you for the review.
> Can I read it as ready to go into master?
>
>>
>> 1. The copy code for the old function doesn't handle overflow.  We've
>>     seen bug reports for this before so should consider the edge cases.
>>     IMHO if a size_t value is larger than MAXINT, then MAXINT (or -1)
>>     should be stored instead of a randomly truncated value.
>>
>> 2. The new documentation makes no mention of the older "compatible"
>>     interface.
>>
>
> Both comments are valid to me and I can address them in a follow-up patch.
>
> Martin

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list
Martin Li¡ka <[hidden email]> writes:

> PING^1

LGTM

Reviewed-by: DJ Delorie <[hidden email]>

> On 8/12/20 2:29 PM, Martin Liška wrote:
>> On 8/11/20 7:08 PM, DJ Delorie wrote:
>>> Florian Weimer <[hidden email]> writes:
>>>> DJ, what do you think about this patch?
>>>
>>> I have no real problems with the patch, but two minor things that could
>>> be handled in a follow-up patch...
>>
>> Thank you for the review.
>> Can I read it as ready to go into master?
>>
>>>
>>> 1. The copy code for the old function doesn't handle overflow.  We've
>>>     seen bug reports for this before so should consider the edge cases.
>>>     IMHO if a size_t value is larger than MAXINT, then MAXINT (or -1)
>>>     should be stored instead of a randomly truncated value.
>>>
>>> 2. The new documentation makes no mention of the older "compatible"
>>>     interface.
>>>
>>
>> Both comments are valid to me and I can address them in a follow-up patch.
>>
>> Martin

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list
On Fri, Aug 28, 2020 at 12:06 PM DJ Delorie via Libc-alpha
<[hidden email]> wrote:

>
> Martin Li¡ka <[hidden email]> writes:
>
> > PING^1
>
> LGTM
>
> Reviewed-by: DJ Delorie <[hidden email]>
>
> > On 8/12/20 2:29 PM, Martin Liška wrote:
> >> On 8/11/20 7:08 PM, DJ Delorie wrote:
> >>> Florian Weimer <[hidden email]> writes:
> >>>> DJ, what do you think about this patch?
> >>>
> >>> I have no real problems with the patch, but two minor things that could
> >>> be handled in a follow-up patch...
> >>
> >> Thank you for the review.
> >> Can I read it as ready to go into master?
> >>
> >>>
> >>> 1. The copy code for the old function doesn't handle overflow.  We've
> >>> Â Â Â  seen bug reports for this before so should consider the edge cases.
> >>> Â Â Â  IMHO if a size_t value is larger than MAXINT, then MAXINT (or -1)
> >>> Â Â Â  should be stored instead of a randomly truncated value.
> >>>
> >>> 2. The new documentation makes no mention of the older "compatible"
> >>> Â Â Â  interface.
> >>>
> >>
> >> Both comments are valid to me and I can address them in a follow-up patch.
> >>
> >> Martin
>

$ gcc ../sysdeps/x86_64/multiarch/test-multiarch.c -c -std=gnu11
-fgnu89-inline  -O2 -g -Wall -Wwrite-strings -Wundef -Werror
-fmerge-all-constants -frounding-math -fno-stack-protector
-Wstrict-prototypes -Wold-style-definition -fmath-errno
-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0         -I../include
-I/export/build/gnu/tools-build/glibc/build-x86_64-linux/csu
-I/export/build/gnu/tools-build/glibc/build-x86_64-linux
-I../sysdeps/unix/sysv/linux/x86_64/64
-I../sysdeps/unix/sysv/linux/x86_64
-I../sysdeps/unix/sysv/linux/x86/include
-I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl
-I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/x86_64/nptl
-I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux
-I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu
-I../sysdeps/unix/inet  -I../sysdeps/unix/sysv
-I../sysdeps/unix/x86_64  -I../sysdeps/unix  -I../sysdeps/posix
-I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch
-I../sysdeps/x86_64/fpu  -I../sysdeps/x86/fpu
-I../sysdeps/x86_64/multiarch  -I../sysdeps/x86_64  -I../sysdeps/x86
-I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include
-I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64/wordsize-64
-I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32
-I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic
-I.. -I../libio -I.   -D_LIBC_REENTRANT -include
/export/build/gnu/tools-build/glibc/build-x86_64-linux/libc-modules.h
-DMODULE_NAME=testsuite -include ../include/libc-symbols.h
-DTOP_NAMESPACE=glibc -o
/export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o
-MD -MP -MF /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o.dt
-MT /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o

In file included from ../include/malloc.h:3,
                 from ../sysdeps/x86_64/multiarch/../../../test-skeleton.c:31,
                 from ../sysdeps/x86_64/multiarch/test-multiarch.c:96:
../malloc/malloc.h:118:1: error: empty declaration [-Werror]
  118 | __MALLOC_DEPRECATED;
      | ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

--
H.J.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list


On 31/08/2020 10:35, H.J. Lu via Libc-alpha wrote:

> On Fri, Aug 28, 2020 at 12:06 PM DJ Delorie via Libc-alpha
> <[hidden email]> wrote:
>>
>> Martin Li¡ka <[hidden email]> writes:
>>
>>> PING^1
>>
>> LGTM
>>
>> Reviewed-by: DJ Delorie <[hidden email]>
>>
>>> On 8/12/20 2:29 PM, Martin Liška wrote:
>>>> On 8/11/20 7:08 PM, DJ Delorie wrote:
>>>>> Florian Weimer <[hidden email]> writes:
>>>>>> DJ, what do you think about this patch?
>>>>>
>>>>> I have no real problems with the patch, but two minor things that could
>>>>> be handled in a follow-up patch...
>>>>
>>>> Thank you for the review.
>>>> Can I read it as ready to go into master?
>>>>
>>>>>
>>>>> 1. The copy code for the old function doesn't handle overflow.  We've
>>>>> Â Â Â  seen bug reports for this before so should consider the edge cases.
>>>>> Â Â Â  IMHO if a size_t value is larger than MAXINT, then MAXINT (or -1)
>>>>> Â Â Â  should be stored instead of a randomly truncated value.
>>>>>
>>>>> 2. The new documentation makes no mention of the older "compatible"
>>>>> Â Â Â  interface.
>>>>>
>>>>
>>>> Both comments are valid to me and I can address them in a follow-up patch.
>>>>
>>>> Martin
>>
>
> $ gcc ../sysdeps/x86_64/multiarch/test-multiarch.c -c -std=gnu11
> -fgnu89-inline  -O2 -g -Wall -Wwrite-strings -Wundef -Werror
> -fmerge-all-constants -frounding-math -fno-stack-protector
> -Wstrict-prototypes -Wold-style-definition -fmath-errno
> -fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0         -I../include
> -I/export/build/gnu/tools-build/glibc/build-x86_64-linux/csu
> -I/export/build/gnu/tools-build/glibc/build-x86_64-linux
> -I../sysdeps/unix/sysv/linux/x86_64/64
> -I../sysdeps/unix/sysv/linux/x86_64
> -I../sysdeps/unix/sysv/linux/x86/include
> -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl
> -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/x86_64/nptl
> -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux
> -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu
> -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv
> -I../sysdeps/unix/x86_64  -I../sysdeps/unix  -I../sysdeps/posix
> -I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch
> -I../sysdeps/x86_64/fpu  -I../sysdeps/x86/fpu
> -I../sysdeps/x86_64/multiarch  -I../sysdeps/x86_64  -I../sysdeps/x86
> -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include
> -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64/wordsize-64
> -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32
> -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic
> -I.. -I../libio -I.   -D_LIBC_REENTRANT -include
> /export/build/gnu/tools-build/glibc/build-x86_64-linux/libc-modules.h
> -DMODULE_NAME=testsuite -include ../include/libc-symbols.h
> -DTOP_NAMESPACE=glibc -o
> /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o
> -MD -MP -MF /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o.dt
> -MT /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o
>
> In file included from ../include/malloc.h:3,
>                  from ../sysdeps/x86_64/multiarch/../../../test-skeleton.c:31,
>                  from ../sysdeps/x86_64/multiarch/test-multiarch.c:96:
> ../malloc/malloc.h:118:1: error: empty declaration [-Werror]
>   118 | __MALLOC_DEPRECATED;
>       | ^~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
>

I hit this today as well, I think the straightforward fix is:

diff --git a/malloc/malloc.h b/malloc/malloc.h
index e25b33462a..b2371f7704 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -115,8 +115,7 @@ struct mallinfo2
 };
 
 /* Returns a copy of the updated current mallinfo. */
-__MALLOC_DEPRECATED;
-extern struct mallinfo mallinfo (void) __THROW;
+extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED;
 
 /* Returns a copy of the updated current mallinfo. */
 extern struct mallinfo2 mallinfo2 (void) __THROW;
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list
On Mon, Aug 31, 2020 at 6:57 AM Adhemerval Zanella via Libc-alpha
<[hidden email]> wrote:

>
>
>
> On 31/08/2020 10:35, H.J. Lu via Libc-alpha wrote:
> > On Fri, Aug 28, 2020 at 12:06 PM DJ Delorie via Libc-alpha
> > <[hidden email]> wrote:
> >>
> >> Martin Li¡ka <[hidden email]> writes:
> >>
> >>> PING^1
> >>
> >> LGTM
> >>
> >> Reviewed-by: DJ Delorie <[hidden email]>
> >>
> >>> On 8/12/20 2:29 PM, Martin Liška wrote:
> >>>> On 8/11/20 7:08 PM, DJ Delorie wrote:
> >>>>> Florian Weimer <[hidden email]> writes:
> >>>>>> DJ, what do you think about this patch?
> >>>>>
> >>>>> I have no real problems with the patch, but two minor things that could
> >>>>> be handled in a follow-up patch...
> >>>>
> >>>> Thank you for the review.
> >>>> Can I read it as ready to go into master?
> >>>>
> >>>>>
> >>>>> 1. The copy code for the old function doesn't handle overflow.  We've
> >>>>> Â Â Â  seen bug reports for this before so should consider the edge cases.
> >>>>> Â Â Â  IMHO if a size_t value is larger than MAXINT, then MAXINT (or -1)
> >>>>> Â Â Â  should be stored instead of a randomly truncated value.
> >>>>>
> >>>>> 2. The new documentation makes no mention of the older "compatible"
> >>>>> Â Â Â  interface.
> >>>>>
> >>>>
> >>>> Both comments are valid to me and I can address them in a follow-up patch.
> >>>>
> >>>> Martin
> >>
> >
> > $ gcc ../sysdeps/x86_64/multiarch/test-multiarch.c -c -std=gnu11
> > -fgnu89-inline  -O2 -g -Wall -Wwrite-strings -Wundef -Werror
> > -fmerge-all-constants -frounding-math -fno-stack-protector
> > -Wstrict-prototypes -Wold-style-definition -fmath-errno
> > -fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0         -I../include
> > -I/export/build/gnu/tools-build/glibc/build-x86_64-linux/csu
> > -I/export/build/gnu/tools-build/glibc/build-x86_64-linux
> > -I../sysdeps/unix/sysv/linux/x86_64/64
> > -I../sysdeps/unix/sysv/linux/x86_64
> > -I../sysdeps/unix/sysv/linux/x86/include
> > -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl
> > -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/x86_64/nptl
> > -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux
> > -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu
> > -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv
> > -I../sysdeps/unix/x86_64  -I../sysdeps/unix  -I../sysdeps/posix
> > -I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch
> > -I../sysdeps/x86_64/fpu  -I../sysdeps/x86/fpu
> > -I../sysdeps/x86_64/multiarch  -I../sysdeps/x86_64  -I../sysdeps/x86
> > -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include
> > -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64/wordsize-64
> > -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32
> > -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic
> > -I.. -I../libio -I.   -D_LIBC_REENTRANT -include
> > /export/build/gnu/tools-build/glibc/build-x86_64-linux/libc-modules.h
> > -DMODULE_NAME=testsuite -include ../include/libc-symbols.h
> > -DTOP_NAMESPACE=glibc -o
> > /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o
> > -MD -MP -MF /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o.dt
> > -MT /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o
> >
> > In file included from ../include/malloc.h:3,
> >                  from ../sysdeps/x86_64/multiarch/../../../test-skeleton.c:31,
> >                  from ../sysdeps/x86_64/multiarch/test-multiarch.c:96:
> > ../malloc/malloc.h:118:1: error: empty declaration [-Werror]
> >   118 | __MALLOC_DEPRECATED;
> >       | ^~~~~~~~~~~~~~~~~~~
> > cc1: all warnings being treated as errors
> >
>
> I hit this today as well, I think the straightforward fix is:
>
> diff --git a/malloc/malloc.h b/malloc/malloc.h
> index e25b33462a..b2371f7704 100644
> --- a/malloc/malloc.h
> +++ b/malloc/malloc.h
> @@ -115,8 +115,7 @@ struct mallinfo2
>  };
>
>  /* Returns a copy of the updated current mallinfo. */
> -__MALLOC_DEPRECATED;
> -extern struct mallinfo mallinfo (void) __THROW;
> +extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED;
>
>  /* Returns a copy of the updated current mallinfo. */
>  extern struct mallinfo2 mallinfo2 (void) __THROW;

LGTM.

Thanks.

--
H.J.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list


On 31/08/2020 11:00, H.J. Lu wrote:

> On Mon, Aug 31, 2020 at 6:57 AM Adhemerval Zanella via Libc-alpha
> <[hidden email]> wrote:
>>
>>
>>
>> On 31/08/2020 10:35, H.J. Lu via Libc-alpha wrote:
>>> On Fri, Aug 28, 2020 at 12:06 PM DJ Delorie via Libc-alpha
>>> <[hidden email]> wrote:
>>>>
>>>> Martin Li¡ka <[hidden email]> writes:
>>>>
>>>>> PING^1
>>>>
>>>> LGTM
>>>>
>>>> Reviewed-by: DJ Delorie <[hidden email]>
>>>>
>>>>> On 8/12/20 2:29 PM, Martin Liška wrote:
>>>>>> On 8/11/20 7:08 PM, DJ Delorie wrote:
>>>>>>> Florian Weimer <[hidden email]> writes:
>>>>>>>> DJ, what do you think about this patch?
>>>>>>>
>>>>>>> I have no real problems with the patch, but two minor things that could
>>>>>>> be handled in a follow-up patch...
>>>>>>
>>>>>> Thank you for the review.
>>>>>> Can I read it as ready to go into master?
>>>>>>
>>>>>>>
>>>>>>> 1. The copy code for the old function doesn't handle overflow.  We've
>>>>>>> Â Â Â  seen bug reports for this before so should consider the edge cases.
>>>>>>> Â Â Â  IMHO if a size_t value is larger than MAXINT, then MAXINT (or -1)
>>>>>>> Â Â Â  should be stored instead of a randomly truncated value.
>>>>>>>
>>>>>>> 2. The new documentation makes no mention of the older "compatible"
>>>>>>> Â Â Â  interface.
>>>>>>>
>>>>>>
>>>>>> Both comments are valid to me and I can address them in a follow-up patch.
>>>>>>
>>>>>> Martin
>>>>
>>>
>>> $ gcc ../sysdeps/x86_64/multiarch/test-multiarch.c -c -std=gnu11
>>> -fgnu89-inline  -O2 -g -Wall -Wwrite-strings -Wundef -Werror
>>> -fmerge-all-constants -frounding-math -fno-stack-protector
>>> -Wstrict-prototypes -Wold-style-definition -fmath-errno
>>> -fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0         -I../include
>>> -I/export/build/gnu/tools-build/glibc/build-x86_64-linux/csu
>>> -I/export/build/gnu/tools-build/glibc/build-x86_64-linux
>>> -I../sysdeps/unix/sysv/linux/x86_64/64
>>> -I../sysdeps/unix/sysv/linux/x86_64
>>> -I../sysdeps/unix/sysv/linux/x86/include
>>> -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl
>>> -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/x86_64/nptl
>>> -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux
>>> -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu
>>> -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv
>>> -I../sysdeps/unix/x86_64  -I../sysdeps/unix  -I../sysdeps/posix
>>> -I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch
>>> -I../sysdeps/x86_64/fpu  -I../sysdeps/x86/fpu
>>> -I../sysdeps/x86_64/multiarch  -I../sysdeps/x86_64  -I../sysdeps/x86
>>> -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include
>>> -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64/wordsize-64
>>> -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32
>>> -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic
>>> -I.. -I../libio -I.   -D_LIBC_REENTRANT -include
>>> /export/build/gnu/tools-build/glibc/build-x86_64-linux/libc-modules.h
>>> -DMODULE_NAME=testsuite -include ../include/libc-symbols.h
>>> -DTOP_NAMESPACE=glibc -o
>>> /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o
>>> -MD -MP -MF /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o.dt
>>> -MT /export/build/gnu/tools-build/glibc/build-x86_64-linux/csu/test-multiarch.o
>>>
>>> In file included from ../include/malloc.h:3,
>>>                  from ../sysdeps/x86_64/multiarch/../../../test-skeleton.c:31,
>>>                  from ../sysdeps/x86_64/multiarch/test-multiarch.c:96:
>>> ../malloc/malloc.h:118:1: error: empty declaration [-Werror]
>>>   118 | __MALLOC_DEPRECATED;
>>>       | ^~~~~~~~~~~~~~~~~~~
>>> cc1: all warnings being treated as errors
>>>
>>
>> I hit this today as well, I think the straightforward fix is:
>>
>> diff --git a/malloc/malloc.h b/malloc/malloc.h
>> index e25b33462a..b2371f7704 100644
>> --- a/malloc/malloc.h
>> +++ b/malloc/malloc.h
>> @@ -115,8 +115,7 @@ struct mallinfo2
>>  };
>>
>>  /* Returns a copy of the updated current mallinfo. */
>> -__MALLOC_DEPRECATED;
>> -extern struct mallinfo mallinfo (void) __THROW;
>> +extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED;
>>
>>  /* Returns a copy of the updated current mallinfo. */
>>  extern struct mallinfo2 mallinfo2 (void) __THROW;
>
> LGTM.

In fact we need to additionally handle on the tests to avoid the warning
errors.  The full patch is:

---

diff --git a/malloc/malloc.h b/malloc/malloc.h
index e25b33462a..b2371f7704 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -115,8 +115,7 @@ struct mallinfo2
 };
 
 /* Returns a copy of the updated current mallinfo. */
-__MALLOC_DEPRECATED;
-extern struct mallinfo mallinfo (void) __THROW;
+extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED;
 
 /* Returns a copy of the updated current mallinfo. */
 extern struct mallinfo2 mallinfo2 (void) __THROW;
diff --git a/malloc/tst-malloc-tcache-leak.c b/malloc/tst-malloc-tcache-leak.c
index f6f6023b5a..2a7a0646c5 100644
--- a/malloc/tst-malloc-tcache-leak.c
+++ b/malloc/tst-malloc-tcache-leak.c
@@ -29,6 +29,7 @@
 #include <malloc.h>
 #include <pthread.h>
 #include <assert.h>
+#include <libc-diag.h>
 
 #include <support/check.h>
 #include <support/support.h>
@@ -72,6 +73,10 @@ do_test (void)
      pthread_t required to run the test.  */
   thread = (pthread_t *) xcalloc (1, sizeof (pthread_t));
 
+  /* The test below covers the deprecated mallinfo function.  */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
   info_before = mallinfo ();
 
   assert (info_before.uordblks != 0);
@@ -104,6 +109,8 @@ do_test (void)
   if (info_after.uordblks > (info_before.uordblks + threads))
     FAIL_EXIT1 ("Memory usage after threads is too high.\n");
 
+  DIAG_POP_NEEDS_COMMENT;
+
   /* Did not detect excessive memory usage.  */
   free (thread);
   exit (0);
diff --git a/malloc/tst-mxfast.c b/malloc/tst-mxfast.c
index 57b4a0a8dc..8afee0f9d5 100644
--- a/malloc/tst-mxfast.c
+++ b/malloc/tst-mxfast.c
@@ -21,6 +21,7 @@
    the fast bins.  */
 
 #include <malloc.h>
+#include <libc-diag.h>
 #include <support/check.h>
 
 int
@@ -36,8 +37,14 @@ do_test (void)
   p2 = malloc (512);
   free (p1);
 
+  /* The test below covers the deprecated mallinfo function.  */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
   m = mallinfo ();
 
+  DIAG_POP_NEEDS_COMMENT;
+
   /* This will fail if there are any blocks in the fastbins.  */
   TEST_COMPARE (m.smblks, 0);
 
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Joseph Myers
In reply to this post by Sourceware - libc-alpha mailing list
There are several key pieces missing from the mallinfo2 commit.

* mallinfo2 is not added to GLIBC_2.33 in malloc/Versions.  So it's not
exported from shared glibc, so it can't actually be used at all.

* Once a function is exported from shared libc, all the ABI test baselines
need updating accordingly.

* Any new function needs a testcase added to the testsuite.  If there were
such a test, it would have shown up the first problem of the function not
being exported (that's why there should be tests even for e.g. syscall
wrappers for syscalls that don't do anything useful as non-root - simply
testing that it's possible to compile and link a call to each public
function is useful).

* Any new function should be mentioned as a new feature in the NEWS file.

* Any deprecation should be listed under "Deprecated and removed features,
and other changes affecting compatibility:" in the NEWS file.

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Martin Liška
On 9/1/20 7:26 PM, Joseph Myers wrote:

> There are several key pieces missing from the mallinfo2 commit.
>
> * mallinfo2 is not added to GLIBC_2.33 in malloc/Versions.  So it's not
> exported from shared glibc, so it can't actually be used at all.
>
> * Once a function is exported from shared libc, all the ABI test baselines
> need updating accordingly.
>
> * Any new function needs a testcase added to the testsuite.  If there were
> such a test, it would have shown up the first problem of the function not
> being exported (that's why there should be tests even for e.g. syscall
> wrappers for syscalls that don't do anything useful as non-root - simply
> testing that it's possible to compile and link a call to each public
> function is useful).
>
> * Any new function should be mentioned as a new feature in the NEWS file.
>
> * Any deprecation should be listed under "Deprecated and removed features,
> and other changes affecting compatibility:" in the NEWS file.
>
Hello.

Thank you for the hints Joseph. There's patch that survives regression tests.

Martin

0001-mallinfo2-add-missing-bits.patch (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list


On 02/09/2020 10:19, Martin Liška wrote:

> On 9/1/20 7:26 PM, Joseph Myers wrote:
>> There are several key pieces missing from the mallinfo2 commit.
>>
>> * mallinfo2 is not added to GLIBC_2.33 in malloc/Versions.  So it's not
>> exported from shared glibc, so it can't actually be used at all.
>>
>> * Once a function is exported from shared libc, all the ABI test baselines
>> need updating accordingly.
>>
>> * Any new function needs a testcase added to the testsuite.  If there were
>> such a test, it would have shown up the first problem of the function not
>> being exported (that's why there should be tests even for e.g. syscall
>> wrappers for syscalls that don't do anything useful as non-root - simply
>> testing that it's possible to compile and link a call to each public
>> function is useful).
>>
>> * Any new function should be mentioned as a new feature in the NEWS file.
>>
>> * Any deprecation should be listed under "Deprecated and removed features,
>> and other changes affecting compatibility:" in the NEWS file.
>>
>
> Hello.
>
> Thank you for the hints Joseph. There's patch that survives regression tests.
>
> Martin> From 18528c416f23be7dafe4a9bf631c91b6cbb3e0cb Mon Sep 17 00:00:00 2001
> From: Martin Liska <[hidden email]>
> Date: Wed, 2 Sep 2020 15:17:25 +0200
> Subject: [PATCH] mallinfo2: add missing bits
>
> The patch adds the function to Versions and both tests
> now test the function. The function is also mentioned in NEWS.

You still need to run 'make update-abi' for each supported architecture
and ABI variations to update each libc.abilist.  And the missing symbol in
the libc.abilist should have raised a failure in the make check.

> ---
>  NEWS                            |  5 ++++-
>  malloc/Versions                 |  3 +++
>  malloc/tst-malloc-tcache-leak.c | 17 +++++------------
>  malloc/tst-mxfast.c             | 12 ++----------
>  4 files changed, 14 insertions(+), 23 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index 06e43e0453..b21e5244ab 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -20,9 +20,12 @@ Major new features:
>    The 32-bit RISC-V port requires at least Linux 5.4, GCC 7.1 and binutils
>    2.28.
>  
> +* A new function mallinfo2 (replaces mallinfo) uses size_t for values returned
> +  in mallinfo2 struct.
> +
>  Deprecated and removed features, and other changes affecting compatibility:
>  
> -  [Add deprecations, removals and changes affecting compatibility here]
> +* Function mallinfo is deprecated.
>  
>  Changes to build and runtime requirements:
>  
> diff --git a/malloc/Versions b/malloc/Versions
> index 2357cff3da..94c8ba8040 100644
> --- a/malloc/Versions
> +++ b/malloc/Versions
> @@ -64,6 +64,9 @@ libc {
>    GLIBC_2.26 {
>      reallocarray;
>    }
> +  GLIBC_2.33 {
> +    mallinfo2;
> +  }
>    GLIBC_PRIVATE {
>      # Internal startup hook for libpthread.
>      __libc_malloc_pthread_startup;
> diff --git a/malloc/tst-malloc-tcache-leak.c b/malloc/tst-malloc-tcache-leak.c
> index 2a7a0646c5..ae5e1fd252 100644
> --- a/malloc/tst-malloc-tcache-leak.c
> +++ b/malloc/tst-malloc-tcache-leak.c
> @@ -29,7 +29,6 @@
>  #include <malloc.h>
>  #include <pthread.h>
>  #include <assert.h>
> -#include <libc-diag.h>
>  
>  #include <support/check.h>
>  #include <support/support.h>
> @@ -61,7 +60,7 @@ static int
>  do_test (void)
>  {
>    pthread_t *thread;
> -  struct mallinfo info_before, info_after;
> +  struct mallinfo2 info_before, info_after;
>    void *retval;
>  
>    /* This is an arbitrary choice. We choose a total of THREADS
> @@ -73,15 +72,11 @@ do_test (void)
>       pthread_t required to run the test.  */
>    thread = (pthread_t *) xcalloc (1, sizeof (pthread_t));
>  
> -  /* The test below covers the deprecated mallinfo function.  */
> -  DIAG_PUSH_NEEDS_COMMENT;
> -  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
> -
> -  info_before = mallinfo ();
> +  info_before = mallinfo2 ();
>  
>    assert (info_before.uordblks != 0);
>  
> -  printf ("INFO: %d (bytes) are in use before starting threads.\n",
> +  printf ("INFO: %ld (bytes) are in use before starting threads.\n",
>            info_before.uordblks);
>  
>    for (int loop = 0; loop < threads; loop++)

I think should be '%zu' since uordblks is a size_t.

> @@ -91,8 +86,8 @@ do_test (void)
>        free (retval);
>      }
>  
> -  info_after = mallinfo ();
> -  printf ("INFO: %d (bytes) are in use after all threads joined.\n",
> +  info_after = mallinfo2 ();
> +  printf ("INFO: %ld (bytes) are in use after all threads joined.\n",
>            info_after.uordblks);
>  
>    /* We need to compare the memory in use before and the memory in use

Same as before.

> @@ -109,8 +104,6 @@ do_test (void)
>    if (info_after.uordblks > (info_before.uordblks + threads))
>      FAIL_EXIT1 ("Memory usage after threads is too high.\n");
>  
> -  DIAG_POP_NEEDS_COMMENT;
> -
>    /* Did not detect excessive memory usage.  */
>    free (thread);
>    exit (0);
> diff --git a/malloc/tst-mxfast.c b/malloc/tst-mxfast.c
> index 8afee0f9d5..0a41e1112c 100644
> --- a/malloc/tst-mxfast.c
> +++ b/malloc/tst-mxfast.c
> @@ -21,13 +21,12 @@
>     the fast bins.  */
>  
>  #include <malloc.h>
> -#include <libc-diag.h>
>  #include <support/check.h>
>  
>  int
>  do_test (void)
>  {
> -  struct mallinfo m;
> +  struct mallinfo2 m;
>    char *volatile p1;
>    char *volatile p2;
>  
> @@ -37,14 +36,7 @@ do_test (void)
>    p2 = malloc (512);
>    free (p1);
>  
> -  /* The test below covers the deprecated mallinfo function.  */
> -  DIAG_PUSH_NEEDS_COMMENT;
> -  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
> -
> -  m = mallinfo ();
> -
> -  DIAG_POP_NEEDS_COMMENT;
> -
> +  m = mallinfo2 ();
>    /* This will fail if there are any blocks in the fastbins.  */
>    TEST_COMPARE (m.smblks, 0);
>  
> --
> 2.28.0
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list
In reply to this post by Martin Liška
On 9/2/20 9:19 AM, Martin Liška wrote:

> On 9/1/20 7:26 PM, Joseph Myers wrote:
>> There are several key pieces missing from the mallinfo2 commit.
>>
>> * mallinfo2 is not added to GLIBC_2.33 in malloc/Versions.  So it's not
>> exported from shared glibc, so it can't actually be used at all.
>>
>> * Once a function is exported from shared libc, all the ABI test baselines
>> need updating accordingly.
>>
>> * Any new function needs a testcase added to the testsuite.  If there were
>> such a test, it would have shown up the first problem of the function not
>> being exported (that's why there should be tests even for e.g. syscall
>> wrappers for syscalls that don't do anything useful as non-root - simply
>> testing that it's possible to compile and link a call to each public
>> function is useful).
>>
>> * Any new function should be mentioned as a new feature in the NEWS file.
>>
>> * Any deprecation should be listed under "Deprecated and removed features,
>> and other changes affecting compatibility:" in the NEWS file.
>>
>
> Hello.
>
> Thank you for the hints Joseph. There's patch that survives regression tests.
>
> Martin
> From 18528c416f23be7dafe4a9bf631c91b6cbb3e0cb Mon Sep 17 00:00:00 2001
> From: Martin Liska <[hidden email]>
> Date: Wed, 2 Sep 2020 15:17:25 +0200
> Subject: [PATCH] mallinfo2: add missing bits
>
> The patch adds the function to Versions and both tests
> now test the function. The function is also mentioned in NEWS.
> ---
>  NEWS                            |  5 ++++-
>  malloc/Versions                 |  3 +++
>  malloc/tst-malloc-tcache-leak.c | 17 +++++------------
>  malloc/tst-mxfast.c             | 12 ++----------
>  4 files changed, 14 insertions(+), 23 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index 06e43e0453..b21e5244ab 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -20,9 +20,12 @@ Major new features:
>    The 32-bit RISC-V port requires at least Linux 5.4, GCC 7.1 and binutils
>    2.28.
>  
> +* A new function mallinfo2 (replaces mallinfo) uses size_t for values returned
> +  in mallinfo2 struct.
> +
>  Deprecated and removed features, and other changes affecting compatibility:
>  
> -  [Add deprecations, removals and changes affecting compatibility here]
> +* Function mallinfo is deprecated.
>  
>  Changes to build and runtime requirements:
>  
> diff --git a/malloc/Versions b/malloc/Versions
> index 2357cff3da..94c8ba8040 100644
> --- a/malloc/Versions
> +++ b/malloc/Versions
> @@ -64,6 +64,9 @@ libc {
>    GLIBC_2.26 {
>      reallocarray;
>    }
> +  GLIBC_2.33 {
> +    mallinfo2;
> +  }
>    GLIBC_PRIVATE {
>      # Internal startup hook for libpthread.
>      __libc_malloc_pthread_startup;
> diff --git a/malloc/tst-malloc-tcache-leak.c b/malloc/tst-malloc-tcache-leak.c
> index 2a7a0646c5..ae5e1fd252 100644
> --- a/malloc/tst-malloc-tcache-leak.c
> +++ b/malloc/tst-malloc-tcache-leak.c
> @@ -29,7 +29,6 @@
>  #include <malloc.h>
>  #include <pthread.h>
>  #include <assert.h>
> -#include <libc-diag.h>
>  
>  #include <support/check.h>
>  #include <support/support.h>
> @@ -61,7 +60,7 @@ static int
>  do_test (void)
>  {
>    pthread_t *thread;
> -  struct mallinfo info_before, info_after;
> +  struct mallinfo2 info_before, info_after;
>    void *retval;
>  
>    /* This is an arbitrary choice. We choose a total of THREADS
> @@ -73,15 +72,11 @@ do_test (void)
>       pthread_t required to run the test.  */
>    thread = (pthread_t *) xcalloc (1, sizeof (pthread_t));
>  
> -  /* The test below covers the deprecated mallinfo function.  */
> -  DIAG_PUSH_NEEDS_COMMENT;
> -  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
> -
> -  info_before = mallinfo ();
> +  info_before = mallinfo2 ();
>  
>    assert (info_before.uordblks != 0);
>  
> -  printf ("INFO: %d (bytes) are in use before starting threads.\n",
> +  printf ("INFO: %ld (bytes) are in use before starting threads.\n",
>            info_before.uordblks);
>  
>    for (int loop = 0; loop < threads; loop++)
> @@ -91,8 +86,8 @@ do_test (void)
>        free (retval);
>      }
>  
> -  info_after = mallinfo ();
> -  printf ("INFO: %d (bytes) are in use after all threads joined.\n",
> +  info_after = mallinfo2 ();
> +  printf ("INFO: %ld (bytes) are in use after all threads joined.\n",
>            info_after.uordblks);
>  
>    /* We need to compare the memory in use before and the memory in use
> @@ -109,8 +104,6 @@ do_test (void)
>    if (info_after.uordblks > (info_before.uordblks + threads))
>      FAIL_EXIT1 ("Memory usage after threads is too high.\n");
>  
> -  DIAG_POP_NEEDS_COMMENT;
> -
>    /* Did not detect excessive memory usage.  */
>    free (thread);
>    exit (0);
> diff --git a/malloc/tst-mxfast.c b/malloc/tst-mxfast.c
> index 8afee0f9d5..0a41e1112c 100644
> --- a/malloc/tst-mxfast.c
> +++ b/malloc/tst-mxfast.c
> @@ -21,13 +21,12 @@
>     the fast bins.  */
>  
>  #include <malloc.h>
> -#include <libc-diag.h>
>  #include <support/check.h>
>  
>  int
>  do_test (void)
>  {
> -  struct mallinfo m;
> +  struct mallinfo2 m;
>    char *volatile p1;
>    char *volatile p2;
>  
> @@ -37,14 +36,7 @@ do_test (void)
>    p2 = malloc (512);
>    free (p1);
>  
> -  /* The test below covers the deprecated mallinfo function.  */
> -  DIAG_PUSH_NEEDS_COMMENT;
> -  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
> -
> -  m = mallinfo ();
> -
> -  DIAG_POP_NEEDS_COMMENT;
> -
> +  m = mallinfo2 ();

Why are we removing testing for mallinfo?

We need to continue to test old interfaces.

If we add a new function we need a new test that exercise the new
function and the differences.

>    /* This will fail if there are any blocks in the fastbins.  */
>    TEST_COMPARE (m.smblks, 0);
>  
> --
> 2.28.0
>


--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list
In reply to this post by Martin Liška
Martin Li¡ka <[hidden email]> writes:
> Thank you for the hints Joseph. There's patch that survives regression tests.

As others have noted, getting this right is more complicated that you'd
think.  I'm in the middle of debugging the ABI list changes and will
likely have to refactor the mallinfo2 code to get it right, so don't
worry about this one, I'll take care of it ;-)

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list
In reply to this post by Joseph Myers
Joseph Myers <[hidden email]> writes:
> There are several key pieces missing from the mallinfo2 commit.

How's this?  The mallinfo ABI included __libc_mallinfo but I see no
reason to export a __libc_mallinfo2, which meant factoring out the code
that __libc_mallinfo was calling (else you get abi/plt test failures).

From 84e49946aa58e30b3cd676b5847b49527792a9ff Mon Sep 17 00:00:00 2001
From: DJ Delorie <[hidden email]>
Date: Tue, 1 Sep 2020 16:17:25 -0400
Subject: Update mallinfo2 ABI, and test

This patch adds the ABI-related bits to reflect the new mallinfo2
function, and adds a test case to verify basic functionality.

diff --git a/NEWS b/NEWS
index 06e43e0453..b0c720daaa 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ Version 2.33
 
 Major new features:
 
+* The mallinfo2() function is added to report statistics as per
+  mallinfo(), but with larger field widths to accurately report values
+  that are larger than fit in an integer.
 
 * Support for the RISC-V ISA running on Linux has been expanded to run on
   32-bit hardware.  This is supported for the following ISA and ABI pairs:
@@ -22,7 +25,8 @@ Major new features:
 
 Deprecated and removed features, and other changes affecting compatibility:
 
-  [Add deprecations, removals and changes affecting compatibility here]
+* The mallinfo function is marked deprecated.  Callers should call
+  mallinfo2 instead.
 
 Changes to build and runtime requirements:
 
diff --git a/malloc/Makefile b/malloc/Makefile
index e22cbde22d..09ae63bee5 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -35,7 +35,7 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
  tst-interpose-thread \
  tst-alloc_buffer \
  tst-malloc-tcache-leak \
- tst-malloc_info \
+ tst-malloc_info tst-mallinfo2 \
  tst-malloc-too-large \
  tst-malloc-stats-cancellation \
  tst-tcfree1 tst-tcfree2 tst-tcfree3 \
diff --git a/malloc/Versions b/malloc/Versions
index 2357cff3da..a0d991bdb7 100644
--- a/malloc/Versions
+++ b/malloc/Versions
@@ -64,6 +64,9 @@ libc {
   GLIBC_2.26 {
     reallocarray;
   }
+  GLIBC_2.33 {
+    mallinfo2;
+  }
   GLIBC_PRIVATE {
     # Internal startup hook for libpthread.
     __libc_malloc_pthread_startup;
@@ -92,5 +95,8 @@ libc {
     __libc_alloc_buffer_copy_bytes;
     __libc_alloc_buffer_copy_string;
     __libc_alloc_buffer_create_failure;
+
+    # Internal name for mallinfo2
+    __libc_mallinfo2;
   }
 }
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 560fee2c31..e52d3594ec 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4975,9 +4975,8 @@ int_mallinfo (mstate av, struct mallinfo2 *m)
     }
 }
 
-
-struct mallinfo2
-__libc_mallinfo2 (void)
+static struct mallinfo2
+__libc_mallinfo2_common (void)
 {
   struct mallinfo2 m;
   mstate ar_ptr;
@@ -5000,11 +4999,17 @@ __libc_mallinfo2 (void)
   return m;
 }
 
+struct mallinfo2
+__libc_mallinfo2 (void)
+{
+  return __libc_mallinfo2_common ();
+}
+
 struct mallinfo
 __libc_mallinfo (void)
 {
   struct mallinfo m;
-  struct mallinfo2 m2 = __libc_mallinfo2 ();
+  struct mallinfo2 m2 = __libc_mallinfo2_common ();
 
   m.arena = m2.arena;
   m.ordblks = m2.ordblks;
diff --git a/malloc/tst-mallinfo2.c b/malloc/tst-mallinfo2.c
new file mode 100644
index 0000000000..c98c814c74
--- /dev/null
+++ b/malloc/tst-mallinfo2.c
@@ -0,0 +1,83 @@
+/* Smoke test for mallinfo2
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* Test that mallinfo2 is properly exported and basically works.  */
+
+#include <array_length.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <support/check.h>
+
+/* This is not specifically needed for the test, but (1) does
+   something to the data so gcc doesn't optimize it away, and (2) may
+   help when developing future tests.  */
+static void
+print_mi (const char *msg, struct mallinfo2 *m)
+{
+  printf("\n%s...\n", msg);
+#define P(f) printf("%s: %ld\n", #f, (long) m->f);
+  P(arena);
+  P(ordblks);
+  P(smblks);
+  P(hblks);
+  P(hblkhd);
+  P(usmblks);
+  P(fsmblks);
+  P(uordblks);
+  P(fordblks);
+  P(keepcost);
+}
+
+/* We do this to force the call to malloc to not be optimized
+   away.  */
+volatile void *ptr;
+
+static int
+do_test (void)
+{
+  struct mallinfo2 mi1, mi2;
+  int i;
+  size_t total = 0;
+
+  /* This is the key difference between mallinfo() and mallinfo2().
+     It may be a false positive if int and size_t are the same
+     size.  */
+  TEST_VERIFY (sizeof (mi1.arena) == sizeof (size_t));
+
+  mi1 = mallinfo2 ();
+  print_mi ("before", &mi1);
+
+  /* Allocations that are meaningful-sized but not so large as to be
+     mmapped, so that they're all accounted for in the field we test
+     below.  */
+  for (i=1; i<20; i++)
+    {
+      ptr = malloc (160 * i);
+      total += 16 * i;
+    }
+
+  mi2 = mallinfo2 ();
+  print_mi ("after", &mi2);
+
+  /* Check at least something changed.  */
+  TEST_VERIFY (mi2.uordblks > mi1.uordblks + total);
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 72537218ba..109838775c 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2191,6 +2191,7 @@ GLIBC_2.32 thrd_current F
 GLIBC_2.32 thrd_equal F
 GLIBC_2.32 thrd_sleep F
 GLIBC_2.32 thrd_yield F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 6cd61988b4..bc375ecb8d 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2160,3 +2160,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 8edb5deea1..f8f50f87b0 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2242,6 +2242,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index df13f49e15..146ca85cc8 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -1920,3 +1920,4 @@ GLIBC_2.32 wprintf F
 GLIBC_2.32 write F
 GLIBC_2.32 writev F
 GLIBC_2.32 wscanf F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 7f4a146d22..48b2240b88 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -144,6 +144,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index a83cc81958..1d5c482c89 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -141,6 +141,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 32887b1c58..a93d48f7ea 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2104,3 +2104,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index baf425072b..7e265ef570 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2063,6 +2063,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 8b0242a9b1..d80285427a 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2229,6 +2229,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index b6ba86dbe9..6619fe4b31 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2095,6 +2095,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index e1f7e19de9..56b651998c 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -145,6 +145,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0x98
 GLIBC_2.4 _IO_2_1_stdin_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 2d726097ca..ad200c9f63 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2175,6 +2175,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 7c78649e03..f91a744ce2 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2155,3 +2155,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index da2194b498..c5e86ddb4d 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2152,3 +2152,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 9fa655b3a5..f71c242463 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2146,6 +2146,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 3f6da71769..7854bdc5fc 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2144,6 +2144,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index de990933cf..f590577194 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2152,6 +2152,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 754491f209..8518b7fe2f 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2146,6 +2146,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 36a875115c..1d6bc7018d 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2193,3 +2193,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 6de9bed51d..2925850690 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2202,6 +2202,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 5c8c58974c..3c816ec48f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2235,6 +2235,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 92114806ac..376057d86d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2065,6 +2065,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index b01fdcfae1..e69191b82a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2355,3 +2355,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
index 3bea073169..2aad26a91c 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
@@ -1168,6 +1168,7 @@ GLIBC_2.33 lutimes F
 GLIBC_2.33 madvise F
 GLIBC_2.33 makecontext F
 GLIBC_2.33 mallinfo F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.33 malloc F
 GLIBC_2.33 malloc_info F
 GLIBC_2.33 malloc_stats F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 45cbeb1d98..04bc7b1e6f 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2122,3 +2122,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index d0752dba6c..2940f787ae 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2200,6 +2200,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index af5f14d1c6..e9d2023b8c 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2101,6 +2101,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index 038ce27174..d98ef4f519 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2070,6 +2070,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index 182970a708..8c8507ec14 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2067,6 +2067,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index a2521c3ee3..b4274d4fa4 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2191,6 +2191,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index d8188903f9..a683b0af97 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2118,6 +2118,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 1a96103c68..c360212e8d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2076,6 +2076,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 35745a75b6..e6d064cac7 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2173,3 +2173,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Florian Weimer
* DJ Delorie:

> diff --git a/malloc/Versions b/malloc/Versions
> index 2357cff3da..a0d991bdb7 100644
> --- a/malloc/Versions
> +++ b/malloc/Versions
> @@ -64,6 +64,9 @@ libc {
>    GLIBC_2.26 {
>      reallocarray;
>    }
> +  GLIBC_2.33 {
> +    mallinfo2;
> +  }
>    GLIBC_PRIVATE {
>      # Internal startup hook for libpthread.
>      __libc_malloc_pthread_startup;
> @@ -92,5 +95,8 @@ libc {
>      __libc_alloc_buffer_copy_bytes;
>      __libc_alloc_buffer_copy_string;
>      __libc_alloc_buffer_create_failure;
> +
> +    # Internal name for mallinfo2
> +    __libc_mallinfo2;
>    }
>  }

I don't think this is needed, and neither is the new static _common
function.

The usual way of solving this case (internal interface in libc.so.6
using a public interface interface not in ISO C) goes like this:

Come up with an internal name (__libc_mallinfo2 is fine).

Add an declaration (often with __typeof) and libc_hidden_proto to the
wrapper header under include/.

Use the internal name to define the function, followed by
libc_hidden_def.  Together with libc_hidden_proto, this ensures PLT
avoidance for internal calls.

Add a weak_alias for the public name.  This makes sure that
applications can define their own function of the public name and
still use symbols from the same file (malloc in this case), without
getting multiple definitions.

Add the Versions entry under GLIBC_PRIVATE if there are internal users
in other DSOs (quoted above, not applicable in this case).
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Joseph Myers
In reply to this post by Sourceware - libc-alpha mailing list
On Wed, 2 Sep 2020, DJ Delorie via Libc-alpha wrote:

> Joseph Myers <[hidden email]> writes:
> > There are several key pieces missing from the mallinfo2 commit.
>
> How's this?  The mallinfo ABI included __libc_mallinfo but I see no
> reason to export a __libc_mallinfo2, which meant factoring out the code
> that __libc_mallinfo was calling (else you get abi/plt test failures).

This includes the pieces I'd expect (I haven't tried to review the
substance of the patch).

>  Major new features:
>  
> +* The mallinfo2() function is added to report statistics as per
> +  mallinfo(), but with larger field widths to accurately report values
> +  that are larger than fit in an integer.

We don't use () after a function name just to indicate that it's a
function, only to indicate a call with no arguments (see the GNU Coding
Standards).

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH/v2] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list
In reply to this post by Florian Weimer
Florian Weimer <[hidden email]> writes:
>> +    # Internal name for mallinfo2
>> +    __libc_mallinfo2;

Oops, this was a leftover from a previous test.  Removed.

> Add an declaration (often with __typeof) and libc_hidden_proto to the
> wrapper header under include/.

Ah, we already do that in malloc.c.  Copied :-)

Joseph S. Myers writes:
> We don't use () after a function name just to indicate that it's a
> function, only to indicate a call with no arguments (see the GNU Coding
> Standards).

Fixed.

From fd60b9e42e89d5e5044d92fc18b6e7e5fc4fbf25 Mon Sep 17 00:00:00 2001
From: DJ Delorie <[hidden email]>
Date: Tue, 1 Sep 2020 16:17:25 -0400
Subject: Update mallinfo2 ABI, and test

This patch adds the ABI-related bits to reflect the new mallinfo2
function, and adds a test case to verify basic functionality.

diff --git a/NEWS b/NEWS
index 06e43e0453..99a5ab0cd5 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ Version 2.33
 
 Major new features:
 
+* The mallinfo2 function is added to report statistics as per mallinfo,
+  but with larger field widths to accurately report values that are
+  larger than fit in an integer.
 
 * Support for the RISC-V ISA running on Linux has been expanded to run on
   32-bit hardware.  This is supported for the following ISA and ABI pairs:
@@ -22,7 +25,8 @@ Major new features:
 
 Deprecated and removed features, and other changes affecting compatibility:
 
-  [Add deprecations, removals and changes affecting compatibility here]
+* The mallinfo function is marked deprecated.  Callers should call
+  mallinfo2 instead.
 
 Changes to build and runtime requirements:
 
diff --git a/malloc/Makefile b/malloc/Makefile
index e22cbde22d..09ae63bee5 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -35,7 +35,7 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
  tst-interpose-thread \
  tst-alloc_buffer \
  tst-malloc-tcache-leak \
- tst-malloc_info \
+ tst-malloc_info tst-mallinfo2 \
  tst-malloc-too-large \
  tst-malloc-stats-cancellation \
  tst-tcfree1 tst-tcfree2 tst-tcfree3 \
diff --git a/malloc/Versions b/malloc/Versions
index 2357cff3da..94c8ba8040 100644
--- a/malloc/Versions
+++ b/malloc/Versions
@@ -64,6 +64,9 @@ libc {
   GLIBC_2.26 {
     reallocarray;
   }
+  GLIBC_2.33 {
+    mallinfo2;
+  }
   GLIBC_PRIVATE {
     # Internal startup hook for libpthread.
     __libc_malloc_pthread_startup;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 560fee2c31..63f6a10bca 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -639,6 +639,7 @@ libc_hidden_proto (__libc_mallopt)
   thus be inaccurate.
 */
 struct mallinfo2 __libc_mallinfo2(void);
+libc_hidden_proto (__libc_mallinfo2)
 
 struct mallinfo __libc_mallinfo(void);
 
@@ -4975,7 +4976,6 @@ int_mallinfo (mstate av, struct mallinfo2 *m)
     }
 }
 
-
 struct mallinfo2
 __libc_mallinfo2 (void)
 {
@@ -4999,6 +4999,7 @@ __libc_mallinfo2 (void)
 
   return m;
 }
+libc_hidden_def (__libc_mallinfo2)
 
 struct mallinfo
 __libc_mallinfo (void)
diff --git a/malloc/tst-mallinfo2.c b/malloc/tst-mallinfo2.c
new file mode 100644
index 0000000000..c98c814c74
--- /dev/null
+++ b/malloc/tst-mallinfo2.c
@@ -0,0 +1,83 @@
+/* Smoke test for mallinfo2
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* Test that mallinfo2 is properly exported and basically works.  */
+
+#include <array_length.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <support/check.h>
+
+/* This is not specifically needed for the test, but (1) does
+   something to the data so gcc doesn't optimize it away, and (2) may
+   help when developing future tests.  */
+static void
+print_mi (const char *msg, struct mallinfo2 *m)
+{
+  printf("\n%s...\n", msg);
+#define P(f) printf("%s: %ld\n", #f, (long) m->f);
+  P(arena);
+  P(ordblks);
+  P(smblks);
+  P(hblks);
+  P(hblkhd);
+  P(usmblks);
+  P(fsmblks);
+  P(uordblks);
+  P(fordblks);
+  P(keepcost);
+}
+
+/* We do this to force the call to malloc to not be optimized
+   away.  */
+volatile void *ptr;
+
+static int
+do_test (void)
+{
+  struct mallinfo2 mi1, mi2;
+  int i;
+  size_t total = 0;
+
+  /* This is the key difference between mallinfo() and mallinfo2().
+     It may be a false positive if int and size_t are the same
+     size.  */
+  TEST_VERIFY (sizeof (mi1.arena) == sizeof (size_t));
+
+  mi1 = mallinfo2 ();
+  print_mi ("before", &mi1);
+
+  /* Allocations that are meaningful-sized but not so large as to be
+     mmapped, so that they're all accounted for in the field we test
+     below.  */
+  for (i=1; i<20; i++)
+    {
+      ptr = malloc (160 * i);
+      total += 16 * i;
+    }
+
+  mi2 = mallinfo2 ();
+  print_mi ("after", &mi2);
+
+  /* Check at least something changed.  */
+  TEST_VERIFY (mi2.uordblks > mi1.uordblks + total);
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 72537218ba..109838775c 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2191,6 +2191,7 @@ GLIBC_2.32 thrd_current F
 GLIBC_2.32 thrd_equal F
 GLIBC_2.32 thrd_sleep F
 GLIBC_2.32 thrd_yield F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 6cd61988b4..bc375ecb8d 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2160,3 +2160,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 8edb5deea1..f8f50f87b0 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2242,6 +2242,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index df13f49e15..146ca85cc8 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -1920,3 +1920,4 @@ GLIBC_2.32 wprintf F
 GLIBC_2.32 write F
 GLIBC_2.32 writev F
 GLIBC_2.32 wscanf F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 7f4a146d22..48b2240b88 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -144,6 +144,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index a83cc81958..1d5c482c89 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -141,6 +141,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 32887b1c58..a93d48f7ea 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2104,3 +2104,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index baf425072b..7e265ef570 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2063,6 +2063,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 8b0242a9b1..d80285427a 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2229,6 +2229,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index b6ba86dbe9..6619fe4b31 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2095,6 +2095,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index e1f7e19de9..56b651998c 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -145,6 +145,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0x98
 GLIBC_2.4 _IO_2_1_stdin_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 2d726097ca..ad200c9f63 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2175,6 +2175,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 7c78649e03..f91a744ce2 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2155,3 +2155,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index da2194b498..c5e86ddb4d 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2152,3 +2152,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 9fa655b3a5..f71c242463 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2146,6 +2146,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 3f6da71769..7854bdc5fc 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2144,6 +2144,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index de990933cf..f590577194 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2152,6 +2152,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 754491f209..8518b7fe2f 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2146,6 +2146,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 36a875115c..1d6bc7018d 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2193,3 +2193,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 6de9bed51d..2925850690 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2202,6 +2202,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 5c8c58974c..3c816ec48f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2235,6 +2235,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 92114806ac..376057d86d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2065,6 +2065,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index b01fdcfae1..e69191b82a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2355,3 +2355,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
index 3bea073169..2aad26a91c 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
@@ -1168,6 +1168,7 @@ GLIBC_2.33 lutimes F
 GLIBC_2.33 madvise F
 GLIBC_2.33 makecontext F
 GLIBC_2.33 mallinfo F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.33 malloc F
 GLIBC_2.33 malloc_info F
 GLIBC_2.33 malloc_stats F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 45cbeb1d98..04bc7b1e6f 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2122,3 +2122,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index d0752dba6c..2940f787ae 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2200,6 +2200,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index af5f14d1c6..e9d2023b8c 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2101,6 +2101,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index 038ce27174..d98ef4f519 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2070,6 +2070,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index 182970a708..8c8507ec14 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2067,6 +2067,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index a2521c3ee3..b4274d4fa4 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2191,6 +2191,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index d8188903f9..a683b0af97 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2118,6 +2118,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 1a96103c68..c360212e8d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2076,6 +2076,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 35745a75b6..e6d064cac7 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2173,3 +2173,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH/v2] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list


On 02/09/2020 18:04, DJ Delorie via Libc-alpha wrote:

> Florian Weimer <[hidden email]> writes:
>>> +    # Internal name for mallinfo2
>>> +    __libc_mallinfo2;
>
> Oops, this was a leftover from a previous test.  Removed.
>
>> Add an declaration (often with __typeof) and libc_hidden_proto to the
>> wrapper header under include/.
>
> Ah, we already do that in malloc.c.  Copied :-)
>
> Joseph S. Myers writes:
>> We don't use () after a function name just to indicate that it's a
>> function, only to indicate a call with no arguments (see the GNU Coding
>> Standards).
>
> Fixed.
>
> From fd60b9e42e89d5e5044d92fc18b6e7e5fc4fbf25 Mon Sep 17 00:00:00 2001
> From: DJ Delorie <[hidden email]>
> Date: Tue, 1 Sep 2020 16:17:25 -0400
> Subject: Update mallinfo2 ABI, and test
>
> This patch adds the ABI-related bits to reflect the new mallinfo2
> function, and adds a test case to verify basic functionality.
>

Patch LGTM with some nits below.

Reviewed-by: Adhemerval Zanella <[hidden email]>

> diff --git a/NEWS b/NEWS
> index 06e43e0453..99a5ab0cd5 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -9,6 +9,9 @@ Version 2.33
>  
>  Major new features:
>  
> +* The mallinfo2 function is added to report statistics as per mallinfo,
> +  but with larger field widths to accurately report values that are
> +  larger than fit in an integer.
>  
>  * Support for the RISC-V ISA running on Linux has been expanded to run on
>    32-bit hardware.  This is supported for the following ISA and ABI pairs:
> @@ -22,7 +25,8 @@ Major new features:
>  
>  Deprecated and removed features, and other changes affecting compatibility:
>  
> -  [Add deprecations, removals and changes affecting compatibility here]
> +* The mallinfo function is marked deprecated.  Callers should call
> +  mallinfo2 instead.
>  
>  Changes to build and runtime requirements:
>  
> diff --git a/malloc/Makefile b/malloc/Makefile
> index e22cbde22d..09ae63bee5 100644
> --- a/malloc/Makefile
> +++ b/malloc/Makefile
> @@ -35,7 +35,7 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
>   tst-interpose-thread \
>   tst-alloc_buffer \
>   tst-malloc-tcache-leak \
> - tst-malloc_info \
> + tst-malloc_info tst-mallinfo2 \
>   tst-malloc-too-large \
>   tst-malloc-stats-cancellation \
>   tst-tcfree1 tst-tcfree2 tst-tcfree3 \
> diff --git a/malloc/Versions b/malloc/Versions
> index 2357cff3da..94c8ba8040 100644
> --- a/malloc/Versions
> +++ b/malloc/Versions
> @@ -64,6 +64,9 @@ libc {
>    GLIBC_2.26 {
>      reallocarray;
>    }
> +  GLIBC_2.33 {
> +    mallinfo2;
> +  }
>    GLIBC_PRIVATE {
>      # Internal startup hook for libpthread.
>      __libc_malloc_pthread_startup;
> diff --git a/malloc/malloc.c b/malloc/malloc.c
> index 560fee2c31..63f6a10bca 100644
> --- a/malloc/malloc.c
> +++ b/malloc/malloc.c
> @@ -639,6 +639,7 @@ libc_hidden_proto (__libc_mallopt)
>    thus be inaccurate.
>  */
>  struct mallinfo2 __libc_mallinfo2(void);
> +libc_hidden_proto (__libc_mallinfo2)
>  
>  struct mallinfo __libc_mallinfo(void);
>  
> @@ -4975,7 +4976,6 @@ int_mallinfo (mstate av, struct mallinfo2 *m)
>      }
>  }
>  
> -

Gratuitous change.

>  struct mallinfo2
>  __libc_mallinfo2 (void)
>  {
> @@ -4999,6 +4999,7 @@ __libc_mallinfo2 (void)
>  
>    return m;
>  }
> +libc_hidden_def (__libc_mallinfo2)
>  
>  struct mallinfo
>  __libc_mallinfo (void)
> diff --git a/malloc/tst-mallinfo2.c b/malloc/tst-mallinfo2.c
> new file mode 100644
> index 0000000000..c98c814c74
> --- /dev/null
> +++ b/malloc/tst-mallinfo2.c
> @@ -0,0 +1,83 @@
> +/* Smoke test for mallinfo2
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +/* Test that mallinfo2 is properly exported and basically works.  */
> +
> +#include <array_length.h>
> +#include <malloc.h>
> +#include <stdlib.h>
> +#include <support/check.h>
> +
> +/* This is not specifically needed for the test, but (1) does
> +   something to the data so gcc doesn't optimize it away, and (2) may
> +   help when developing future tests.  */
> +static void
> +print_mi (const char *msg, struct mallinfo2 *m)
> +{
> +  printf("\n%s...\n", msg);
> +#define P(f) printf("%s: %ld\n", #f, (long) m->f);

Maybe use '%zu' here?

> +  P(arena);
> +  P(ordblks);
> +  P(smblks);
> +  P(hblks);
> +  P(hblkhd);
> +  P(usmblks);
> +  P(fsmblks);
> +  P(uordblks);
> +  P(fordblks);
> +  P(keepcost);
> +}
> +
> +/* We do this to force the call to malloc to not be optimized
> +   away.  */
> +volatile void *ptr;
> +
> +static int
> +do_test (void)
> +{
> +  struct mallinfo2 mi1, mi2;
> +  int i;
> +  size_t total = 0;
> +
> +  /* This is the key difference between mallinfo() and mallinfo2().
> +     It may be a false positive if int and size_t are the same
> +     size.  */
> +  TEST_VERIFY (sizeof (mi1.arena) == sizeof (size_t));

Maybe TEST_COMPARE?

> +
> +  mi1 = mallinfo2 ();
> +  print_mi ("before", &mi1);
> +
> +  /* Allocations that are meaningful-sized but not so large as to be
> +     mmapped, so that they're all accounted for in the field we test
> +     below.  */
> +  for (i=1; i<20; i++)

Space after '=' and '<'.

> +    {
> +      ptr = malloc (160 * i);
> +      total += 16 * i;
> +    }
> +
> +  mi2 = mallinfo2 ();
> +  print_mi ("after", &mi2);
> +
> +  /* Check at least something changed.  */
> +  TEST_VERIFY (mi2.uordblks > mi1.uordblks + total);
> +
> +  return 0;
> +}
> +
> +#include <support/test-driver.c>
> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index 72537218ba..109838775c 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2191,6 +2191,7 @@ GLIBC_2.32 thrd_current F
>  GLIBC_2.32 thrd_equal F
>  GLIBC_2.32 thrd_sleep F
>  GLIBC_2.32 thrd_yield F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 6cd61988b4..bc375ecb8d 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2160,3 +2160,4 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index 8edb5deea1..f8f50f87b0 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2242,6 +2242,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
> index df13f49e15..146ca85cc8 100644
> --- a/sysdeps/unix/sysv/linux/arc/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
> @@ -1920,3 +1920,4 @@ GLIBC_2.32 wprintf F
>  GLIBC_2.32 write F
>  GLIBC_2.32 writev F
>  GLIBC_2.32 wscanf F
> +GLIBC_2.33 mallinfo2 F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index 7f4a146d22..48b2240b88 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -144,6 +144,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index a83cc81958..1d5c482c89 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -141,6 +141,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index 32887b1c58..a93d48f7ea 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2104,3 +2104,4 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index baf425072b..7e265ef570 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2063,6 +2063,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index 8b0242a9b1..d80285427a 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2229,6 +2229,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index b6ba86dbe9..6619fe4b31 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -2095,6 +2095,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index e1f7e19de9..56b651998c 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -145,6 +145,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0x98
>  GLIBC_2.4 _IO_2_1_stdin_ D 0x98
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 2d726097ca..ad200c9f63 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2175,6 +2175,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 7c78649e03..f91a744ce2 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2155,3 +2155,4 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index da2194b498..c5e86ddb4d 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2152,3 +2152,4 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index 9fa655b3a5..f71c242463 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2146,6 +2146,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index 3f6da71769..7854bdc5fc 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2144,6 +2144,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index de990933cf..f590577194 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2152,6 +2152,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index 754491f209..8518b7fe2f 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -2146,6 +2146,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index 36a875115c..1d6bc7018d 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2193,3 +2193,4 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index 6de9bed51d..2925850690 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2202,6 +2202,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index 5c8c58974c..3c816ec48f 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2235,6 +2235,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index 92114806ac..376057d86d 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -2065,6 +2065,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index b01fdcfae1..e69191b82a 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -2355,3 +2355,4 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> index 3bea073169..2aad26a91c 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> @@ -1168,6 +1168,7 @@ GLIBC_2.33 lutimes F
>  GLIBC_2.33 madvise F
>  GLIBC_2.33 makecontext F
>  GLIBC_2.33 mallinfo F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.33 malloc F
>  GLIBC_2.33 malloc_info F
>  GLIBC_2.33 malloc_stats F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> index 45cbeb1d98..04bc7b1e6f 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> @@ -2122,3 +2122,4 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index d0752dba6c..2940f787ae 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2200,6 +2200,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index af5f14d1c6..e9d2023b8c 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -2101,6 +2101,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index 038ce27174..d98ef4f519 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2070,6 +2070,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index 182970a708..8c8507ec14 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2067,6 +2067,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index a2521c3ee3..b4274d4fa4 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2191,6 +2191,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index d8188903f9..a683b0af97 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -2118,6 +2118,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index 1a96103c68..c360212e8d 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -2076,6 +2076,7 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index 35745a75b6..e6d064cac7 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2173,3 +2173,4 @@ GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 mallinfo2 F
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH/v2] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list
Adhemerval Zanella <[hidden email]> writes:
> Patch LGTM with some nits below.
>
> Reviewed-by: Adhemerval Zanella <[hidden email]>

Thanks!  I'll fix the nits as suggested while waiting for other
reviewers.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH/v2] Use size_t for mallinfo fields.

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list

Thanks, committed as follows...

From cdf645427d176197b82f44308a5e131d69fb53ad Mon Sep 17 00:00:00 2001
From: DJ Delorie <[hidden email]>
Date: Tue, 1 Sep 2020 16:17:25 -0400
Subject: Update mallinfo2 ABI, and test

This patch adds the ABI-related bits to reflect the new mallinfo2
function, and adds a test case to verify basic functionality.

Reviewed-by: Adhemerval Zanella <[hidden email]>

diff --git a/NEWS b/NEWS
index 878221639b..fc8dd15439 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,10 @@ Version 2.33
 
 Major new features:
 
+* The mallinfo2 function is added to report statistics as per mallinfo,
+  but with larger field widths to accurately report values that are
+  larger than fit in an integer.
+
 * Add <sys/platform/x86.h> to provide query macros for x86 CPU features.
 
 * Support for the RISC-V ISA running on Linux has been expanded to run on
@@ -23,7 +27,8 @@ Major new features:
 
 Deprecated and removed features, and other changes affecting compatibility:
 
-  [Add deprecations, removals and changes affecting compatibility here]
+* The mallinfo function is marked deprecated.  Callers should call
+  mallinfo2 instead.
 
 Changes to build and runtime requirements:
 
diff --git a/malloc/Makefile b/malloc/Makefile
index e22cbde22d..09ae63bee5 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -35,7 +35,7 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
  tst-interpose-thread \
  tst-alloc_buffer \
  tst-malloc-tcache-leak \
- tst-malloc_info \
+ tst-malloc_info tst-mallinfo2 \
  tst-malloc-too-large \
  tst-malloc-stats-cancellation \
  tst-tcfree1 tst-tcfree2 tst-tcfree3 \
diff --git a/malloc/Versions b/malloc/Versions
index 2357cff3da..94c8ba8040 100644
--- a/malloc/Versions
+++ b/malloc/Versions
@@ -64,6 +64,9 @@ libc {
   GLIBC_2.26 {
     reallocarray;
   }
+  GLIBC_2.33 {
+    mallinfo2;
+  }
   GLIBC_PRIVATE {
     # Internal startup hook for libpthread.
     __libc_malloc_pthread_startup;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 560fee2c31..cd9933b4e5 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -639,6 +639,7 @@ libc_hidden_proto (__libc_mallopt)
   thus be inaccurate.
 */
 struct mallinfo2 __libc_mallinfo2(void);
+libc_hidden_proto (__libc_mallinfo2)
 
 struct mallinfo __libc_mallinfo(void);
 
@@ -4999,6 +5000,7 @@ __libc_mallinfo2 (void)
 
   return m;
 }
+libc_hidden_def (__libc_mallinfo2)
 
 struct mallinfo
 __libc_mallinfo (void)
diff --git a/malloc/tst-mallinfo2.c b/malloc/tst-mallinfo2.c
new file mode 100644
index 0000000000..39a70d7df2
--- /dev/null
+++ b/malloc/tst-mallinfo2.c
@@ -0,0 +1,83 @@
+/* Smoke test for mallinfo2
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* Test that mallinfo2 is properly exported and basically works.  */
+
+#include <array_length.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <support/check.h>
+
+/* This is not specifically needed for the test, but (1) does
+   something to the data so gcc doesn't optimize it away, and (2) may
+   help when developing future tests.  */
+static void
+print_mi (const char *msg, struct mallinfo2 *m)
+{
+  printf("\n%s...\n", msg);
+#define P(f) printf("%s: %zu\n", #f, m->f);
+  P(arena);
+  P(ordblks);
+  P(smblks);
+  P(hblks);
+  P(hblkhd);
+  P(usmblks);
+  P(fsmblks);
+  P(uordblks);
+  P(fordblks);
+  P(keepcost);
+}
+
+/* We do this to force the call to malloc to not be optimized
+   away.  */
+volatile void *ptr;
+
+static int
+do_test (void)
+{
+  struct mallinfo2 mi1, mi2;
+  int i;
+  size_t total = 0;
+
+  /* This is the key difference between mallinfo() and mallinfo2().
+     It may be a false positive if int and size_t are the same
+     size.  */
+  TEST_COMPARE (sizeof (mi1.arena), sizeof (size_t));
+
+  mi1 = mallinfo2 ();
+  print_mi ("before", &mi1);
+
+  /* Allocations that are meaningful-sized but not so large as to be
+     mmapped, so that they're all accounted for in the field we test
+     below.  */
+  for (i = 1; i < 20; ++i)
+    {
+      ptr = malloc (160 * i);
+      total += 16 * i;
+    }
+
+  mi2 = mallinfo2 ();
+  print_mi ("after", &mi2);
+
+  /* Check at least something changed.  */
+  TEST_VERIFY (mi2.uordblks > mi1.uordblks + total);
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 72537218ba..109838775c 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2191,6 +2191,7 @@ GLIBC_2.32 thrd_current F
 GLIBC_2.32 thrd_equal F
 GLIBC_2.32 thrd_sleep F
 GLIBC_2.32 thrd_yield F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 6cd61988b4..bc375ecb8d 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2160,3 +2160,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 8edb5deea1..f8f50f87b0 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2242,6 +2242,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index df13f49e15..146ca85cc8 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -1920,3 +1920,4 @@ GLIBC_2.32 wprintf F
 GLIBC_2.32 write F
 GLIBC_2.32 writev F
 GLIBC_2.32 wscanf F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 7f4a146d22..48b2240b88 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -144,6 +144,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index a83cc81958..1d5c482c89 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -141,6 +141,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 32887b1c58..a93d48f7ea 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2104,3 +2104,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index baf425072b..7e265ef570 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2063,6 +2063,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 8b0242a9b1..d80285427a 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2229,6 +2229,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index b6ba86dbe9..6619fe4b31 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2095,6 +2095,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index e1f7e19de9..56b651998c 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -145,6 +145,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0x98
 GLIBC_2.4 _IO_2_1_stdin_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 2d726097ca..ad200c9f63 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2175,6 +2175,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 7c78649e03..f91a744ce2 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2155,3 +2155,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index da2194b498..c5e86ddb4d 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2152,3 +2152,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 9fa655b3a5..f71c242463 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2146,6 +2146,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 3f6da71769..7854bdc5fc 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2144,6 +2144,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index de990933cf..f590577194 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2152,6 +2152,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 754491f209..8518b7fe2f 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2146,6 +2146,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 36a875115c..1d6bc7018d 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2193,3 +2193,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 6de9bed51d..2925850690 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2202,6 +2202,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 5c8c58974c..3c816ec48f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2235,6 +2235,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 92114806ac..376057d86d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2065,6 +2065,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index b01fdcfae1..e69191b82a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2355,3 +2355,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
index 3bea073169..2aad26a91c 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
@@ -1168,6 +1168,7 @@ GLIBC_2.33 lutimes F
 GLIBC_2.33 madvise F
 GLIBC_2.33 makecontext F
 GLIBC_2.33 mallinfo F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.33 malloc F
 GLIBC_2.33 malloc_info F
 GLIBC_2.33 malloc_stats F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 45cbeb1d98..04bc7b1e6f 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2122,3 +2122,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index d0752dba6c..2940f787ae 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2200,6 +2200,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index af5f14d1c6..e9d2023b8c 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2101,6 +2101,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index 038ce27174..d98ef4f519 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2070,6 +2070,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index 182970a708..8c8507ec14 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2067,6 +2067,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index a2521c3ee3..b4274d4fa4 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2191,6 +2191,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index d8188903f9..a683b0af97 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2118,6 +2118,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 1a96103c68..c360212e8d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2076,6 +2076,7 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 35745a75b6..e6d064cac7 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2173,3 +2173,4 @@ GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 mallinfo2 F

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Use size_t for mallinfo fields.

Martin Liška
In reply to this post by Sourceware - libc-alpha mailing list
On 9/2/20 6:11 PM, DJ Delorie wrote:
> As others have noted, getting this right is more complicated that you'd
> think.  I'm in the middle of debugging the ABI list changes and will
> likely have to refactor the mallinfo2 code to get it right, so don't
> worry about this one, I'll take care of it;-)

Thank you for it DJ!

Martin
12