[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250506135650.GA276050@cmpxchg.org>
Date: Tue, 6 May 2025 09:56:50 -0400
From: Johannes Weiner <hannes@...xchg.org>
To: Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Minchan Kim <minchan@...nel.org>,
Yosry Ahmed <yosry.ahmed@...ux.dev>,
Vitaly Wool <vitaly.wool@...sulko.se>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Igor Belousov <igor.b@...dev.am>,
stable@...r.kernel.org
Subject: Re: [PATCH] zsmalloc: don't underflow size calculation in
zs_obj_write()
On Sun, May 04, 2025 at 08:00:22PM +0900, Sergey Senozhatsky wrote:
> Do not mix class->size and object size during offsets/sizes
> calculation in zs_obj_write(). Size classes can merge into
> clusters, based on objects-per-zspage and pages-per-zspage
> characteristics, so some size classes can store objects
> smaller than class->size. This becomes problematic when
> object size is much smaller than class->size - we can determine
> that object spans two physical pages, because we use a larger
> class->size for this, while the actual object is much smaller
> and fits one physical page, so there is nothing to write to
> the second page and memcpy() size calculation underflows.
>
> We always know the exact size in bytes of the object
> that we are about to write (store), so use it instead of
> class->size.
>
> Reported-by: Igor Belousov <igor.b@...dev.am>
> Cc: <stable@...r.kernel.org>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@...omium.org>
Could you please include user-visible effects and circumstances that
Igor reported? Crash, backtrace etc, 16k pages etc. in the changelog?
This type of information helps tremendously with backports, or finding
this patch when encountering the issue in the wild.
Acked-by: Johannes Weiner <hannes@...xchg.org>
Powered by blists - more mailing lists