Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1678158pxb; Wed, 20 Oct 2021 09:38:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrFA/Tv47UsVzgKbSxUarMgncIZqjlixyTGLryxFaAwl+9nnNXCks4e9BF9F/bMC9To8Ic X-Received: by 2002:a17:902:f551:b0:13e:fb56:f519 with SMTP id h17-20020a170902f55100b0013efb56f519mr107373plf.0.1634747921251; Wed, 20 Oct 2021 09:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634747921; cv=none; d=google.com; s=arc-20160816; b=RiEfbYeBjnbEzzPlzOAqxA9hvdHQOJ7NSQBiN2Tr+Dzqj6TQPB24kKO3btqK2JoWYn NM2PocMw3R1PZJ+X7PrRU8FxoCdb3L6kR9ap6v+r4Y+8miwuL6xZzjMY0Yn4OGZ7gnQ7 abUa5KjxpubjidaXNmoFl94xM/nmtGMpeCKSB1KfXB4XbXXuNBwAcEgjCaHs/kYxq5Bj WpaggDqcMD0foqOrJzErkizYkhGDJ6IEIZpXpkfc2nmSur8u3DCMQaHEDRgZUZic0RyD hoNolr1NkIw9R6monNxGqru1j8oQoma+aJSLAvEjxVgYWCi1vEgCNv1belSY3Z4wlW5n Y1zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=hXg1jQpkThPvWV0ZSRA59lrOc3bmiGWclmMJgiLwbrk=; b=tPBx6QnswbbMkm82id0i9vLkafEOpt1HqbRSJWWZ3GV5KRYWf/aXaGBhrwPGCfbyD1 1fYTHLc92uQM14455t8xCq43hEVIYB7iZ+gRHEHmIr81i4oheo+1S4bJ2ldeQgmU2YO3 PS4iM8ztOxyj0FXoOmVFfO4Jo3qSks9T6nW2EHVM+i4dKh0txy20EPCwV/kagqMMoR/j XLuA7h5kIbxiFelQwh5pJ3r3DEgbY/RcdT2m8EEhKSPoN9F/v2YAmpuXxLdNrdeLUHeE cd/WZYRDJWc2apDQc3xdVTP6yW3qQMalFW65o4zK/rjmw/RGmdIcnLs6ZO91P770RTG6 a8+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh15si12439178pjb.13.2021.10.20.09.38.24; Wed, 20 Oct 2021 09:38:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230196AbhJTQjU (ORCPT + 99 others); Wed, 20 Oct 2021 12:39:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:38124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbhJTQjR (ORCPT ); Wed, 20 Oct 2021 12:39:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0616061374; Wed, 20 Oct 2021 16:36:59 +0000 (UTC) Date: Wed, 20 Oct 2021 17:36:56 +0100 From: Catalin Marinas To: Linus Torvalds Cc: Andreas Gruenbacher , Paul Mackerras , Alexander Viro , Christoph Hellwig , "Darrick J. Wong" , Jan Kara , Matthew Wilcox , cluster-devel , linux-fsdevel , Linux Kernel Mailing List , ocfs2-devel@oss.oracle.com, kvm-ppc@vger.kernel.org, linux-btrfs Subject: Re: [PATCH v8 00/17] gfs2: Fix mmap + page fault deadlocks Message-ID: References: <20211019134204.3382645-1-agruenba@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 05:40:13AM -1000, Linus Torvalds wrote: > On Tue, Oct 19, 2021 at 3:42 AM Andreas Gruenbacher wrote: > > * Will Catalin Marinas's work for supporting arm64 sub-page faults > > be queued behind these patches? We have an overlap in > > fault_in_[pages_]readable fault_in_[pages_]writeable, so one of > > the two patch queues will need some adjustments. > > I think that on the whole they should be developed separately, I don't > think it's going to be a particularly difficult conflict. > > That whole discussion does mean that I suspect that we'll have to > change fault_in_iov_iter_writeable() to do the "every 16 bytes" or > whatever thing, and make it use an actual atomic "add zero" or > whatever rather than walk the page tables. But that's a conceptually > separate discussion from this one, I wouldn't actually want to mix up > the two issues too much. I agree we shouldn't mix the two at the moment. The MTE fix requires some more thinking and it's not 5.16 material yet. The atomic "add zero" trick isn't that simple for MTE since the arm64 atomic or exclusive instructions run with kernel privileges and therefore with the kernel tag checking mode. We could toggle the mode to match user's just for those atomic ops but it will make this probing even more expensive (though normally it's done on the slow path). The quick/backportable fix for MTE is probably to just disable tag checking on user addresses during pagefault_disabled(). As I mentioned in the other thread, a more elaborate fix I think is to change the uaccess routines to update an error code somewhere in a similar way to the arm64 __put_user_error(). But that would require changing lots of callers. -- Catalin