Fix size class overflow bugs.
Avoid calling s2u() on raw extent sizes in extent_recycle(). Clamp psz2ind() (implemented as psz2ind_clamp()) when inserting/removing into/from size-segregated extent heaps.
This commit is contained in:
@@ -516,7 +516,9 @@ void jemalloc_postfork_child(void);
|
||||
#include "jemalloc/internal/large.h"
|
||||
|
||||
#ifndef JEMALLOC_ENABLE_INLINE
|
||||
pszind_t psz2ind_impl(size_t psz, bool clamp);
|
||||
pszind_t psz2ind(size_t psz);
|
||||
pszind_t psz2ind_clamp(size_t psz);
|
||||
size_t pind2sz_compute(pszind_t pind);
|
||||
size_t pind2sz_lookup(pszind_t pind);
|
||||
size_t pind2sz(pszind_t pind);
|
||||
@@ -541,12 +543,12 @@ ticker_t *decay_ticker_get(tsd_t *tsd, unsigned ind);
|
||||
#endif
|
||||
|
||||
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_))
|
||||
JEMALLOC_INLINE pszind_t
|
||||
psz2ind(size_t psz)
|
||||
JEMALLOC_ALWAYS_INLINE pszind_t
|
||||
psz2ind_impl(size_t psz, bool clamp)
|
||||
{
|
||||
|
||||
if (unlikely(psz > LARGE_MAXCLASS))
|
||||
return (NPSIZES);
|
||||
return (clamp ? NPSIZES-1 : NPSIZES);
|
||||
{
|
||||
pszind_t x = lg_floor((psz<<1)-1);
|
||||
pszind_t shift = (x < LG_SIZE_CLASS_GROUP + LG_PAGE) ? 0 : x -
|
||||
@@ -565,6 +567,20 @@ psz2ind(size_t psz)
|
||||
}
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE pszind_t
|
||||
psz2ind(size_t psz)
|
||||
{
|
||||
|
||||
return (psz2ind_impl(psz, false));
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE pszind_t
|
||||
psz2ind_clamp(size_t psz)
|
||||
{
|
||||
|
||||
return (psz2ind_impl(psz, true));
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
pind2sz_compute(pszind_t pind)
|
||||
{
|
||||
|
@@ -395,6 +395,8 @@ prof_thread_active_set
|
||||
prof_thread_name_get
|
||||
prof_thread_name_set
|
||||
psz2ind
|
||||
psz2ind_clamp
|
||||
psz2ind_impl
|
||||
psz2u
|
||||
purge_mode_names
|
||||
register_zone
|
||||
|
Reference in New Issue
Block a user