Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4372094rdb; Thu, 14 Sep 2023 23:09:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG5jdwz/f+bVRnJX2WH2DmXTyWjQneNPWz4T4/Uh9dsmvcuSzmdgNQcm4a9c0OhwHP/kllk X-Received: by 2002:a05:6870:41d2:b0:1d5:6161:76f2 with SMTP id z18-20020a05687041d200b001d5616176f2mr924018oac.27.1694758179914; Thu, 14 Sep 2023 23:09:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694758179; cv=none; d=google.com; s=arc-20160816; b=0ihzxxXebtYLVwomU9eYiqrXBlbNIJnuW6Bm/FDmnlEoANmi5pwvmMos9a/uWfAWdh abqXRhUTilvZ73zN9Hh00rJ2373gKo3noeOLYgxGwiugU4SVN8yRK6hVbX/+btLL7yxN dWD6+7buh40gyLcVxVZxK90ArX6VCnyhkFH1VcvpcSyaQ+lXw53jaUFB2ZxnHh/syiVb NoIj8fHbI9RUhLWpPMc/IEziknwPepKtfwe4Ixu/rHMMdCUHFJiikQPvwtst3GUK1nDT PIpLyzuNIbgbkbgoxsQ2j/J8ep+kXfj/8v2iQgCqoCYT0IOcjsc52GznUFe7U53c5G23 ynCw== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=e7MNqTNKJW/iys2QVjGqosw9xMkAf0nvtsfBUxRDaK4=; fh=YiTLUA2YCHwlTb76jxNiwVUZE58iJKMrvTb22pc3w1A=; b=tgtBOIr8ZVauyN26JOTJn4cdRFh53MnHpbH+VwJs2Wh6/mPwUhw0Om0ZlbmLe4twRM yt+ZyRe+5iVMz+geKoQtpxzjnLglyJb0n+STr5XaUFgESLigNEEsBy68FP1AYtAvwEdl KBxIKlHE8sMQcC+2VrJYoXjypHCI9nNtTjyJJvQFCyE2KQsinfKWNxyo8UiYCOUxviFQ 6Hv37BzvZJe5qqQ4TQkfLU6iPqIz49EMVYqVj8ctaCEWnoB3mOImjGGUSqf6JurNF6D8 eP/4XncOG2g5Oj4HJ1j9fmKsYo3Er+vXSdVM4e7Ie9QE8ihRMtvZ29queysU9tIv1LFY 6ogQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Hbf+Gg6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id k24-20020a63ff18000000b00565e92e8734si2501567pgi.769.2023.09.14.23.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 23:09:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Hbf+Gg6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 5DA98829BD64; Thu, 14 Sep 2023 10:02:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238585AbjINRCL (ORCPT + 99 others); Thu, 14 Sep 2023 13:02:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237253AbjINRCJ (ORCPT ); Thu, 14 Sep 2023 13:02:09 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6937F1BDF; Thu, 14 Sep 2023 10:02:05 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1F43C433CA; Thu, 14 Sep 2023 17:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1694710925; bh=l8U0R882UtrX6c4wSnmZ8eAWwspRftMv3tML/Tshxmc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Hbf+Gg6+9qIT7vIuiysYz8LuPoX5GdeWLaoXfFpSEXKc6HOY00TmjolqH2cNyjeO3 p29VJ2yrJ9QX58uYaHmd+qllDetVqP+Spj5eKWL9OMjIuCIbAte82lBnWHIxMZswla WSaJsNGIdAPNQ8IMYHu6TLDcoMb3XSJwZGC/EtG8= Date: Thu, 14 Sep 2023 10:02:03 -0700 From: Andrew Morton To: Ben Wolsieffer Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Greg Ungerer , Oleg Nesterov , Giulio Benetti , Ben Wolsieffer Subject: Re: [PATCH] proc: nommu: /proc//maps: release mmap read lock Message-Id: <20230914100203.e5905ee145b7cb580c8df9c4@linux-foundation.org> In-Reply-To: <20230914163019.4050530-2-ben.wolsieffer@hefring.com> References: <20230914163019.4050530-2-ben.wolsieffer@hefring.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 10:02:16 -0700 (PDT) On Thu, 14 Sep 2023 12:30:20 -0400 Ben Wolsieffer wrote: > The no-MMU implementation of /proc//map doesn't normally release > the mmap read lock, because it uses !IS_ERR_OR_NULL(_vml) to determine > whether to release the lock. Since _vml is NULL when the end of the > mappings is reached, the lock is not released. > > This code was incorrectly adapted from the MMU implementation, which > at the time released the lock in m_next() before returning the last entry. > > The MMU implementation has diverged further from the no-MMU version > since then, so this patch brings their locking and error handling into > sync, fixing the bug and hopefully avoiding similar issues in the > future. Thanks. Is this bug demonstrable from userspace? If so, how?