Re: [PATCH] zsmalloc: use actual object size to detect spans

From: Sergey Senozhatsky

Date: Tue Jan 06 2026 - 21:06:15 EST


On (26/01/07 01:56), Yosry Ahmed wrote:
> > I recall us having exactly this idea when we first introduced
> > zs_obj_{read,write}_end() functions, and I do recall that it
> > did not work. Somehow this panics in __memcpy+0xc/0x44. Let
> > me dig into it again.
>
> Maybe because at this point we are trying to memcpy() class->size, which
> already includes ZS_HANDLE_SIZE. So reading after increasing the offset
> reads ZS_HANDLE_SIZE after class->size.

Yeah, I guess that falsely hits the spanning path because of extra
sizeof(unsigned long).