Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2290737ybt; Tue, 16 Jun 2020 02:05:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ/3Vx2cXlJv53oQ7G1JtX4pa4DhupLR+yWSaCFM+Ey8JR2upX15L6CE3335iChj0Mrbwq X-Received: by 2002:aa7:d79a:: with SMTP id s26mr1670007edq.202.1592298341709; Tue, 16 Jun 2020 02:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592298341; cv=none; d=google.com; s=arc-20160816; b=yEkYolsTvT8XUqq8H517xyyeqHcG+aDFT1ohvdw08EJnR7TopkA95sbVcxDeUUnnhE YZG8vRtF/hCSVXqjJ5p7WRY3MtOyGUS39LxzTiTVejiIy7G1OQE4WdjbNAhBg1sksiqL qzkBaXmT29q3lLTzHbw0wbqngPliUgC80ch9h+j5cwwq+YqJmIYsQcitMgYxUN+sfNkq See336QouozKtxgzcmCTpvantnSeWwsJTJwfs5uFwQsX6p6SCphf7jCLCFGnA9uhbDun SjTUHiJRiIZ+tPPY+hacJ+dRzDHX2PyT8A8RveBDK7EzvFNk/oLIlNL/4moupaXADQxJ 4ZXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IXqJ+RQf+2HxRMU1JHbm735Et9Rb/a777XiyMXnrkuA=; b=lKX7zve2LQkc99gHukf5H98+u+imkOFACc9FNzURHE8kmqfN9wY7ANIaNQJ5a39Cdp y6dyXJe7YzpPL41n0v4EOgq9k3kXizWoEC0VWVQuYmpDZzOf/GF1cFJn8FugIWLJqaUH c/agxN7aXSOGWjr+iNgoAcfaQLcksGanuGfmqZOVVqKWe57rxeeczLBtrJZmPPjYTzuE +KyQu8EryU38R/8kc51iTiLiqo6nymQlNU0CGPxVYxTmwy5cIQM8jx8VPYp5xm08OTrK gMX4KNEp7BlLMKKeM9wApn1qb8RQ0Cy6zo2aEn8LVpJtuwy0ymk2wp0Ra6tFGTOzpx5L EmmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=bxLzhhZK; 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 d12si569469ejw.465.2020.06.16.02.05.17; Tue, 16 Jun 2020 02:05: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; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=bxLzhhZK; 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 S1727065AbgFPJB3 (ORCPT + 99 others); Tue, 16 Jun 2020 05:01:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726692AbgFPJB2 (ORCPT ); Tue, 16 Jun 2020 05:01:28 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8EA9C03E96A for ; Tue, 16 Jun 2020 02:01:26 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id d15so13662074edm.10 for ; Tue, 16 Jun 2020 02:01:26 -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=IXqJ+RQf+2HxRMU1JHbm735Et9Rb/a777XiyMXnrkuA=; b=bxLzhhZKjFFEansW2CGWHfG43cgQwpbnzVH6qLEiCQ6gnKC8IHUTIhAz5n77Wm/Pml vWSTFMw+eyqstHjZVU9rHtwv+RLIFJZ0lHZc4ybESxoAFssGZ2LqrEPRKi83kpCIP8FU MXSgw6fwsQP4d6rGNtDVWkB2gncPjCUybm6Yk= 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=IXqJ+RQf+2HxRMU1JHbm735Et9Rb/a777XiyMXnrkuA=; b=Rux82woFY68oe4UbmqIDDNTbLB48WwFhMhGzqD4kgm9dxCglCgIhl+wqP4RiN9e5lp XiWQMZKPkuOhyhc41BDoD18GZ2Z00ZFRo+lIFxpIQif5Ovv3WxOnsO3D2cfnYmnAVFiw B3ASkkso0RvWBCF5fovqQdMZIT7sx0oEn5qMPMDfCzlmrRMtSr1i4uQzrhgysd/Wr/m9 RetbMGgTSQxDC3N7XVY6nbcA7vLch3GNx/B3qn1nAd4QGEwti1u47qfTyg2HXAq7pS3y rxsDn8Ae6eGHhy+c+5FR/YJLHVye+UW7fTAwpNHk0OCra7ATIyNLv704VSb6936KGDMk tkDw== X-Gm-Message-State: AOAM530WOwuftzo1gwFbzOpcKTSin0n886wMNHJDP99wP6O0IwiicXU2 FiyZsRIUbFpjz0qwHEqWhPvtp0iDiUPWEvnd/QMgwA== X-Received: by 2002:aa7:d9d3:: with SMTP id v19mr1550941eds.364.1592298084726; Tue, 16 Jun 2020 02:01:24 -0700 (PDT) MIME-Version: 1.0 References: <20200612004644.255692-1-mike.kravetz@oracle.com> <20200612015842.GC23230@ZenIV.linux.org.uk> <6e8924b0-bfc4-eaf5-1775-54f506cdf623@oracle.com> <80f869aa-810d-ef6c-8888-b46cee135907@oracle.com> In-Reply-To: <80f869aa-810d-ef6c-8888-b46cee135907@oracle.com> From: Miklos Szeredi Date: Tue, 16 Jun 2020 11:01:13 +0200 Message-ID: Subject: Re: [PATCH v4 1/2] hugetlb: use f_mode & FMODE_HUGETLBFS to identify hugetlbfs files To: Mike Kravetz Cc: Amir Goldstein , Al Viro , Linux MM , linux-fsdevel , overlayfs , linux-kernel , Matthew Wilcox , Colin Walters , Andrew Morton , syzbot , syzkaller-bugs Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 16, 2020 at 1:45 AM Mike Kravetz wrote: > > On 6/15/20 12:53 AM, Miklos Szeredi wrote: > > On Sat, Jun 13, 2020 at 9:12 PM Mike Kravetz wrote: > >> On 6/12/20 11:53 PM, Amir Goldstein wrote: > >>> > >>> The simplest thing for you to do in order to shush syzbot is what procfs does: > >>> /* > >>> * procfs isn't actually a stacking filesystem; however, there is > >>> * too much magic going on inside it to permit stacking things on > >>> * top of it > >>> */ > >>> s->s_stack_depth = FILESYSTEM_MAX_STACK_DEPTH; > >>> > >>> Currently, the only in-tree stacking fs are overlayfs and ecryptfs, but there > >>> are some out of tree implementations as well (shiftfs). > >>> So you may only take that option if you do not care about the combination > >>> of hugetlbfs with any of the above. > >>> > >>> overlayfs support of mmap is not as good as one might hope. > >>> overlayfs.rst says: > >>> "If a file residing on a lower layer is opened for read-only and then > >>> memory mapped with MAP_SHARED, then subsequent changes to > >>> the file are not reflected in the memory mapping." > >>> > >>> So if I were you, I wouldn't go trying to fix overlayfs-huguetlb interop... > >> > >> Thanks again, > >> > >> I'll look at something as simple as s_stack_depth. > > > > Agree. > > Apologies again for in the incorrect information about writing to lower > filesystem. > > Stacking ecryptfs on hugetlbfs does not work either. Here is what happens > when trying to create a new file. > > [ 1188.863425] ecryptfs_write_metadata_to_contents: Error attempting to write header information to lower file; rc = [-22] > [ 1188.865469] ecryptfs_write_metadata: Error writing metadata out to lower file; rc = [-22] > [ 1188.867022] Error writing headers; rc = [-22] > > I like Amir's idea of just setting s_stack_depth in hugetlbfs to prevent > stacking. > > From 0fbed66b37c18919ea7edd47b113c97644f49362 Mon Sep 17 00:00:00 2001 > From: Mike Kravetz > Date: Mon, 15 Jun 2020 14:37:52 -0700 > Subject: [PATCH] hugetlbfs: prevent filesystem stacking of hugetlbfs > > syzbot found issues with having hugetlbfs on a union/overlay as reported > in [1]. Due to the limitations (no write) and special functionality of > hugetlbfs, it does not work well in filesystem stacking. There are no > know use cases for hugetlbfs stacking. Rather than making modifications > to get hugetlbfs working in such environments, simply prevent stacking. > > [1] https://lore.kernel.org/linux-mm/000000000000b4684e05a2968ca6@google.com/ > > Reported-by: syzbot+d6ec23007e951dadf3de@syzkaller.appspotmail.com > Suggested-by: Amir Goldstein > Signed-off-by: Mike Kravetz Acked-by: Miklos Szeredi Thanks, Miklos