From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-43103.protonmail.ch (mail-43103.protonmail.ch [185.70.43.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C195C26CE1E for ; Wed, 24 Jun 2026 05:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.103 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782279956; cv=none; b=WvVhRuk0L1l9DfgupTf6LAQfre65RmZxEgqPUtGWrlqBsAGeWxTdbeigISA5eGZr4xSM+0GlkD/j6hpL1dYlDukdHCJYiomIi+TjgfkhwThxjyfj0IywaNVAqtJWu1yKrPSO1FPogIVagQbo17C9+/BhjaC2DzJv8JKx8WRfiSc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782279956; c=relaxed/simple; bh=QxX7FqEdAL42tT448XuA2WcAZcPRHJrJHnUo7T4nawU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Txejck/m42XUH66jYJHWeh3d2S6Zx3Peau8zwCYEiAnYy9Wn+b8p5pQguXWNYiM80GNDosMdKmhaHlpjlEEv+XiXuev6PY46I1OIIbrL6IiZZ76VMoY2Vi/7FO1xSb+OWJ7LK+ejpqSS8GPldDZ8yuEmv+7EB1qgNE8+ss0IQZg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b=kdFdtvpP; arc=none smtp.client-ip=185.70.43.103 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="kdFdtvpP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1782279947; x=1782539147; bh=Qv+1LEO8cOR+W8bqnhQVVCq1nXfaBqiWK9gHvcdCcjA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=kdFdtvpPkFv0+xUUPDBLiTY6yBchjtDaE8anPXcehzUpg3WgJS3uzHL9DMz5Scoaj h/rY413dtJ5uYNYJap9QAQlCmqMMJ961KOEtQei0UzwhH4zGYa4qOvhKqFl4JuvpT4 ShnA/HRITeVpU+noS9jCarX0itTfuw2AwBVm45LwGqG4hO/h+KN4ktLpOEpzjBWHu+ kdEhIhX1MxwVvPwy9+1nGFUhiX2Usk34hyVrDtcpbdYuakvW4RuU6YZhoqGfVyxxDY EZYm4LapPJSCCISdC4r4fMsX91BPS8AaEHpEyLouZQMi8rlYOZ3wXZg9UYP+wvpA35 Hs6JyAwuXUpQg== Date: Wed, 24 Jun 2026 05:45:40 +0000 To: David Laight From: Bryam Vargas Cc: Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Alison Schofield , nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] libnvdimm/labels: Prevent integer overflow in __nd_label_validate() Message-ID: <20260624054533.531015-1-hexlabsecurity@proton.me> In-Reply-To: <20260621112357.56a290bc@pumpkin> References: <20260620-b4-disp-7f43b155-v1-1-0cfd8017f7a0@proton.me> <20260621112357.56a290bc@pumpkin> Feedback-ID: 199661219:user:proton X-Pm-Message-ID: 64f213e5dc5856fe511af42badaf79fa7062625e Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2026-06-21, David Laight wrote: > The same could be done for nslot - any value above 64k is pretty much > guaranteed to be garbage I took that up in v2, but it does not hold against the code, so v3 drops it= . The allocation it was meant to bound -- ndd->data in nd_label_data_init() -= - is kvzalloc(config_size), not nslot-derived, so capping nslot shrinks nothi= ng. And the cap is unsafe: on ND_NSINDEX_INIT the kernel writes nslot =3D nvdimm_num_label_slots(ndd) =3D config_size / label_size, which i= s above 64K once config_size is past ~8.4MB. A 64K cap then rejects labels the ker= nel itself wrote, so a freshly-formatted large device fails its own next probe. The (u64) cast in patch 1 already makes the bound exact, so the overflow is closed without the cap. v3 keeps the cast; the labelsize-shift UB the revi= ew also turned up is a separate fix, not a stand-in for the cap. Thanks, Bryam