Files
linux/include/linux
Christian Brauner b604897764 binfmt_misc: correctly account pre-opened interpreters
An 'F' entry, and every interpreter a 'B' entry binds, holds a file open
from registration until the entry goes away, pinning the file, its inode,
the mount it came from and that mount's superblock. Nothing bounds how
many of those a user namespace can hold. An entry binds at most
BINFMT_MISC_INTERP_MAX interpreters, but nothing caps the entries.

Charge each binding to the user namespace and uid that makes it against a
new UCOUNT_BINFMT_MISC_INTERPRETERS. Going over budget causes -ENOSPC.

A per-instance cap would suck. Instances are keyed on the user
namespace. So any constant is multiplied by the number of namespaces the
caller creates. Creating those is virtually free. A ucount charges the
namespace and every one of its ancestors. And a namespace can raise only
its own limit. So nesting buys nothing.

The knob is /proc/sys/user/max_binfmt_misc_interpreters. Leave it at the
max_threads/2 default fork_init() gives a new type. No existing
configuration comes close to that.

binfmt_misc is tristate, which makes it the first ucount user that can be
built as a module. Export inc_ucount() and dec_ucount(); without them
CONFIG_BINFMT_MISC=m fails to link. Export them to binfmt_misc alone:
charging a ucount type is not something a module has any business doing
in general, and the list is trivial to extend if a second user shows up.
init_user_ns and init_binfmt_misc are already exported for the same
module.

Link: https://patch.msgid.link/20260803-work-binfmt_misc-interplimit-v1-1-4a2435500bd9@kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-03 23:36:18 +02:00
..
2026-07-23 10:24:12 -07:00
2026-04-02 15:52:49 +02:00
2026-03-18 15:11:40 +05:30
2026-05-21 13:04:42 +02:00
2026-03-19 23:55:27 +01:00
2026-06-17 11:32:14 +01:00
2026-05-28 21:24:54 -07:00
2026-01-20 19:44:19 -08:00
2026-06-16 08:53:53 -07:00
2026-04-03 16:53:50 -04:00
2026-06-07 10:03:01 -07:00
2026-03-02 17:08:05 -05:00
2026-05-28 17:45:46 -07:00
2026-07-09 15:48:53 -07:00
2026-06-05 00:34:55 -04:00
2026-05-18 11:16:29 +02:00
2026-05-19 17:26:07 +02:00
2025-12-13 20:04:32 +12:00
2026-05-28 11:36:59 -04:00
2026-04-07 17:38:07 +02:00
2025-12-23 11:23:10 -08:00
2026-02-27 16:40:16 +01:00
2026-06-05 17:46:17 -07:00
2026-01-12 16:52:09 +01:00
2026-05-28 21:24:43 -07:00
2026-02-06 07:29:14 -07:00
2026-07-01 15:26:47 +02:00
2026-06-10 10:42:55 -04:00
2026-04-05 13:53:28 -07:00
2026-01-05 16:43:31 +01:00
2026-01-11 06:09:11 -10:00
2026-04-01 10:19:41 +02:00
2026-04-03 16:53:50 -04:00
2026-04-03 16:53:50 -04:00
2026-03-18 09:59:57 +00:00
2026-04-05 13:53:00 -07:00
2025-12-29 11:53:38 +01:00
2026-01-26 20:02:27 -08:00
2026-03-08 11:06:53 +01:00
2026-06-26 22:18:34 -04:00
2026-03-27 07:35:05 -07:00
2026-01-30 11:34:34 +00:00
2026-04-05 13:53:10 -07:00
2026-02-10 11:39:31 +01:00
2026-01-11 06:09:11 -10:00
2026-04-20 11:35:17 -07:00
2026-05-26 11:02:01 +02:00
2026-02-27 16:40:16 +01:00
2026-01-11 06:09:11 -10:00
2026-03-08 11:06:53 +01:00
2026-03-31 07:04:00 -06:00
2026-03-25 20:11:29 +01:00
2026-03-13 08:22:54 +01:00
2026-05-11 16:59:43 +02:00
2026-03-12 15:05:34 +01:00
2026-03-30 16:43:24 -06:00
2026-01-30 18:26:59 -08:00
2026-06-06 15:22:44 +02:00