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 9436EE7D0A8 for ; Thu, 21 Sep 2023 19:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229603AbjIUTX2 (ORCPT ); Thu, 21 Sep 2023 15:23:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjIUTX1 (ORCPT ); Thu, 21 Sep 2023 15:23:27 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E846EBFDA for ; Thu, 21 Sep 2023 12:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:To:From:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6MZo+bKI+dkoYi+eqghinL9pk/+RSKBqGz2KYE0utpQ=; b=vOUlNLA6gi6a77sf2a0EMWckIP U9SHkHm+2Ygh0/Ah0iOCqkXL+Q9MJnpMzwujpsaaKzddIpbufoI1ZZjuhzYy8CTSQHV0JtHP+QHE2 Mjc1JreF0no05YKJsaedmmM2QTiWRz8NhUT15qBdDM+pC1obKAsgedMG/pqOfSXy8T82YpIRjLMqH dJWgKiuOLGD+C/CDbuwhanZu+MQV5DrIjRkc4DMVn3eno1+INzdcABA6w1JXHckVzOt+eg0xbmIaX dg/sSNwrRLkURkrtHhhUdt0FDUWmbZfCBBvT9ayCs6GGdCKJLV55RVSuO2tTIptgusgWxCajx3tgl +UPxL0Kw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qjPGZ-00DgWf-2C; Thu, 21 Sep 2023 19:23:11 +0000 Date: Thu, 21 Sep 2023 20:23:11 +0100 From: Matthew Wilcox To: "Liam R. Howlett" , Andrew Morton , maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pedro.falcato@gmail.com, stable Subject: Re: [PATCH 0/2] maple_tree: Fix mas_prev() state regression. Message-ID: References: <20230921181236.509072-1-Liam.Howlett@oracle.com> <20230921112521.fc07c658804f4e188179da77@linux-foundation.org> <20230921185330.j5jw3oms4tc6crkf@revolver> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230921185330.j5jw3oms4tc6crkf@revolver> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 21, 2023 at 02:53:30PM -0400, Liam R. Howlett wrote: > * Andrew Morton [230921 14:25]: > > On Thu, 21 Sep 2023 14:12:34 -0400 "Liam R. Howlett" wrote: > > > > > Pedro Falcato contacted me on IRC with an mprotect regression which was > > > bisected back to the iterator changes for maple tree. Root cause > > > analysis showed the mas_prev() running off the end of the VMA space > > > (previous from 0) followed by mas_find(), would skip the first value. > > > > > > This patch set introduces maple state underflow/overflow so the sequence > > > of calls on the maple state will return what the user expects. > > > > It isn't clear what are the user-visible effects of this flaw? Please > > send this along and I'll paste it in. > > > User may notice that mas_prev() or mas_next() calls that result in going > outside of the limit passed to the call will cause incorrect returns on > subsequent calls using that maple state, such as mas_find() skipping an > entry. When Andrew says "User visible" he means "userspace visible". Not "in kernel user visible". What are the _consequences_. I'd say that if the user maps something at address 0, mprotect() can then fail to ... or something.