Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp917435pxb; Wed, 6 Apr 2022 04:13:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLC2as7HQ/WUxv4zPiqV8H5vmCMe7ryBpC2lOEsL1b47alE/ZXm4X7LXrOkr1MH5AjBdch X-Received: by 2002:a17:90b:e0d:b0:1ca:b15b:7d4b with SMTP id ge13-20020a17090b0e0d00b001cab15b7d4bmr9212012pjb.91.1649243619830; Wed, 06 Apr 2022 04:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649243619; cv=none; d=google.com; s=arc-20160816; b=Z/3rYV/x++gwdF3hESgcqghBMkV/+f1oebviP7vi17qBCj+6+EndQfQX/1Wqdz3tHY l40Ma02t5EswnNwjmH3wP2KW8tcrKobK+kDmBh1cF2WLtDLNUYkDTsQs3jxe9+GT3sac Wvs2uG6j1fvJWJY8fr3D9BsNMsJhF6CouOmqoXsBr7tBkPLNf6rJ2yLQQlOJNJcBE9+t nnRk1bjxYIXZ5flNO3rmPkdLzwbglDorTKGQwxcU0PgzxQl1WoT4CurYi+Eepf3ntv5W UbLZhrghdU3w+aKQqXUZs6Rmub6N6AGQqgJgrKr8IyDG9DqTVv6wmcxiDmDfZHsTdcTV rRBQ== 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=UwJ9VmLt4rkU4cedSRwohRREBw9a0+KMHrxQVLUaXOQ=; b=Xa42rk/eF7F8+z90XPgysKyPu2pXJF62MHmLs0zQrbUdIK08/4ktfJVwnSOxuN93Or rfOLYifbJRdRZriYYIk2TBFNAgTaI4YVpUGr4W86+5Wcf7JBqab6A/l8Sw1POXTGf2qu 2jJmEQu/pmpuy9UkFszkT1wSQLeVPFlULZlPbyCR4sx1w50CeM0KxvXMErNNhD+489lj mtc6STbZL9b+JYbJx5Q737gQvu42Esn3nQ5Ld8y0H3Hj/hkccGVTRTTbHXde9/5UfZa6 VRcNitW61ITYKa3qlpgO9Pf6X9Y0RGH/t26aUHtm2TwS8uOuX1CsrCL2gbTj793uAsXd qhhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MujUOygy; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i20-20020a63e454000000b003990ddee901si10008035pgk.363.2022.04.06.04.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:13:39 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MujUOygy; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 094F75D61CC; Wed, 6 Apr 2022 02:38:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345139AbiDEXVU (ORCPT + 99 others); Tue, 5 Apr 2022 19:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354472AbiDEKOU (ORCPT ); Tue, 5 Apr 2022 06:14:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C7A76A424; Tue, 5 Apr 2022 03:00:33 -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 ams.source.kernel.org (Postfix) with ESMTPS id 2BA2AB818F6; Tue, 5 Apr 2022 10:00:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79F98C385A1; Tue, 5 Apr 2022 10:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152830; bh=57Bn+WXxIZqFBjJU2aM3gx6DzG/2oNf6AgrznRSIjW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MujUOygyI9DRrC1kdu3uuqhOxW4n788DYrjJjEOzuwTmgispIoHBhQXivbwKqg6QV NUtLJiQ+vrGcnsDs23+kcK4QYvl2HIWub2CaHMg0K2HLMgovBZti6P1rdHLx0o6TNX 0GunaTadQqaWYgWj375Tush3k1LeiIphYwz2r7O4= 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.15 911/913] coredump: Remove the WARN_ON in dump_vma_snapshot Date: Tue, 5 Apr 2022 09:32:53 +0200 Message-Id: <20220405070407.126814127@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 @@ -1151,12 +1151,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;