From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 E35DB4219F1 for ; Mon, 2 Mar 2026 17:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772473236; cv=none; b=Va/2eqB223zyvPP/U1cNsI6v+nbPSKTidxoPdmENh5Ix0ZkzKJakeTaTafaEMjMSohFvmEyUZG/QrQNOmNpXAknMEWxqXxtaeNgrDGpMLUJDACsuSK6W0DQ5Y3EUzoGY0pgQ50k9rTvC8FDAaCXNpalLNmmMd6aV1cKDWwVtL3A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772473236; c=relaxed/simple; bh=9Rb9eG3gVnkobLqIXjM8OA571fWMdtFK9Lgtde+Nhe4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IJcLufnCkBPou7j06pu/7ZlY3VYxkKeHsdwmR0oTUQEy6WcKdE1V4wdJMAH5L0qkZiUPYSlkNma0gFZvWY+IjVkHtbo0/6bkeBRW2AR+x4s9QhOobg0fPuvHw9/Di26eoPQ7PWFQHbQ1lxrLOD3a6qI605V8enSAwr6qGcH07WM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ahU7SI4K; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ahU7SI4K" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772473234; 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: in-reply-to:in-reply-to:references:references; bh=1t9B6i7CkrMpK3fAOhI5ntt/5KcYm7iE2MiLICu1shs=; b=ahU7SI4K6n1W8jCyg0xtNRg2hpIPV3acdWoj7xwFlCilyVX0zrjBkZ9GMcQxZ3ne8mg7u3 /5rFK4+tu63nrxEUe69C/L+uPR0ojuwhBJu+FJCES/VXNZch1Jo/vHolIg6/8DwzGVbf+f UIOhTIcDY26wdZvR9cVitXNT3h7O5Co= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-592-4BRSKHqtPKOqlqJhZcJTAQ-1; Mon, 02 Mar 2026 12:40:33 -0500 X-MC-Unique: 4BRSKHqtPKOqlqJhZcJTAQ-1 X-Mimecast-MFC-AGG-ID: 4BRSKHqtPKOqlqJhZcJTAQ_1772473231 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B678F195609F; Mon, 2 Mar 2026 17:40:31 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (unknown [10.6.23.247]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 711A219560A3; Mon, 2 Mar 2026 17:40:31 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.17.1) with ESMTPS id 622HeUEv1853785 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 2 Mar 2026 12:40:30 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.18.1/Submit) id 622HeUJb1853784; Mon, 2 Mar 2026 12:40:30 -0500 Date: Mon, 2 Mar 2026 12:40:30 -0500 From: Benjamin Marzinski To: Junrui Luo Cc: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, Yuhao Jiang Subject: Re: [PATCH] dm mirror: fix integer overflow in create_dirty_log() Message-ID: References: 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=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 On Sun, Mar 01, 2026 at 09:10:58PM +0800, Junrui Luo wrote: > The argument count calculation in create_dirty_log() performs > `*args_used = 2 + param_count` before validating against argc. When a > user provides a param_count close to UINT_MAX via the device mapper > table string, this unsigned addition wraps around to a small value, > causing the subsequent `argc < *args_used` check to be bypassed. > > The overflowed param_count is then passed as argc to dm_dirty_log_create(), > where it can cause out-of-bounds reads on the argv array. > > Fix by comparing param_count against argc - 2 before performing the > addition, following the same pattern used by parse_features() in the > same file. Since argc >= 2 is already guaranteed, the subtraction is > safe. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Reported-by: Yuhao Jiang > Signed-off-by: Junrui Luo Reviewed-by: Benjamin Marzinski