From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=80.241.56.171 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795938067; b=VCkFITb7NTLenytQ56dsQmkKvHKd0Xbd7M+3baFW+ILHZUVYdMH5pJcs7NMBBTqEr298 E8+7ioTCXNoppmW6fCmqRLVfFm0xBl+lrrrA6tC3/Rn5A2NTy50Z+OOxXs/8IeTe+L4Qh 14+M3XNwiiv/OkM7Nl8HyQOfiVJwJlm23qSTF3P+WIowntIBlStbUiXcBp4NYvVTq94EC muJ8/0fjRrXCEyd95NWAazbxiE4xoC8mBQPPIIPE+7JpNFlJetJ/le7bwcoGuX5gRI039 TXw9zh/9VXk83kzRJxfJIgG9/MbuHGFKqEL+oXAmbGXVTCv3cwgPVpTu2vTyhEbK5aQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795938067; h=DMARC-Filter:Received:DKIM-Signature:Message-ID:Subject:From:To:Cc: Date:In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version:X-MBO-RS-ID:X-MBO-RS-META:X-Rspamd-Queue-Id; bh=7mQwl2XfIlq0By1RCby2Av24QwMSQKbAWNYqBypl6GU=; b=UuZZIjn/xfDXveCa0/4k/tLA7kj4POiuCiINdGxRMlSKCTkaQWzSxwKhUr9pncm8I9Qs uPu5Skm9fyCfAJs2uJd6DcwH3HLaWxLlEteC0B98+z0aFvWL8dBQW9ywx9zVHVi/NAlmd iXNah67GX65riKSqHHiD37uUeYSFbVSo0YllHjohiJuCDWYhQHAzlj1p69r7ZzIPdHd1K 7jrWVGON4Vk+5wqrWs76F3k0osp84ojfUTZQ9lBXZyzCkxjfGa2bMASGcqjIxzueep9Z+ I4eYLVOXhBiuWV0DP9ujgYJfI/dFid+PTZTYpLCDjLLHl3EjfdEZWxx126nAlbOBl8A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=mailbox.org; spf=pass smtp.mailfrom=mailbox.org; dkim=pass header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256 header.s=mail20150812 header.b=dc78UcKS; arc=none smtp.remote-ip=80.241.56.171 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA4A5606A31C; Sun, 29 Nov 2026 07:41:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EA4A5606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mailbox.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256 header.s=mail20150812 header.b=dc78UcKS Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4jcfGH5hwyzMlmW; Sun, 29 Nov 2026 08:40:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1795938061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7mQwl2XfIlq0By1RCby2Av24QwMSQKbAWNYqBypl6GU=; b=dc78UcKSbdcYbpkJz4dBdb7M3nUmjgT37L7fJ7HQaSxCYr/j1/k4g0PrsrGvD8nSYZle3E m6soAUpxPsgFctwR049zr75FmF9pil2HUSpWRKM1WmUEq9l5X1Tp3JmvIpUZYUQI1jQdiN NgaCO/XgMVnSOHqjJqx6kU5s5UFjo2po8TJm+K6ge7QTBr0yDWYVT/CzPZBCA9ofX/S+Zb lEd+kUrpQXajCtZ4IvI96mtr19+RP+1mv3CVWnVlAa36zvv4uEMAX1GWQ4JRRWxvNYMK90 A1SY8lh8qYo9Qt2/GPfBSo1BJMvSeZ+lowOdtNjFlLNCANVjWDqCc3iI2oFoRA== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of manuelebnerli@mailbox.org designates 2001:67c:2050:b231:465::202 as permitted sender) smtp.mailfrom=manuelebnerli@mailbox.org Message-ID: <64a9e601da9b44bd8f8b141023c5b214b89cc34e.camel@mailbox.org> Subject: Re: [PATCH v2] slab: fix the kernel-doc of kmalloc_flex() on counter overflow From: Manuel Ebner To: arina.kharlamova@mbzuai.ac.ae, Jonathan Corbet , Shuah Khan , Randy Dunlap , Kees Cook , "Gustavo A. R. Silva" , Vlastimil Babka , Harry Yoo , Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin Cc: workflows@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-mm@kvack.org Date: Sun, 29 Nov 2026 08:40:44 +0100 In-Reply-To: <20261129-slab-doc-v2-1-666aeac2fcc3@mbzuai.ac.ae> References: <20261129-slab-doc-v2-1-666aeac2fcc3@mbzuai.ac.ae> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.62.1 (3.62.1-1.fc45) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MBO-RS-ID: 56d5ac669de922cbc2b X-MBO-RS-META: b69k6u3kbq11k6j7quksn1sm15d5snb7 X-Rspamd-Queue-Id: 4jcfGH5hwyzMlmW Hi Arina, On Sun, 2026-11-29 at 10:04 +0400, Arina Kharlamova via B4 Relay wrote: > From: Arina Kharlamova >=20 > Commit fa5c82f4d2bb ("slab.h: disable completely broken overflow handling > in flex allocations") removed the counter overflow check from > __alloc_flex(), but the kernel-doc and deprecated.rst still say that the > allocation fails if COUNT does not fit in the __counted_by() counter. >=20 > Update them to match the code. While at it, fix the Returns: line of > overflows_flex_counter_type(), where true and false are swapped. >=20 > Fixes: fa5c82f4d2bb ("slab.h: disable completely broken overflow handling= in flex allocations") > Signed-off-by: Arina Kharlamova > --- > Found by checks derived from the spec2patch kernel API specifications, > with the help of an AI coding assistant (Claude); I reviewed the > analysis and the fix. > --- > Changes in v2: > - Shorten the changelog and the comments (Harry Yoo) > - Rebase on slab/for-next > - Link to v1: https://patch.msgid.link/20261124-slab-doc-v1-1-9f14dfce47c= 8@mbzuai.ac.ae > --- > =C2=A0Documentation/process/deprecated.rst |=C2=A0 7 +++---- > =C2=A0include/linux/overflow.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 5 +++-- > =C2=A0include/linux/slab.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 10 ++++------ > =C2=A03 files changed, 10 insertions(+), 12 deletions(-) >=20 > diff --git a/Documentation/process/deprecated.rst b/Documentation/process= /deprecated.rst > index 22a5e62c92ea..ea392cf36fb8 100644 > --- a/Documentation/process/deprecated.rst > +++ b/Documentation/process/deprecated.rst > @@ -405,7 +405,6 @@ become, respectively:: > =C2=A0=09__auto_type ptr =3D kmalloc_obj(struct foo [, gfp] ); > =C2=A0 > =C2=A0The argument gfp is optional, the default value is GFP_KERNEL. could you add this diff in you patch? https://lore.kernel.org/all/20260909141255.1367539-2-manuelebnerli@mailbox.= org/ Else looks good to me. Reviewed-by: Manuel Ebner Thanks Manuel > -If `ptr->flex_member` is annotated with __counted_by(), the allocation > -will automatically fail if `count` is larger than the maximum > -representable value that can be stored in the counter member associated > -with `flex_member`. > +If `ptr->flex_member` is annotated with __counted_by(), the caller must > +make sure that `count` fits in the counter member associated with > +`flex_member`. > diff --git a/include/linux/overflow.h b/include/linux/overflow.h >=20 > [...] >=20 > Best regards, > --=C2=A0=20 > Arina Kharlamova >=20