Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4998284ybp; Mon, 7 Oct 2019 17:53:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7rjXcMJna/eUtqYQ3bt5JAQM0q1m45pXJWuNMKpieMAeO4vv++UJ6nCEPPeKEVE6ULFan X-Received: by 2002:a17:906:b84e:: with SMTP id ga14mr26436378ejb.215.1570496037858; Mon, 07 Oct 2019 17:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570496037; cv=none; d=google.com; s=arc-20160816; b=SIVSrW9g06JSzPWMGtN+o0ZgkjWvTsz+aBlOWXb/Z5UHCeKAN5n3JSgblcrg701VLy yAnzRS9SWFkVPN9menb3q5Bj47MFbg4WdjhsUrK5xo/7tNVVrOktMo957+qpxAZMReTA AShhoVAN6k1ysxMQYNZQ0qYHljNVNhGD5d5DD9lbE/UOdTW/EIZJ8gaQ1VvRGW3bBlrZ y9MjUFl1v0pU7jSvuEQYmsQJ/ptoS+9sHa7ye5OIws3Gsr2XwqMZ1I8xrjOG86ZhoQRQ asc4AziL9BDpL0AkfV8x9t1T8t/kBOND22nIunmHNQF+8b6+NU/w4kGIFY7ekboKiutd 5NMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=axeGqpfr6+WBOJhK9o80hxtWSzlwNphv8qzRJ2eavqQ=; b=naqQ4dQAK97/RzX9/rRaLYVwwCtieVP6eD4qIlD8MB9mWci7jVJdpcalNZch/JmJNE s9y2VQ506uvfbeEiNKRU+MR4Xmy9rMvGKJ5UVLTlkLhmk85OJJQDS1yNnsmpI2VIXgMP EcQ9WqdF+KrFDIinp691ngbpCu4dBV5uEzNhzzb11zN1L6YkWxN4eUnf7iQKtr8lcFAd 7n8cCUSrsvltRUdF3k++ZkdtSET/079g/gpkdjy6jqpfWW7s4mOjaBbkn3iCl4s3L2JI ++jqj3W7AQr+noEq+aKdiCz0ff2++qDaFu/7HmhsHeLc3NQo3l0b5U1RPaN3fTCHUDzp eIyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qVmPJN76; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4si7364063ejj.132.2019.10.07.17.53.34; Mon, 07 Oct 2019 17:53:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qVmPJN76; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729772AbfJHAuu (ORCPT + 99 others); Mon, 7 Oct 2019 20:50:50 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:34361 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729285AbfJHAuu (ORCPT ); Mon, 7 Oct 2019 20:50:50 -0400 Received: by mail-pl1-f194.google.com with SMTP id k7so7695215pll.1 for ; Mon, 07 Oct 2019 17:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=axeGqpfr6+WBOJhK9o80hxtWSzlwNphv8qzRJ2eavqQ=; b=qVmPJN76V7+IyYv7ojUmBLD30Dm2ha0LRJQd6sJpxtBmoUhbUJR6rhRwoW+qo1SQNW HemeuvA6y3d2XEOQV7rqf8Kq3UjftHoWArb7rENjbAkM0JI2Whde7+U/piSSkoJ09i24 UZMy7sigYFhmCfHkBIAdKEmi4WwtdpfZRx6VygLJQYvD1vdXZJQmvxl+4YhoMJLq8Edp WUdYqpDf6KnhjTOEE8IlcG2hc7/5IPmcqI+CLjXE1sT37Oq/H4rVvQ7JC9bVkkz7L9dP u711EW+OYDgdsMXAui2gSEKSxs1sjK8amOQv9z2m9rSq5Ww+fKbf5PHhD5brBDWwY6w+ yCCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=axeGqpfr6+WBOJhK9o80hxtWSzlwNphv8qzRJ2eavqQ=; b=NTamNpRChMkPPAI6DFxI1w+83LMYOQu85apFmGbyGR/+3qgoep6EuXFJOs6eXIRD9A v7AbjjOyJvtHywyZJoGEKn2yFpypZ6RCEHPlRftqG1KC1a0uxsUM5svbdUTQfIO4RxrK 9uB1fq3zpBOxa2UQ5dGXBC2HHY0ewBDqxMDUVWb9yLAS0wLfbrmUVbKGz5oDzEwDGrBG sA66Z/c+13jTE+W9gxeU+1+QNtTmfBlZpjknDSiLjAv9cdCvbcLCQLjXFkIMvCntV2Kl P5gbT5P7b35CGx6r8i0RYR09Gz3Augqnr9NfsEXRuCLALWTEVJJO6GHJ40xRP9hmVJHg 7q7Q== X-Gm-Message-State: APjAAAVy+dUfAk6Tyw+1sD4/5V2aLfQ962Z6m1KFsY1VCfFxxPJ9kfZo Gvj4DdNv4T7selnbv8cH0Ov1FA== X-Received: by 2002:a17:902:524:: with SMTP id 33mr32812268plf.123.1570495848323; Mon, 07 Oct 2019 17:50:48 -0700 (PDT) Received: from [100.112.81.222] ([104.133.9.110]) by smtp.gmail.com with ESMTPSA id d76sm16582383pfd.185.2019.10.07.17.50.46 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Oct 2019 17:50:47 -0700 (PDT) Date: Mon, 7 Oct 2019 17:50:31 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Laura Abbott cc: David Howells , Alexander Viro , Hugh Dickins , Linux-MM , Linux Kernel Mailing List , linux-fsdevel@vger.kernel.org Subject: Re: mount on tmpfs failing to parse context option In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 7 Oct 2019, Laura Abbott wrote: > On 9/30/19 12:07 PM, Laura Abbott wrote: > > Hi, > > > > Fedora got a bug report https://bugzilla.redhat.com/show_bug.cgi?id=1757104 > > of a failure to parse options with the context mount option. From the > > reporter: > > > > > > $ unshare -rm mount -t tmpfs tmpfs /tmp -o > > 'context="system_u:object_r:container_file_t:s0:c475,c690"' > > mount: /tmp: wrong fs type, bad option, bad superblock on tmpfs, missing > > codepage or helper program, or other error. > > > > > > Sep 30 16:50:42 kernel: tmpfs: Unknown parameter 'c690"' > > > > I haven't asked the reporter to bisect yet but I'm suspecting one of the > > conversion to the new mount API: > > > > $ git log --oneline v5.3..origin/master mm/shmem.c > > edf445ad7c8d Merge branch 'hugepage-fallbacks' (hugepatch patches from > > David Rientjes) > > 19deb7695e07 Revert "Revert "Revert "mm, thp: consolidate THP gfp handling > > into alloc_hugepage_direct_gfpmask"" > > 28eb3c808719 shmem: fix obsolete comment in shmem_getpage_gfp() > > 4101196b19d7 mm: page cache: store only head pages in i_pages > > d8c6546b1aea mm: introduce compound_nr() > > f32356261d44 vfs: Convert ramfs, shmem, tmpfs, devtmpfs, rootfs to use the > > new mount API > > 626c3920aeb4 shmem_parse_one(): switch to use of fs_parse() > > e04dc423ae2c shmem_parse_options(): take handling a single option into a > > helper > > f6490b7fbb82 shmem_parse_options(): don't bother with mpol in separate > > variable > > 0b5071dd323d shmem_parse_options(): use a separate structure to keep the > > results > > 7e30d2a5eb0b make shmem_fill_super() static > > > > > > I didn't find another report or a fix yet. Is it worth asking the reporter > > to bisect? > > > > Thanks, > > Laura > > Ping again, I never heard anything back and I didn't see anything come in > with -rc2 Sorry for not responding sooner, Laura, I was travelling: and dearly hoping that David or Al would take it. I'm afraid this is rather beyond my capability (can I admit that it's the first time I even heard of the "context" mount option? and grepping for "context" has not yet shown me at what level it is handled; and I've no idea of what a valid "context" is for my own tmpfs mounts, to start playing around with its parsing). Yes, I think we can assume that this bug comes from f32356261d44 ("vfs: Convert ramfs, shmem, tmpfs, devtmpfs, rootfs to use the new mount API") or one of shmem_parse ones associated with it; but I'm pretty sure that it's not worth troubling the reporter to bisect. I expect David and Al are familiar with "context", and can go straight to where it's handled, and see what's up. (tmpfs, very tiresomely, supports a NUMA "mpol" mount option which can have commas in it e.g "mpol=bind:0,2": which makes all its comma parsing awkward. I assume that where the new mount API commits bend over to accommodate that peculiarity, they end up mishandling the comma in the context string above.) And since we're on the subject of new mount API breakage in tmpfs, I'll take the liberty of repeating this different case, reported earlier and still broken in rc2: again something that I'd be hard-pressed to fix myself, without endangering some other filesystem's mount parsing:- My /etc/fstab has a line in for one of my test mounts: tmpfs /tlo tmpfs size=4G 0 0 and that "size=4G" is what causes the problem: because each time shmem_parse_options(fc, data) is called for a remount, data (that is, options) points to a string starting with "size=4G,", followed by what's actually been asked for in the remount options. So if I try mount -o remount,size=0 /tlo that succeeds, setting the filesystem size to 0 meaning unlimited. So if then as a test I try mount -o remount,size=1M /tlo that correctly fails with "Cannot retroactively limit size". But then when I try mount -o remount,nr_inodes=0 /tlo I again get "Cannot retroactively limit size", when it should have succeeded (again, 0 here meaning unlimited). That's because the options in shmem_parse_options() are "size=4G,nr_inodes=0", which indeed looks like an attempt to retroactively limit size; but the user never asked "size=4G" there. Hugh