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 X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E302C433E0 for ; Mon, 18 May 2020 12:45:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BD5362067D for ; Mon, 18 May 2020 12:45:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="OW/PsWN6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD5362067D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=szeredi.hu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 66C42900002; Mon, 18 May 2020 08:45:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6433180005; Mon, 18 May 2020 08:45:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58043900004; Mon, 18 May 2020 08:45:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0130.hostedemail.com [216.40.44.130]) by kanga.kvack.org (Postfix) with ESMTP id 41C79900002 for ; Mon, 18 May 2020 08:45:16 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E4379181AEF15 for ; Mon, 18 May 2020 12:45:15 +0000 (UTC) X-FDA: 76829810190.07.sense59_853383fe8304c X-HE-Tag: sense59_853383fe8304c X-Filterd-Recvd-Size: 4409 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Mon, 18 May 2020 12:45:15 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id l25so3639554edj.4 for ; Mon, 18 May 2020 05:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rPrxUG2VzBC+d21iH+Uuo13Up0+FO8AW/wuv49py0mM=; b=OW/PsWN6Hoegb00/LQ25omfqqozJIUQRjqg07PKl4CMUSwLli48y5IpA5+eah0tB8n h3Nsrci462IEhg2uDMGdoBRmDyYVSJi6fmZnEGqkSulY3YDlUST1tyLFaU2DilgVhnlS Walu9a5WIvRHHQdStNb7uZsOPs0bC19r5fMh0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rPrxUG2VzBC+d21iH+Uuo13Up0+FO8AW/wuv49py0mM=; b=sqlNvbQdFd1apPQ7Lne36axd8+ktBVL9J8xlo9lWAwnS5DzUjIzJMCby+iJXvcMuN0 Y9LmqYDt1VvvkHbniYMtBXHYWSADjM+yL11kPGwuxus7hJ7tV2v2+AHUZ1x/u4UkjfTs dr02SFisrUdJVO8fRba2egLyK4RB/DvmWIplmFgnaSH70DeRBiccE6u3O7+dOqruF9SS +o2Frf5zG2vdXB2I3oXvH2363bZsZ9MM+iYeNdc4pEvpqetcQt00ebdmGWJpm8jddKDj 76hVO9JydDPY0o1b5Uf1pfF4goa0rTVAPU4Btv4J+Gp7UFpCpSqvujpwqGWSBD7U++Kw 3PAQ== X-Gm-Message-State: AOAM532aP+4fy5BL20Rf/1mL+j0t/Whs0Ic4eb8TTbGXxehyz11ZwYvT bt/XXneVR5FEvafDU+JoBo3Rp/EEJcovvegoAgsQmQ== X-Google-Smtp-Source: ABdhPJxxkHRnK0QwvUUSI41SvwLvfgHTYQktHFViaMEDjF9HrsxR+il1tnZE0kfZJEv5vs8Q3zbQm2M7bzD68wUjds8= X-Received: by 2002:a05:6402:3076:: with SMTP id bs22mr4131739edb.161.1589805913768; Mon, 18 May 2020 05:45:13 -0700 (PDT) MIME-Version: 1.0 References: <87a72qtaqk.fsf@vostro.rath.org> <877dxut8q7.fsf@vostro.rath.org> <20200503032613.GE29705@bombadil.infradead.org> <87368hz9vm.fsf@vostro.rath.org> <20200503102742.GF29705@bombadil.infradead.org> In-Reply-To: <20200503102742.GF29705@bombadil.infradead.org> From: Miklos Szeredi Date: Mon, 18 May 2020 14:45:02 +0200 Message-ID: Subject: Re: [fuse-devel] fuse: trying to steal weird page To: Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, fuse-devel , linux-mm , miklos , Gabriel Krisman Bertazi , =?UTF-8?Q?Andr=C3=A9_Almeida?= Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, May 3, 2020 at 12:27 PM Matthew Wilcox wrote: > > On Sun, May 03, 2020 at 09:43:41AM +0100, Nikolaus Rath wrote: > > Here's what I got: > > > > [ 221.277260] page:ffffec4bbd639880 refcount:1 mapcount:0 mapping:0000000000000000 index:0xd9 > > [ 221.277265] flags: 0x17ffffc0000097(locked|waiters|referenced|uptodate|lru) > > [ 221.277269] raw: 0017ffffc0000097 ffffec4bbd62f048 ffffec4bbd619308 0000000000000000 > > [ 221.277271] raw: 00000000000000d9 0000000000000000 00000001ffffffff ffff9aec11beb000 > > [ 221.277272] page dumped because: fuse: trying to steal weird page > > [ 221.277273] page->mem_cgroup:ffff9aec11beb000 > > Great! Here's the condition: > > if (page_mapcount(page) || > page->mapping != NULL || > page_count(page) != 1 || > (page->flags & PAGE_FLAGS_CHECK_AT_PREP & > ~(1 << PG_locked | > 1 << PG_referenced | > 1 << PG_uptodate | > 1 << PG_lru | > 1 << PG_active | > 1 << PG_reclaim))) { > > mapcount is 0, mapping is NULL, refcount is 1, so that's all fine. > flags has 'waiters' set, which is not in the allowed list. I don't > know the internals of FUSE, so I don't know why that is. > > Also, page_count() is unstable. Unless there has been an RCU grace period > between when the page was freed and now, a speculative reference may exist > from the page cache. So I would say this is a bad thing to check for. page_cache_pipe_buf_steal() calls remove_mapping() which calls page_ref_unfreeze(page, 1). That sets the refcount to 1, right? What am I missing? Thanks, Miklos