Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp759226imm; Wed, 17 Oct 2018 07:55:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Q3t7B0Y9LTPy9sKpWAr6Wl8DrOOI4e0mXvszf2Ij0yH72BALGzO8jMCQ3CVXsFFG02LaD X-Received: by 2002:a63:6c4a:: with SMTP id h71-v6mr24488156pgc.326.1539788154255; Wed, 17 Oct 2018 07:55:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539788154; cv=none; d=google.com; s=arc-20160816; b=DULkvtnwTFmw8juNebmWvtL8dBLj9jYS9aA2jd0BcHoqeK9mrMcge/ZW5hAVrb8NDM ZqJkUhA3PHh7Uod2WKOlGDt0fDMXVoH0Y/PWnfLr/W7arA/diGOXsXQFGLOIWMGP2Hcm kiHMK/3T74NqkjwcU9X7fwVvxQcd6Hq4JGrnRgXF+GSaNPjHsa2OzRw2CmNa+RcxJcnM yuFJyTEmHbdJoCso5izbp8QJnoykmbs2x71XXc0w+O5pPteXdzS+oCdOqXqibQkLIZ3O 2J9Flykk1SZm4H6+urblJ1n8HdbFw72+k1Yc37LykEKFa3x/Qs5twd4lEWVJak5q1cs+ qnmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=bVSv5kvJGnsBnF4fTs51dmvQZ2ELFeKwYI05LDwB3bc=; b=C7Tjtv/1Xp4HVr+ObhS4nNIVuok8HRHodV9G7Bq0lDuGKGtY9Q1uQgXNjug2lTwO2O RLCZrjzNkgO2VZLRznvjYbeszZ5PU0ylNLiXgrNxcUNUEQE0Y97bqmgQBAEKDJ6eHjeO jbIGU4UgzaJIA1MOoegSfX73hB8Re1Hu2HH4ib4yDWVaSVyr6MBH9cLcv7szeW8PjCyg mjjzZ1HpJMtEw+04mZw0kibRJUjCy/JJEzZkTeU27U6D45r25D+zdePOZ/GCT2/0Y5e7 TsB9DIhsr1+1UZTlZapwycRgGXJ+SoLghwrYzu7Vp3wxfA2RKtxoz4K6Yi0TLgEjeiVb 7ibw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sZKK+4RO; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 19-v6si17603018pgh.6.2018.10.17.07.55.38; Wed, 17 Oct 2018 07:55:54 -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=@gmail.com header.s=20161025 header.b=sZKK+4RO; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727567AbeJQWvT (ORCPT + 99 others); Wed, 17 Oct 2018 18:51:19 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55031 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727000AbeJQWvS (ORCPT ); Wed, 17 Oct 2018 18:51:18 -0400 Received: by mail-wm1-f66.google.com with SMTP id r63-v6so2332063wma.4; Wed, 17 Oct 2018 07:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=bVSv5kvJGnsBnF4fTs51dmvQZ2ELFeKwYI05LDwB3bc=; b=sZKK+4ROFe8mBPRRhH3O5tTj/eEB3tkmZa8DIoOy+frQt4gK+nRFmBqz7FpzLrijhN 0ce+1He/uWzEd68bERcKIWJ2W8163OP0R+A6JUSsnXiFtP7rGJsIUTkHobftDDBUHCLN 5HIk5UCHVie4xJtyBOdu9NLX3UOZkzf3lzAMqa0MGwA+tlxuw8U89oKsB61SKY1iIF9C P5ww5kqtr9fyMzQ3R0v4gkymSVDpOvGkT872Pj+/tYCY1i+lMC0juFz5uUh9+QSCuu06 +9pbr/q8qYuofvBWhDdFt6BJOTjXTrKqEJMKkCyDvokNrH1Z9iirV4E5pAZEYneYv3AV m1vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=bVSv5kvJGnsBnF4fTs51dmvQZ2ELFeKwYI05LDwB3bc=; b=YIBEiJvjvcGB5fDjXigoo/x1JJh97W+Twz3oJGJKZXYtVNnsvvMESRSmDz7DBqfIQT KPsHnXhFbdR1W39EZNJ1ENVd3tb6RZRwhy/p1+vqh7V8ERpz5lL27hSsYNBB+5KLl//g ukoJt0CPV3pU29ptMCGfhUdGlvjoZID80dazZoRtqgwpOSpkMH6ciQL2zSn8ju29aLQJ jV1/NqlKTP4p8fX0PqjAH6/jnTViytvFdnmoxMoHqy0jil+JQa7l3FDGUdcsIm+KVisl KAfzllUrCKGSfFi2vU+1TqV6zAkCa25PRx73OOZ0Bz9MTmc4Yl9k1gU8Hoso+JX6ENG4 shwg== X-Gm-Message-State: ABuFfohAPyhqJGo8qh5xCEJiucVDKzNAp2J+6FfMQXsNRbVG9h6ANrAg 8tw68dMV9TuK2M9ZsIz32bcfyRlREYM= X-Received: by 2002:a1c:dc42:: with SMTP id t63-v6mr3229264wmg.17.1539788113311; Wed, 17 Oct 2018 07:55:13 -0700 (PDT) Received: from [172.16.1.192] (host-89-243-172-161.as13285.net. [89.243.172.161]) by smtp.gmail.com with ESMTPSA id d6-v6sm11002486wro.72.2018.10.17.07.55.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 07:55:12 -0700 (PDT) Subject: Re: [PATCH 31/34] vfs: syscall: Add fspick() to select a superblock for reconfiguration [ver #12] To: "Eric W. Biederman" Cc: David Howells , Al Viro , linux-api@vger.kernel.org, torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, mszeredi@redhat.com References: <19866.1539782101@warthog.procyon.org.uk> <68a2107f-bf70-055b-86cf-1ba2ba9422bf@gmail.com> <153754740781.17872.7869536526927736855.stgit@warthog.procyon.org.uk> <153754766004.17872.9829232103614083565.stgit@warthog.procyon.org.uk> <9b8bf436-65de-13b9-0002-0479d11c18ca@gmail.com> <20181013061141.GR32577@ZenIV.linux.org.uk> <28710.1539782412@warthog.procyon.org.uk> <87woqgiqta.fsf@xmission.com> From: Alan Jenkins Message-ID: <8f5cf2a3-c522-d0b8-1257-1814e8149956@gmail.com> Date: Wed, 17 Oct 2018 15:55:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <87woqgiqta.fsf@xmission.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/10/2018 15:35, Eric W. Biederman wrote: > Alan Jenkins writes: > >> On 17/10/2018 14:20, David Howells wrote: >>> David Howells wrote: >>> >>>> I should probably check that the picked point is actually a mountpoint. >>> The root of the mount object at the path specified, that is, perhaps with >>> something like the attached. >>> >>> David >> >> I agree.  I'm happy to see this is using the same check as do_remount(). >> >> >> * change filesystem flags. dir should be a physical root of filesystem. >> * If you've mounted a non-root directory somewhere and want to do remount >> * on it - tough luck. >> */ > Davids check will work for bind mounts as well. It just won't work it > just won't work for files or subdirectories of some mountpoint. > > Eric I see.  Then I am still happy to see the fspick() check match a check in do_remount() (and it still solves the problem I was worried about). I cannot blame David for the do_remount() comment being out of date :-). # uname -r 4.18.10-200.fc.28.x86_64 # mount --bind /mnt /mnt # mount -oremount,debug /mnt # findmnt /mnt; findmnt / [findmnt shows / has been remounted, adding the ext4 "debug" mount option] > >>> --- >>> diff --git a/fs/fsopen.c b/fs/fsopen.c >>> index f673e93ac456..aaaaa17a233c 100644 >>> --- a/fs/fsopen.c >>> +++ b/fs/fsopen.c >>> @@ -186,6 +186,10 @@ SYSCALL_DEFINE3(fspick, int, dfd, const char __user *, path, unsigned int, flags >>> if (ret < 0) >>> goto err; >>> + ret = -EINVAL; >>> + if (target.mnt->mnt_root != target.dentry) >>> + goto err_path; >>> + >>> fc = vfs_new_fs_context(target.dentry->d_sb->s_type, target.dentry, >>> 0, 0, FS_CONTEXT_FOR_RECONFIGURE); >>> if (IS_ERR(fc)) { >>>