From: Karel Zak <kzak@redhat.com>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
haveblue@us.ibm.com, akpm@linux-foundation.org,
hch@infradead.org, serue@us.ibm.com, viro@ftp.linux.org.uk,
ebiederm@xmission.com, linux-fsdevel@vger.kernel.org,
containers@lists.osdl.org, util-linux-ng@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [patch 5/9] unprivileged mounts: allow unprivileged bind mounts
Date: Wed, 9 Jan 2008 14:26:10 +0100 [thread overview]
Message-ID: <20080109132610.GJ3926@petra.dvoda.cz> (raw)
In-Reply-To: <Pine.LNX.4.64.0801091340270.29244@fbirervta.pbzchgretzou.qr>
On Wed, Jan 09, 2008 at 01:45:09PM +0100, Jan Engelhardt wrote:
>
> On Jan 8 2008 20:08, Miklos Szeredi wrote:
> >> On Tue, 2008-01-08 at 12:35 +0100, Miklos Szeredi wrote:
> >> > +static int reserve_user_mount(void)
> >> > +{
> >> > + int err = 0;
> >> > +
> >> > + spin_lock(&vfsmount_lock);
> >> > + if (nr_user_mounts >= max_user_mounts && !capable(CAP_SYS_ADMIN))
> >> > + err = -EPERM;
> >> > + else
> >> > + nr_user_mounts++;
> >> > + spin_unlock(&vfsmount_lock);
> >> > + return err;
> >> > +}
> >>
> >> Would -ENOSPC or -ENOMEM be a more descriptive error here?
> >
> >The logic behind EPERM, is that this failure is only for unprivileged
> >callers. ENOMEM is too specifically about OOM. It could be changed
> >to ENOSPC, ENFILE, EMFILE, or it could remain EPERM. What do others
> >think?
>
> ENOSPC: No space remaining on device => 'wth'.
> ENOMEM: I usually think of a userspace OOM (e.g. malloc'ed out all of your
> 32-bit address space on 32-bit processes)
> EMFILE: "Too many open files"
> ENFILE: "Too many open files in system".
>
> ENFILE seems like a temporary winner among these four.
I see "EMFILE", it's still supported by the latest mount(8).
> Back in the old days, when the number of mounts was limited in Linux,
> what error value did it return? That one could be used.
Copy & past from mount-0.99.2:
/* Mount failed, complain, but don't die. */
switch (mnt_err)
{
case EPERM:
if (geteuid() == 0)
error ("mount: mount point %s is not a directory", node);
else
error ("mount: must be superuser to use mount");
break;
case EBUSY:
error ("mount: wrong fs type, %s already mounted, %s busy, "
"or other error", spec, node);
break;
case ENOENT:
error ("mount: mount point %s does not exist", node); break;
case ENOTDIR:
error ("mount: mount point %s is not a directory", node); break;
case EINVAL:
error ("mount: %s not a mount point", spec); break;
case EMFILE:
error ("mount table full"); break;
case EIO:
error ("mount: %s: can't read superblock", spec); break;
case ENODEV:
error ("mount: fs type %s not supported by kernel", type); break;
case ENOTBLK:
error ("mount: %s is not a block device", spec); break;
case ENXIO:
error ("mount: %s is not a valid block device", spec); break;
case EACCES:
error ("mount: block device %s is not permitted on its filesystem", spec);
break;
default:
error ("mount: %s", strerror (mnt_err)); break;
}
Karel
--
Karel Zak <kzak@redhat.com>
next prev parent reply other threads:[~2008-01-09 13:26 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-08 11:35 [patch 0/9] mount ownership and unprivileged mount syscall (v6) Miklos Szeredi
2008-01-08 11:35 ` [patch 1/9] unprivileged mounts: add user mounts to the kernel Miklos Szeredi
2008-01-08 21:34 ` Pavel Machek
2008-01-08 21:47 ` Pavel Machek
2008-01-14 21:46 ` Serge E. Hallyn
2008-01-08 11:35 ` [patch 2/9] unprivileged mounts: allow unprivileged umount Miklos Szeredi
2008-01-14 21:48 ` Serge E. Hallyn
2008-01-08 11:35 ` [patch 3/9] unprivileged mounts: account user mounts Miklos Szeredi
2008-01-08 18:18 ` Dave Hansen
2008-01-08 19:18 ` Miklos Szeredi
2008-01-14 21:53 ` Serge E. Hallyn
2008-01-08 11:35 ` [patch 4/9] unprivileged mounts: propagate error values from clone_mnt Miklos Szeredi
2008-01-14 22:23 ` Serge E. Hallyn
2008-01-15 10:15 ` Miklos Szeredi
2008-01-08 11:35 ` [patch 5/9] unprivileged mounts: allow unprivileged bind mounts Miklos Szeredi
2008-01-08 18:12 ` Dave Hansen
2008-01-08 19:08 ` Miklos Szeredi
2008-01-08 19:15 ` Dave Hansen
2008-01-08 20:44 ` Szabolcs Szakacsits
2008-01-09 12:45 ` Jan Engelhardt
2008-01-09 13:26 ` Karel Zak [this message]
2008-01-09 13:32 ` Miklos Szeredi
2008-01-08 18:26 ` Dave Hansen
2008-01-08 19:21 ` Miklos Szeredi
2008-01-10 4:47 ` Serge E. Hallyn
2008-01-14 22:42 ` Serge E. Hallyn
2008-01-08 11:35 ` [patch 6/9] unprivileged mounts: allow unprivileged mounts Miklos Szeredi
2008-01-09 11:11 ` Karel Zak
2008-01-09 12:41 ` Miklos Szeredi
2008-01-14 22:58 ` Serge E. Hallyn
2008-01-08 11:35 ` [patch 7/9] unprivileged mounts: allow unprivileged fuse mounts Miklos Szeredi
2008-01-08 21:46 ` Pavel Machek
2008-01-08 22:42 ` Miklos Szeredi
2008-01-08 22:58 ` Pavel Machek
2008-01-09 9:11 ` Miklos Szeredi
2008-01-09 11:33 ` Pavel Machek
2008-01-09 13:16 ` Miklos Szeredi
2008-01-09 13:35 ` Pavel Machek
2008-01-09 13:48 ` Miklos Szeredi
2008-01-09 14:00 ` Pavel Machek
2008-01-09 14:14 ` Miklos Szeredi
2008-01-08 23:56 ` Nigel Cunningham
2008-01-09 8:47 ` Miklos Szeredi
2008-01-09 9:29 ` Nigel Cunningham
2008-01-09 11:12 ` Pavel Machek
2008-01-09 9:19 ` Szabolcs Szakacsits
2008-01-14 23:24 ` Serge E. Hallyn
2008-01-15 10:29 ` Miklos Szeredi
2008-01-15 13:35 ` Serge E. Hallyn
2008-01-08 11:35 ` [patch 8/9] unprivileged mounts: propagation: inherit owner from parent Miklos Szeredi
2008-01-14 23:13 ` Serge E. Hallyn
2008-01-15 10:39 ` Miklos Szeredi
2008-01-15 14:21 ` Serge E. Hallyn
2008-01-15 14:37 ` Miklos Szeredi
2008-01-15 14:59 ` Serge E. Hallyn
2008-01-08 11:35 ` [patch 9/9] unprivileged mounts: add "no submounts" flag Miklos Szeredi
2008-01-14 23:39 ` Serge E. Hallyn
2008-01-15 10:41 ` Miklos Szeredi
2008-01-15 10:53 ` A. C. Censi
2008-01-15 10:58 ` Miklos Szeredi
2008-01-15 13:47 ` Serge E. Hallyn
2008-01-16 9:43 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080109132610.GJ3926@petra.dvoda.cz \
--to=kzak@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.osdl.org \
--cc=ebiederm@xmission.com \
--cc=haveblue@us.ibm.com \
--cc=hch@infradead.org \
--cc=jengelh@computergmbh.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=serue@us.ibm.com \
--cc=util-linux-ng@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®