Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1574479pxb; Mon, 8 Mar 2021 00:32:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyq4R1s4w4mmLeSppVdtBMdEZjp9ibYVlcUjrcI30skjt/y0IneFQv9DgK0i03LT8qgYec1 X-Received: by 2002:a17:906:d71:: with SMTP id s17mr14421698ejh.126.1615192328661; Mon, 08 Mar 2021 00:32:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615192328; cv=none; d=google.com; s=arc-20160816; b=i70fcYBQRMROHnFqzY8lQ+f+GycRVQfsJZmX6BUm+5ESNOeCwaFHq5xleIfMUzi7cI +abnYSPHKrClD8aXH2GRcn+2lse8jBwuHnnpLgaa0+8Lo8Gwp0kUKPFR/2HD1OGLdHWu rk5WlALQ5ZKfnYlKBik4WGIyrhjs/Lv2O8sPquBrQZYHqUaisArMxV63UdvoRhxcfARj ftnBl0FM3MipdG1kLmbfSNSf+PfoylpAZpiaXtsmAWTEb+q/3yS/mq6qyqXCAiWGcCrj cRnjYQ8ACF+a/feIOOgX7fwPUHsSpsPaaDNdq12xz3as4gMOMFcTgxmOqWIuw6LhameU 8bBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=tgvuCX/6tvDiUXhJrgFSSO5aL68QBRu7gerOrplnUh0=; b=B54V9OGgXAFWUxwwKypqlhBSr2Ctp6Kaq38KhRwr4TmSgjm+i671R8lMX+UZfn5XQg zBknrMquJRqbqPSA4JwAwO3ThakBx3Aq9PJ54UoB2bLQoBHxjw/VPS+hHW7Dw/3cN+CH n0GqLy9mS0u5tRia2CuxOhf4jGpdi6WtpZ2P8pfzy97Ool1moV+VPaea81YOTNHvRqKB /qbkGBbdPW00ZvQ/wi6zKo7pmwOY8w9oIvc0+ijUGz3CKPmgujYu7eYbYClN0LQ3WFOo Jtb8LuuEfQ4ZUTvNkc6cUbKzmUmNt1lR2AzABUxtUATrb+eXWA+R7CkXuy90dzVvU3mQ lEkQ== ARC-Authentication-Results: i=1; mx.google.com; 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 jt20si6532432ejb.157.2021.03.08.00.31.46; Mon, 08 Mar 2021 00:32:08 -0800 (PST) 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; 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 S233321AbhCHANE (ORCPT + 99 others); Sun, 7 Mar 2021 19:13:04 -0500 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:34826 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231894AbhCHAMd (ORCPT ); Sun, 7 Mar 2021 19:12:33 -0500 X-Greylist: delayed 1117 seconds by postgrey-1.27 at vger.kernel.org; Sun, 07 Mar 2021 19:12:32 EST Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lJ3VW-003qWR-Cw; Mon, 08 Mar 2021 00:12:22 +0000 Date: Mon, 8 Mar 2021 00:12:22 +0000 From: Al Viro To: Alexander Mikhalitsyn Cc: Ian Kent , Matthew Wilcox , Pavel Tikhomirov , Kirill Tkhai , autofs@vger.kernel.org, linux-kernel@vger.kernel.org, Miklos Szeredi , Christian Brauner , Ross Zwisler , Aleksa Sarai , Eric Biggers , Mattias Nissler , linux-fsdevel@vger.kernel.org, alexander@mihalicyn.com Subject: Re: [RFC PATCH] autofs: find_autofs_mount overmounted parent support Message-ID: References: <20210303152931.771996-1-alexander.mikhalitsyn@virtuozzo.com> <832c1a384dc0b71b2902accf3091ea84381acc10.camel@themaw.net> <20210304131133.0ad93dee12a17f41f4052bcb@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 07, 2021 at 11:51:20PM +0000, Al Viro wrote: > On Thu, Mar 04, 2021 at 01:11:33PM +0300, Alexander Mikhalitsyn wrote: > > > That problem connected with CRIU (Checkpoint-Restore in Userspace) project. > > In CRIU we have support of autofs mounts C/R. To acheive that we need to use > > ioctl's from /dev/autofs to get data about mounts, restore mount as catatonic > > (if needed), change pipe fd and so on. But the problem is that during CRIU > > dump we may meet situation when VFS subtree where autofs mount present was > > overmounted as whole. > > > > Simpliest example is /proc/sys/fs/binfmt_misc. This mount present on most > > GNU/Linux distributions by default. For instance on my Fedora 33: > > > > trigger automount of binfmt_misc > > $ ls /proc/sys/fs/binfmt_misc > > > > $ cat /proc/1/mountinfo | grep binfmt > > 35 24 0:36 / /proc/sys/fs/binfmt_misc rw,relatime shared:16 - autofs systemd-1 rw,...,direct,pipe_ino=223 > > 632 35 0:56 / /proc/sys/fs/binfmt_misc rw,...,relatime shared:315 - binfmt_misc binfmt_misc rw > > > > $ sudo unshare -m -p --fork --mount-proc sh > > # cat /proc/self/mountinfo | grep "/proc" > > 828 809 0:23 / /proc rw,nosuid,nodev,noexec,relatime - proc proc rw > > 829 828 0:36 / /proc/sys/fs/binfmt_misc rw,relatime - autofs systemd-1 rw,...,direct,pipe_ino=223 > > 943 829 0:56 / /proc/sys/fs/binfmt_misc rw,...,relatime - binfmt_misc binfmt_misc rw > > 949 828 0:57 / /proc rw...,relatime - proc proc rw > > > > As we can see now autofs mount /proc/sys/fs/binfmt_misc is inaccessible. > > If we do something like: > > > > struct autofs_dev_ioctl *param; > > param = malloc(...); > > devfd = open("/dev/autofs", O_RDONLY); > > init_autofs_dev_ioctl(param); > > param->size = size; > > strcpy(param->path, "/proc/sys/fs/binfmt_misc"); > > param->openmount.devid = 36; > > err = ioctl(devfd, AUTOFS_DEV_IOCTL_OPENMOUNT, param) > > > > now we get err = -ENOENT. > > Where does that -ENOENT come from? AFAICS, pathwalk ought to succeed and > return you the root of overmounting binfmt_misc. Why doesn't the loop in > find_autofs_mount() locate anything it would accept? > > I really dislike the patch - the whole "normalize path" thing is fundamentally > bogus, not to mention the iterator over all mounts, etc., so I would like to > understand what the hell is going on before even thinking of *not* NAKing > it on sight. Wait, so you have /proc overmounted, without anything autofs-related on /proc/sys/fs/binfmt_misc and still want to have the pathname resolved, just because it would've resolved with that overmount of /proc removed? I hope I'm misreading you; in case I'm not, the ABI is extremely tasteless and until you manage to document the exact semantics you want for param->path, consider it NAKed.