Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp672161pxb; Tue, 5 Apr 2022 18:10:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgHO4KYORtkhxwoRqVruWrhGn9hiW06aeiuZHnUI0z6OD++BJQfyodQgXS7kaDcNxU3KvN X-Received: by 2002:a05:6402:909:b0:416:6f3c:5c1d with SMTP id g9-20020a056402090900b004166f3c5c1dmr6257823edz.108.1649207428201; Tue, 05 Apr 2022 18:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649207428; cv=none; d=google.com; s=arc-20160816; b=Cx2XAnd+cC7uoP10JWoKFa0oem34/dDuessPF/TYCltib2cr6QPeRpI36hKoc8IHF8 y2Xj9d2TcHW3enxMii2TmUBR95OkrQoRxXDsBl80P7s0OkNWZLVb0WwVifpu+hKQcQpl INBU8+YdV2kE/NlcZG9un61kOnd2zYRKLarCyFtPxHDneMwmxlKxj+eVe4CkdfCMFBDk /+VClTRAzGBpZnblbRBYbTnNR1mwqw1sQy46BFnIIzIak5NFqWtR6FLWk6Kxrko0lxF8 iSrWWWO1HYuMYBiA8JriakMydmeQOzmXeeFEsL2oVW4jXPu0yLvbBXVbyr35+384JXQ4 4rdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NWTPaHoiIWriBsb4k7mc7ufv1wEXbL/0felQtqt/Olg=; b=XjHA5HOW6ZtLLh7W2/wqoKgdwstKfnuPnDBnJ+9i+RBtAM2dW+K5U3IozBONn7KFX0 XORafyuoVB1C9JqEJeJrqSUUgnERUhuWOf2s28uTYCcJ169N0dJm2V2ruXQ2jin6veJh YD2va5KN7CbCSiJoaHCptdoOoYtQo7wWQthfMkU9NzdrxT4RQDxwizxkcdAirThbWAwc DoOFHuroSu9rYvONXAwAp/T3oKet9g5kr+9kgGe4uPu+pHXbJih3q5jKKgGvS1NoJRGK M081JByGltaRvlqW7/9wF2zPzHtNpUf17+/V1K8cDVfVAjOGUBmda9nN+QyrfRbbsPlm KUTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ub6lIl2m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a056402521200b00418fb7cf87bsi11551979edd.139.2022.04.05.18.10.02; Tue, 05 Apr 2022 18:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ub6lIl2m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356218AbiDEKXa (ORCPT + 99 others); Tue, 5 Apr 2022 06:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241254AbiDEIc6 (ORCPT ); Tue, 5 Apr 2022 04:32:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00C7262C9; Tue, 5 Apr 2022 01:30:43 -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 920DF609D0; Tue, 5 Apr 2022 08:30:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E8E9C385A0; Tue, 5 Apr 2022 08:30:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147443; bh=LxOndK3xUi3E/pPKh0wsCPb8uywQyc6fS8zHAp77ieM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ub6lIl2mUNgwso+jb3Yrmw5+W5abeblR79Z7aDtHbkfwSRT1QkeplOYwgC/ey3I4t DWo83AwBH3L4eVl5IUMgaV2OX2eetEiNaYUAoqk2ShQi3QUlhFcK876VFynduHaf7y pgU1OjPxIyFqajufRDN+EYknC+JUZ/Ysf7H3TqVE= 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.17 1124/1126] coredump: Remove the WARN_ON in dump_vma_snapshot Date: Tue, 5 Apr 2022 09:31:11 +0200 Message-Id: <20220405070440.417712317@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 @@ -1139,12 +1139,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;