This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch] Correct range checking in mallopt/mxfast/tcache [BZ #25194]
DJ Delorie wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>> nit: unsigned overflow is defined in C to wrap around, so we don't
>> have to worry about undefined behavior here.
>
> Including implied overflow by type cast conversions?
Yes, C99 section 6.3.1.3 describes signed-to-unsigned conversions.
Thanks for asking, though, since that wasn't the case I was thinking
of before.
Walking through the caller, we're talking about TUNABLE_SET, which does
__tunable_set_val (TUNABLE_ENUM_NAME (__top, __ns, __id), \
& (__type) {__val}); \
The only caller for TUNABLE_SET I see is do_tunable_update_val, which
bounds-checks its input.
>> This also changes the return value from these helpers. Forgive my
>> ignorance: where do they get called? I assumed it would be
>> __libc_mallopt, but I don't see any calls from there.
>
> The only two places they could be called from is mallopt() and the
> tunables macros in arena.c. The tunables code ignores any return value.
Ah --- thanks for the pointer. (Not about this patch: a comment
mentioning the arena.c tunables macros would be handy for the unwary
reader.)
So the only intended callers are set_tcache_max and set_mxfast (today)
and __libc_mallopt (in the future)? Makes sense.
Thanks,
Jonathan