Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1252983pxb; Thu, 21 Oct 2021 19:33:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9iOqy+WhaZ+1l76FuJLd2Za85ZJaVlpvF1F/2rJ6FmpsKwCX2nHunZ+Xko7hlTcOVQ6e1 X-Received: by 2002:a05:6402:da:: with SMTP id i26mr13052909edu.207.1634869990574; Thu, 21 Oct 2021 19:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634869990; cv=none; d=google.com; s=arc-20160816; b=KdFDomgGxZrcnEN3pdhfuKiqFQJHdXCVWpBHBAvesDSdhq2cw8xdgeH5tLw1FZ2WV+ HHoiwbfyfKKOTAFUQrxYH5KSCb1CR2MlW7mzzN5LEn+Y+yfN+e/8qwq4gS7RGF3D8Yua C3LmTyW2OVNdLlmc8Z6s0CAgKS9rLx5ulnWGdUXOwwSrxyYSvjm9o3nXRbfyLOrMIbzZ VA1L3kd1tGBd+yBuXtp3RW7C5lT4yG6a52Yai5Afacw3FDILQD9qbsGOrc6XTKBpdwBn D7DM1S2km5mvwGVn5yWof9WazJP3YUHRYgCb0qlxvL/6BRtwywvo/KCH5Wy2c4XU5wCX b3IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cbgzVLDCT8DipeBdsMkDowoxxylwz2da/ifUpbOh8z0=; b=ugivfLbUtEfIpjgMf14Acl6AVyWG2cJ1+6CP7vcwPc63fYGDVycVpILoNz72tWthKq +zTTlube08ZDeWiLLEeF5CScwiEz0r9RsIDzZno9Vv296WBkxgnaFG2gh9PyfZpzrHQR GMEZvpN2tqdLKYaWbbZtrCCgPdOvg5i3Qso+pm1p7UTZ8xxcoL8eXoS44l8hrnrYURIP MLthRlsQtpJt6bpmBwhxBS2HBZgLRnlXay+ur1Pzg5uTRGMYRrjg1PGq8k3UOHDk5RoY SRFNEZbIJ05dKxgp+UKYpZdzm9XOQKuhXEh4n/pek/WXryaJT9q60J+ok+sG9cxWKLQx HfHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="aYdcT/n7"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id au15si9370545ejc.717.2021.10.21.19.32.47; Thu, 21 Oct 2021 19:33:10 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b="aYdcT/n7"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbhJVCdH (ORCPT + 99 others); Thu, 21 Oct 2021 22:33:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231944AbhJVCdH (ORCPT ); Thu, 21 Oct 2021 22:33:07 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13BFFC061764 for ; Thu, 21 Oct 2021 19:30:50 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id p16so264444lfa.2 for ; Thu, 21 Oct 2021 19:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cbgzVLDCT8DipeBdsMkDowoxxylwz2da/ifUpbOh8z0=; b=aYdcT/n7CqiA/S03OD1v/gZ0kFeK1PDL0lbPxqn104neWrT3qjy5Y6eL+8vHQrxt+h oDvWfNFAoUdvOICh0XHKZOWmwBJf6fUUWWLjSlhQrvjMiomhUTFGWClWL1HzZ9q2WL4O 1ego9HzyYIvaXZ0i0rLIDMjdtPo9LTw/DYSYY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cbgzVLDCT8DipeBdsMkDowoxxylwz2da/ifUpbOh8z0=; b=aMfZ71r99GUN4bpbfHQBd3GnHfs+g0E/ieR+sumOAYUGNSLQaDiZRECl+QRxTdXTAg KVjNysu5bzPEP9ehToqfz+5LBf9ki9c8grQTdDgA5zmUAE/HA9Htut6b7Mekc73h3Ajr YWbr8KOApijrvIVo2L0sZ8UB1n1PUYCz23gDYQkcCXpUvPoVD1GGdYpScTXEqtZ2fiOO 3OXEHKqc2JO3nRJhDsbOj74RBeOIK3pO82Pvf9OwvZQDYdy3IfEeKkjnSwpvXcnEu2xc FDZooK2XZ6ifqLRQbKCOtwcByD/7ieVHzkLcnmT9jjhfVbILZkqMLWaPare+2O/ikf2d C0dg== X-Gm-Message-State: AOAM532U0M/7uT49mAXQXp47A202+ClUN3pbsi0jd8AAc0WqSom/CE+E IfIHdDZJMgPxVD0WWNIQPcNit7Gf9OCLA1TL X-Received: by 2002:a05:6512:692:: with SMTP id t18mr8594543lfe.572.1634869848135; Thu, 21 Oct 2021 19:30:48 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id g5sm603923lfr.115.2021.10.21.19.30.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Oct 2021 19:30:47 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id s19so2324075ljj.11 for ; Thu, 21 Oct 2021 19:30:46 -0700 (PDT) X-Received: by 2002:a2e:a407:: with SMTP id p7mr10376944ljn.68.1634869846779; Thu, 21 Oct 2021 19:30:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Thu, 21 Oct 2021 16:30:30 -1000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][arm64] possible infinite loop in btrfs search_ioctl() To: Andreas Gruenbacher Cc: Catalin Marinas , Al Viro , Christoph Hellwig , "Darrick J. Wong" , Jan Kara , Matthew Wilcox , cluster-devel , linux-fsdevel , Linux Kernel Mailing List , "ocfs2-devel@oss.oracle.com" , Josef Bacik , Will Deacon Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 4:42 AM Andreas Gruenbacher wrote: > > But probing the entire memory range in fault domain granularity in the > page fault-in functions still doesn't actually make sense. Those > functions really only need to guarantee that we'll be able to make > progress eventually. From that point of view, it should be enough to > probe the first byte of the requested memory range That's probably fine. Although it should be more than one byte - "copy_from_user()" might do word-at-a-time optimizations, so you could have an infinite loop of (a) copy_from_user() fails because the chunk it tried to get failed partly (b) fault_in() probing succeeds, because the beginning part is fine so I agree that the fault-in code doesn't need to do the whole area, but it needs to at least do some thing, to handle the situation where the copy_to/from_user requires more than a single byte. Linus