Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp198124imm; Tue, 9 Oct 2018 16:25:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV629lxnAHMuEzIESMP7KFCrIkyCWemBaxsxBnA/vJHRjoOjbmMHJ7vPqPqagQefOJXA/ZcqX X-Received: by 2002:a62:1e83:: with SMTP id e125-v6mr32013024pfe.231.1539127534222; Tue, 09 Oct 2018 16:25:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539127534; cv=none; d=google.com; s=arc-20160816; b=XwvvgH922bV35T91NgFQCX8oQHfnmZWwR7yObbL/L+r+6WIqKtu110NMOZNBkhRk2X JIMeu3wSTWEPhnIGta5fvPfnj/6TZl3uR9Os7C9qDyf9yateNxNDEPgQUYgmgC9FeYDR cGVcyeLIUgOdQhugixpgdMhPGdhIcIxoDjfopDI9ac+pUvWgXE/1YwbKuq+mBmam0SeL M46J7zgVoitxyhemqFDGoPcPDPcw+sELgnTIPRSsgS9gTgEt7tDvlQbQefe9t4s4JT5u h08W4zkmG10EpEKEmAnt7NacaFuaxOJalpWzmcCNAB2TycY+YtUXUFi7T7XHnvcRUxsS /lIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=TWLbCMzTWpOUi3PzbduhVqhFNU7oRFiqOZzvUaxfwk8=; b=Z8CZPAqr1Hz5syjgxa3OfUC1eetaNdO+bWv47MXkO9tCx9SQy2Ki1MJkAyTQHk17K8 GeGuP9pSh/um0gEdq3oriXJFAJfMHN3xv6q8rUAM/ugNE+EUElLMRTccfOtiyfCMdC/g 9noWNw9AQZSSdkNXZ2Vy6Is22zD4Wj+pdDGu8TrMtET0XAyDgapFRl+OhggVlzki4jNk 2rzhy6i2BnXYmo5jrikQFPRnh0zenn5o0IS69zpkD5gjLTD5tHTY01ziaMGYFyqFmYPk lEwcsYPgnuLRyXwBttl51s5XYpy2p8tG/w3oVvHdVtvzZ+tL7/DoT6pD0E2JdQHGTyVa 6bsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15-v6si21585125pgg.529.2018.10.09.16.25.20; Tue, 09 Oct 2018 16:25:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726727AbeJJGjc (ORCPT + 99 others); Wed, 10 Oct 2018 02:39:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47250 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725748AbeJJGjc (ORCPT ); Wed, 10 Oct 2018 02:39:32 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 96BCFAC9; Tue, 9 Oct 2018 23:20:13 +0000 (UTC) Date: Tue, 9 Oct 2018 16:20:12 -0700 From: Andrew Morton To: Jan Kara Cc: john.hubbard@gmail.com, Matthew Wilcox , Michal Hocko , Christopher Lameter , Jason Gunthorpe , Dan Williams , linux-mm@kvack.org, LKML , linux-rdma , linux-fsdevel@vger.kernel.org, John Hubbard , Al Viro , Jerome Glisse , Christoph Hellwig , Ralph Campbell Subject: Re: [PATCH v4 2/3] mm: introduce put_user_page*(), placeholder versions Message-Id: <20181009162012.c662ef0b041993557e150035@linux-foundation.org> In-Reply-To: <20181009083025.GE11150@quack2.suse.cz> References: <20181008211623.30796-1-jhubbard@nvidia.com> <20181008211623.30796-3-jhubbard@nvidia.com> <20181008171442.d3b3a1ea07d56c26d813a11e@linux-foundation.org> <20181009083025.GE11150@quack2.suse.cz> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 9 Oct 2018 10:30:25 +0200 Jan Kara wrote: > > Also, maintainability. What happens if someone now uses put_page() by > > mistake? Kernel fails in some mysterious fashion? How can we prevent > > this from occurring as code evolves? Is there a cheap way of detecting > > this bug at runtime? > > The same will happen as with any other reference counting bug - the special > user reference will leak. It will be pretty hard to debug I agree. I was > thinking about whether we could provide some type safety against such bugs > such as get_user_pages() not returning struct page pointers but rather some > other special type but it would result in a big amount of additional churn > as we'd have to propagate this different type e.g. through the IO path so > that IO completion routines could properly call put_user_pages(). So I'm > not sure it's really worth it. I'm not really understanding. Patch 3/3 changes just one infiniband driver to use put_user_page(). But the changelogs here imply (to me) that every user of get_user_pages() needs to be converted to s/put_page/put_user_page/. Methinks a bit more explanation is needed in these changelogs?