From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E786C43217 for ; Wed, 6 Apr 2022 00:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588160AbiDFAOf (ORCPT ); Tue, 5 Apr 2022 20:14:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238765AbiDEKwc (ORCPT ); Tue, 5 Apr 2022 06:52:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE318A8EE8; Tue, 5 Apr 2022 03:28:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 80759617AF; Tue, 5 Apr 2022 10:28:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F17EC385A0; Tue, 5 Apr 2022 10:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649154487; bh=XJS80OO7Vk4EjtWS1x8wYhqMThUypeCurJ+1Frx+SR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NIr3+WX+ql6oF0Jsx5JGb2tvq9wdbS15Pt8syXd7HDcFPvVAcJW1/bUR8vmz5VTXn +/CIB1ZZPy5RoD0C/vlIC8IrgITTHB4k1eGc3SkIlV2gLigVu62itgWoyOAf3xRNlO BsLmgmcdOkW0Y0iWbDiZ4L3AmzHFA0xXakbsTfkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Kees Cook , "Eric W. Biederman" Subject: [PATCH 5.10 596/599] coredump: Remove the WARN_ON in dump_vma_snapshot Date: Tue, 5 Apr 2022 09:34:50 +0200 Message-Id: <20220405070316.575592537@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070258.802373272@linuxfoundation.org> References: <20220405070258.802373272@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric W. Biederman commit 49c1866348f364478a0c4d3dd13fd08bb82d3a5b upstream. The condition is impossible and to the best of my knowledge has never triggered. We are in deep trouble if that conditions happens and we walk past the end of our allocated array. So delete the WARN_ON and the code that makes it look like the kernel can handle the case of walking past the end of it's vma_meta array. Reviewed-by: Jann Horn Reviewed-by: Kees Cook Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman --- fs/coredump.c | 6 ------ 1 file changed, 6 deletions(-) --- a/fs/coredump.c +++ b/fs/coredump.c @@ -1128,12 +1128,6 @@ static bool dump_vma_snapshot(struct cor mmap_write_unlock(mm); - if (WARN_ON(i != cprm->vma_count)) { - kvfree(cprm->vma_meta); - return false; - } - - for (i = 0; i < cprm->vma_count; i++) { struct core_vma_metadata *m = cprm->vma_meta + i;