Skip to contentSkip to conversation

New: mount(2) doesn't document ENOSPC when /proc/sys/fs/mount-max is exceeded

Bug 218336 [email protected] 1 participant 5 messages Jan 3, 2024 – Aug 25 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=218336

Bug ID: 218336
Summary: mount(2) doesn't document ENOSPC when
/proc/sys/fs/mount-max is exceeded
Product: Documentation
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: man-pages
Assignee: [email protected]
Reporter: [email protected]
Regression: No

When setting up mount points in a new mount namespace, if /proc/sys/fs/mount-max is exceeded, mount(2) will fail with ENOSPC. This isn't documented in mount(2) as a possible error result.

In this situation, the error message "No space left on device" from strerror() is misleading: usually all of the user's filesystem devices will have plenty of space. The actual problem is that an essentially arbitrary anti-denial-of-service limit, orthogonal to how much space exists on any particular device, has been exceeded.

For example, this could easily happen when running Flatpak, which creates new user and mount namespaces using the bubblewrap tool:

$ echo 50 | sudo tee /proc/sys/fs/mount-max
$ flatpak run org.gnome.Platform//45       
bwrap: Failed to mount tmpfs: No space left on device
error: ldconfig failed, exit status 256

I'm going to send a PR to bubblewrap to make it special-case ENOSPC and display a clearer error message in this case. It would be helpful if mount(2) indicated ENOSPC as a possible error here, so that maintainers of projects like bubblewrap could make sure to allow for it.

https://github.com/ValveSoftware/steam-runtime/issues/637 is a real-world report of this happening in Steam's Steam Linux Runtime container framework, which is very similar to Flatpak.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 218336] mount(2) doesn't document ENOSPC when /proc/sys/fs/mount-max is exceeded

https://bugzilla.kernel.org/show_bug.cgi?id=218336

--- Comment #1 from Simon McVittie ([email protected]) --- The bubblewrap PR is https://github.com/containers/bubblewrap/pull/615.

The text I would hope to see in the man page could perhaps be something like:

**ENOSPC**
The mount operation would cause the current mount namespace to have more mount points than allowed by _/proc/sys/fs/mount-max_.

...

**SEE ALSO**

    ...,

https://www.kernel.org/doc/html/latest/admin-guide/sysctl/fs.html#mount-max

Or if the man-pages maintainers would prefer to have text that anticipates potential future kernel changes, perhaps more generally:

**ENOSPC**
The mount operation would cause a resource limit to be exceeded, for example more mount points than allowed by _/proc/sys/fs/mount-max_ in the current mount namespace.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#2 lore raw

[Bug 218336] mount(2) doesn't document ENOSPC when /proc/sys/fs/mount-max is exceeded

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=218336

Alejandro Colomar ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #2 from Alejandro Colomar ([email protected]) --- Would you mind sending a patch? Please check this:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING>.

Thanks!

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#3 lore raw

[Bug 218336] mount(2) doesn't document ENOSPC when /proc/sys/fs/mount-max is exceeded

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=218336

Chen Linxuan ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #3 from Chen Linxuan ([email protected]) ---
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=cb399bd26e6ff11793fab1878c7991464f0f55c3

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#4 lore raw

[Bug 218336] mount(2) doesn't document ENOSPC when /proc/sys/fs/mount-max is exceeded

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=218336

Alejandro Colomar ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|---                         |DOCUMENTED
Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.