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=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 1F249C433E0 for ; Tue, 16 Jun 2020 09:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 985692074D for ; Tue, 16 Jun 2020 09:01:29 +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="bxLzhhZK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726805AbgFPJB2 (ORCPT ); Tue, 16 Jun 2020 05:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbgFPJB1 (ORCPT ); Tue, 16 Jun 2020 05:01:27 -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 C099FC05BD43 for ; Tue, 16 Jun 2020 02:01:26 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id t21so13656757edr.12 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=H1saFEC/K/wswdQmIciAhESIUf8tiE8P8dRwMgZ+LYouJD5BiOPrEMo5g71JWVN/sf 5b3px+OmPoU5ZB2tqt+V0uNniXJOCpn81tlFCjWvKAbOf0xKzbg7qn3lG/ZFAzg06r8d G7AxmK9ymBsz6f2i5Y541orQ5SXVFh9+M0tEsx5PXeCbeItVSA7XnS4t21T0V9sj/Gye /mWlC9Lee37kzjnqhj0TFCXosIbv63rzIeGzyPJPddS2Lv2x+BCQNaHq456ClmPSkgJe baQR6vTWlTR9cgthNzPacBHH1o7QqrPOVzXCv5OfJhygHPORkNoaHLHvX8VvksaWII+b IDyQ== X-Gm-Message-State: AOAM530k9OPAK1RJJuWrhgNeyZzC/nIz8mZCN6003bhuj8x8g08Q03Ki vFVFaY6DKbrSTFm5XGDCe3kxzonN/ogPX8H54BqWAg== X-Google-Smtp-Source: ABdhPJxNZWipYKKlR5OtEfpmzoc47S3PROSEQ+F2abrhpsMM+Wm0j4MqqdQ3IOWc1jhXe+AWNF/jZwF6otlN3W9Mtwg= 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-unionfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-unionfs@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 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=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 DCD81C433E0 for ; Tue, 16 Jun 2020 09:01:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6998220767 for ; Tue, 16 Jun 2020 09:01:32 +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="bxLzhhZK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6998220767 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 BA5B26B0003; Tue, 16 Jun 2020 05:01:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B2F886B0008; Tue, 16 Jun 2020 05:01:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F7F06B0031; Tue, 16 Jun 2020 05:01:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0238.hostedemail.com [216.40.44.238]) by kanga.kvack.org (Postfix) with ESMTP id 7EEFE6B0003 for ; Tue, 16 Jun 2020 05:01:31 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 31BE9824CA0A for ; Tue, 16 Jun 2020 09:01:31 +0000 (UTC) X-FDA: 76934481582.01.kick51_090134226dfd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 13FD820000D90BF2 for ; Tue, 16 Jun 2020 09:01:27 +0000 (UTC) X-HE-Tag: kick51_090134226dfd X-Filterd-Recvd-Size: 6113 Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Tue, 16 Jun 2020 09:01:26 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id p18so13664996eds.7 for ; Tue, 16 Jun 2020 02:01:25 -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=MwtGxtZxi3fxtBC31rsGOq87tA7Aih2zldK6fvyMYpsE517mVA9HkCdrMpJpUFN+jc y7rQPiAVd8c7y5D2CBV+pcOCdeiARfbKbMn3UTPlnPPcykmrnAyvXyJ/BmtToTkuAqRl MKKwIe0zOv5lqOJDUudz/O6538WVl5IgEPFDLYi70MAchoHEl0Q9UD65leijY4mapZB8 ++kkTXCRWQ7ryg0vl7X2DgYkYIV5hevK2iawrfDGV+Jha1+ZXLf9LPAJQvXznj9C8smp BKCShVOI9YtOjeK1MzUMH5h8FZeD8FGdaxe9J43gNS6jkmCQ9y1vu7mCsdNpyzsGyBIN Hx0Q== X-Gm-Message-State: AOAM532eCL/NjGVsTh4bgSz0mHSLy/R2SdrFsnW1HkVSJR14w2sVpDZW mmsYqAFaCq+23GLcIXbNzKohIj1RnLEXLZZyHv/nPpAxkai+wQ== X-Google-Smtp-Source: ABdhPJxNZWipYKKlR5OtEfpmzoc47S3PROSEQ+F2abrhpsMM+Wm0j4MqqdQ3IOWc1jhXe+AWNF/jZwF6otlN3W9Mtwg= 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" X-Rspamd-Queue-Id: 13FD820000D90BF2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 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