console_codes.4, inode.7: srcfix
[man-pages.git] / man / man5 / proc_sys_fs.5
blobea2981bdabc47191ebef6e791473a077f5ed2273
1 .\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com>
2 .\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Copyright (C) , Andries Brouwer <aeb@cwi.nl>
4 .\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
5 .\"
6 .\" SPDX-License-Identifier: GPL-3.0-or-later
7 .\"
8 .TH proc_sys_fs 5 (date) "Linux man-pages (unreleased)"
9 .SH NAME
10 /proc/sys/fs/ \- kernel variables related to filesystems
11 .SH DESCRIPTION
12 .TP
13 .I /proc/sys/fs/
14 This directory contains the files and subdirectories for kernel variables
15 related to filesystems.
16 .TP
17 .I /proc/sys/fs/aio\-max\-nr
18 .TQ
19 .IR /proc/sys/fs/aio\-nr " (both since Linux 2.6.4)"
20 .I aio\-nr
21 is the running total of the number of events specified by
22 .BR io_setup (2)
23 calls for all currently active AIO contexts.
25 .I aio\-nr
26 reaches
27 .IR aio\-max\-nr ,
28 then
29 .BR io_setup (2)
30 will fail with the error
31 .BR EAGAIN .
32 Raising
33 .I aio\-max\-nr
34 does not result in the preallocation or resizing
35 of any kernel data structures.
36 .TP
37 .I /proc/sys/fs/binfmt_misc
38 Documentation for files in this directory can be found
39 in the Linux kernel source in the file
40 .I Documentation/admin\-guide/binfmt\-misc.rst
41 (or in
42 .I Documentation/binfmt_misc.txt
43 on older kernels).
44 .TP
45 .IR /proc/sys/fs/dentry\-state " (since Linux 2.2)"
46 This file contains information about the status of the
47 directory cache (dcache).
48 The file contains six numbers,
49 .IR nr_dentry ,
50 .IR nr_unused ,
51 .I age_limit
52 (age in seconds),
53 .I want_pages
54 (pages requested by system) and two dummy values.
55 .RS
56 .IP \[bu] 3
57 .I nr_dentry
58 is the number of allocated dentries (dcache entries).
59 This field is unused in Linux 2.2.
60 .IP \[bu]
61 .I nr_unused
62 is the number of unused dentries.
63 .IP \[bu]
64 .I age_limit
65 .\" looks like this is unused in Linux 2.2 to Linux 2.6
66 is the age in seconds after which dcache entries
67 can be reclaimed when memory is short.
68 .IP \[bu]
69 .I want_pages
70 .\" looks like this is unused in Linux 2.2 to Linux 2.6
71 is nonzero when the kernel has called shrink_dcache_pages() and the
72 dcache isn't pruned yet.
73 .RE
74 .TP
75 .I /proc/sys/fs/dir\-notify\-enable
76 This file can be used to disable or enable the
77 .I dnotify
78 interface described in
79 .BR fcntl (2)
80 on a system-wide basis.
81 A value of 0 in this file disables the interface,
82 and a value of 1 enables it.
83 .TP
84 .I /proc/sys/fs/dquot\-max
85 This file shows the maximum number of cached disk quota entries.
86 On some (2.4) systems, it is not present.
87 If the number of free cached disk quota entries is very low and
88 you have some awesome number of simultaneous system users,
89 you might want to raise the limit.
90 .TP
91 .I /proc/sys/fs/dquot\-nr
92 This file shows the number of allocated disk quota
93 entries and the number of free disk quota entries.
94 .TP
95 .IR /proc/sys/fs/epoll/ " (since Linux 2.6.28)"
96 This directory contains the file
97 .IR max_user_watches ,
98 which can be used to limit the amount of kernel memory consumed by the
99 .I epoll
100 interface.
101 For further details, see
102 .BR epoll (7).
104 .I /proc/sys/fs/file\-max
105 This file defines
106 a system-wide limit on the number of open files for all processes.
107 System calls that fail when encountering this limit fail with the error
108 .BR ENFILE .
109 (See also
110 .BR setrlimit (2),
111 which can be used by a process to set the per-process limit,
112 .BR RLIMIT_NOFILE ,
113 on the number of files it may open.)
114 If you get lots
115 of error messages in the kernel log about running out of file handles
116 (open file descriptions)
117 (look for "VFS: file\-max limit <number> reached"),
118 try increasing this value:
120 .in +4n
122 echo 100000 > /proc/sys/fs/file\-max
126 Privileged processes
127 .RB ( CAP_SYS_ADMIN )
128 can override the
129 .I file\-max
130 limit.
132 .I /proc/sys/fs/file\-nr
133 This (read-only) file contains three numbers:
134 the number of allocated file handles
135 (i.e., the number of open file descriptions; see
136 .BR open (2));
137 the number of free file handles;
138 and the maximum number of file handles (i.e., the same value as
139 .IR /proc/sys/fs/file\-max ).
140 If the number of allocated file handles is close to the
141 maximum, you should consider increasing the maximum.
142 Before Linux 2.6,
143 the kernel allocated file handles dynamically,
144 but it didn't free them again.
145 Instead the free file handles were kept in a list for reallocation;
146 the "free file handles" value indicates the size of that list.
147 A large number of free file handles indicates that there was
148 a past peak in the usage of open file handles.
149 Since Linux 2.6, the kernel does deallocate freed file handles,
150 and the "free file handles" value is always zero.
152 .IR /proc/sys/fs/inode\-max " (only present until Linux 2.2)"
153 This file contains the maximum number of in-memory inodes.
154 This value should be 3\[en]4 times larger
155 than the value in
156 .IR file\-max ,
157 since \fIstdin\fP, \fIstdout\fP
158 and network sockets also need an inode to handle them.
159 When you regularly run out of inodes, you need to increase this value.
161 Starting with Linux 2.4,
162 there is no longer a static limit on the number of inodes,
163 and this file is removed.
165 .I /proc/sys/fs/inode\-nr
166 This file contains the first two values from
167 .IR inode\-state .
169 .I /proc/sys/fs/inode\-state
170 This file
171 contains seven numbers:
172 .IR nr_inodes ,
173 .IR nr_free_inodes ,
174 .IR preshrink ,
175 and four dummy values (always zero).
177 .I nr_inodes
178 is the number of inodes the system has allocated.
179 .\" This can be slightly more than
180 .\" .I inode\-max
181 .\" because Linux allocates them one page full at a time.
182 .I nr_free_inodes
183 represents the number of free inodes.
185 .I preshrink
186 is nonzero when the
187 .I nr_inodes
189 .I inode\-max
190 and the system needs to prune the inode list instead of allocating more;
191 since Linux 2.4, this field is a dummy value (always zero).
193 .IR /proc/sys/fs/inotify/ " (since Linux 2.6.13)"
194 This directory contains files
195 .IR max_queued_events ", " max_user_instances ", and " max_user_watches ,
196 that can be used to limit the amount of kernel memory consumed by the
197 .I inotify
198 interface.
199 For further details, see
200 .BR inotify (7).
202 .I /proc/sys/fs/lease\-break\-time
203 This file specifies the grace period that the kernel grants to a process
204 holding a file lease
205 .RB ( fcntl (2))
206 after it has sent a signal to that process notifying it
207 that another process is waiting to open the file.
208 If the lease holder does not remove or downgrade the lease within
209 this grace period, the kernel forcibly breaks the lease.
211 .I /proc/sys/fs/leases\-enable
212 This file can be used to enable or disable file leases
213 .RB ( fcntl (2))
214 on a system-wide basis.
215 If this file contains the value 0, leases are disabled.
216 A nonzero value enables leases.
218 .IR /proc/sys/fs/mount\-max " (since Linux 4.9)"
219 .\" commit d29216842a85c7970c536108e093963f02714498
220 The value in this file specifies the maximum number of mounts that may exist
221 in a mount namespace.
222 The default value in this file is 100,000.
224 .IR /proc/sys/fs/mqueue/ " (since Linux 2.6.6)"
225 This directory contains files
226 .IR msg_max ", " msgsize_max ", and " queues_max ,
227 controlling the resources used by POSIX message queues.
229 .BR mq_overview (7)
230 for details.
232 .IR /proc/sys/fs/nr_open " (since Linux 2.6.25)"
233 .\" commit 9cfe015aa424b3c003baba3841a60dd9b5ad319b
234 This file imposes a ceiling on the value to which the
235 .B RLIMIT_NOFILE
236 resource limit can be raised (see
237 .BR getrlimit (2)).
238 This ceiling is enforced for both unprivileged and privileged process.
239 The default value in this file is 1048576.
240 (Before Linux 2.6.25, the ceiling for
241 .B RLIMIT_NOFILE
242 was hard-coded to the same value.)
244 .I /proc/sys/fs/overflowgid
246 .I /proc/sys/fs/overflowuid
247 These files
248 allow you to change the value of the fixed UID and GID.
249 The default is 65534.
250 Some filesystems support only 16-bit UIDs and GIDs, although in Linux
251 UIDs and GIDs are 32 bits.
252 When one of these filesystems is mounted
253 with writes enabled, any UID or GID that would exceed 65535 is translated
254 to the overflow value before being written to disk.
256 .IR /proc/sys/fs/pipe\-max\-size " (since Linux 2.6.35)"
258 .BR pipe (7).
260 .IR /proc/sys/fs/pipe\-user\-pages\-hard " (since Linux 4.5)"
262 .BR pipe (7).
264 .IR /proc/sys/fs/pipe\-user\-pages\-soft " (since Linux 4.5)"
266 .BR pipe (7).
268 .IR /proc/sys/fs/protected_fifos " (since Linux 4.19)"
269 The value in this file is/can be set to one of the following:
271 .TP 4
273 Writing to FIFOs is unrestricted.
276 Don't allow
277 .B O_CREAT
278 .BR open (2)
279 on FIFOs that the caller doesn't own in world-writable sticky directories,
280 unless the FIFO is owned by the owner of the directory.
283 As for the value 1,
284 but the restriction also applies to group-writable sticky directories.
287 The intent of the above protections is to avoid unintentional writes to an
288 attacker-controlled FIFO when a program expected to create a regular file.
290 .IR /proc/sys/fs/protected_hardlinks " (since Linux 3.6)"
291 .\" commit 800179c9b8a1e796e441674776d11cd4c05d61d7
292 When the value in this file is 0,
293 no restrictions are placed on the creation of hard links
294 (i.e., this is the historical behavior before Linux 3.6).
295 When the value in this file is 1,
296 a hard link can be created to a target file
297 only if one of the following conditions is true:
299 .IP \[bu] 3
300 The calling process has the
301 .B CAP_FOWNER
302 capability in its user namespace
303 and the file UID has a mapping in the namespace.
304 .IP \[bu]
305 The filesystem UID of the process creating the link matches
306 the owner (UID) of the target file
307 (as described in
308 .BR credentials (7),
309 a process's filesystem UID is normally the same as its effective UID).
310 .IP \[bu]
311 All of the following conditions are true:
312 .RS 4
313 .IP \[bu] 3
314 the target is a regular file;
315 .IP \[bu]
316 the target file does not have its set-user-ID mode bit enabled;
317 .IP \[bu]
318 the target file does not have both its set-group-ID and
319 group-executable mode bits enabled; and
320 .IP \[bu]
321 the caller has permission to read and write the target file
322 (either via the file's permissions mask or because it has
323 suitable capabilities).
327 The default value in this file is 0.
328 Setting the value to 1
329 prevents a longstanding class of security issues caused by
330 hard-link-based time-of-check, time-of-use races,
331 most commonly seen in world-writable directories such as
332 .IR /tmp .
333 The common method of exploiting this flaw
334 is to cross privilege boundaries when following a given hard link
335 (i.e., a root process follows a hard link created by another user).
336 Additionally, on systems without separated partitions,
337 this stops unauthorized users from "pinning" vulnerable set-user-ID and
338 set-group-ID files against being upgraded by
339 the administrator, or linking to special files.
341 .IR /proc/sys/fs/protected_regular " (since Linux 4.19)"
342 The value in this file is/can be set to one of the following:
344 .TP 4
346 Writing to regular files is unrestricted.
349 Don't allow
350 .B O_CREAT
351 .BR open (2)
352 on regular files that the caller doesn't own in
353 world-writable sticky directories,
354 unless the regular file is owned by the owner of the directory.
357 As for the value 1,
358 but the restriction also applies to group-writable sticky directories.
361 The intent of the above protections is similar to
362 .IR protected_fifos ,
363 but allows an application to
364 avoid writes to an attacker-controlled regular file,
365 where the application expected to create one.
367 .IR /proc/sys/fs/protected_symlinks " (since Linux 3.6)"
368 .\" commit 800179c9b8a1e796e441674776d11cd4c05d61d7
369 When the value in this file is 0,
370 no restrictions are placed on following symbolic links
371 (i.e., this is the historical behavior before Linux 3.6).
372 When the value in this file is 1, symbolic links are followed only
373 in the following circumstances:
375 .IP \[bu] 3
376 the filesystem UID of the process following the link matches
377 the owner (UID) of the symbolic link
378 (as described in
379 .BR credentials (7),
380 a process's filesystem UID is normally the same as its effective UID);
381 .IP \[bu]
382 the link is not in a sticky world-writable directory; or
383 .IP \[bu]
384 the symbolic link and its parent directory have the same owner (UID)
387 A system call that fails to follow a symbolic link
388 because of the above restrictions returns the error
389 .B EACCES
391 .IR errno .
393 The default value in this file is 0.
394 Setting the value to 1 avoids a longstanding class of security issues
395 based on time-of-check, time-of-use races when accessing symbolic links.
397 .IR /proc/sys/fs/suid_dumpable " (since Linux 2.6.13)"
398 .\" The following is based on text from Documentation/sysctl/kernel.txt
399 The value in this file is assigned to a process's "dumpable" flag
400 in the circumstances described in
401 .BR prctl (2).
402 In effect,
403 the value in this file determines whether core dump files are
404 produced for set-user-ID or otherwise protected/tainted binaries.
405 The "dumpable" setting also affects the ownership of files in a process's
406 .IR /proc/ pid
407 directory, as described above.
409 Three different integer values can be specified:
412 \fI0\ (default)\fP
413 .\" In kernel source: SUID_DUMP_DISABLE
414 This provides the traditional (pre-Linux 2.6.13) behavior.
415 A core dump will not be produced for a process which has
416 changed credentials (by calling
417 .BR seteuid (2),
418 .BR setgid (2),
419 or similar, or by executing a set-user-ID or set-group-ID program)
420 or whose binary does not have read permission enabled.
422 \fI1\ ("debug")\fP
423 .\" In kernel source: SUID_DUMP_USER
424 All processes dump core when possible.
425 (Reasons why a process might nevertheless not dump core are described in
426 .BR core (5).)
427 The core dump is owned by the filesystem user ID of the dumping process
428 and no security is applied.
429 This is intended for system debugging situations only:
430 this mode is insecure because it allows unprivileged users to
431 examine the memory contents of privileged processes.
433 \fI2\ ("suidsafe")\fP
434 .\" In kernel source: SUID_DUMP_ROOT
435 Any binary which normally would not be dumped (see "0" above)
436 is dumped readable by root only.
437 This allows the user to remove the core dump file but not to read it.
438 For security reasons core dumps in this mode will not overwrite one
439 another or other files.
440 This mode is appropriate when administrators are
441 attempting to debug problems in a normal environment.
443 Additionally, since Linux 3.6,
444 .\" 9520628e8ceb69fa9a4aee6b57f22675d9e1b709
445 .I /proc/sys/kernel/core_pattern
446 must either be an absolute pathname
447 or a pipe command, as detailed in
448 .BR core (5).
449 Warnings will be written to the kernel log if
450 .I core_pattern
451 does not follow these rules, and no core dump will be produced.
452 .\" 54b501992dd2a839e94e76aa392c392b55080ce8
455 For details of the effect of a process's "dumpable" setting
456 on ptrace access mode checking, see
457 .BR ptrace (2).
459 .I /proc/sys/fs/super\-max
460 This file
461 controls the maximum number of superblocks, and
462 thus the maximum number of mounted filesystems the kernel
463 can have.
464 You need increase only
465 .I super\-max
466 if you need to mount more filesystems than the current value in
467 .I super\-max
468 allows you to.
470 .I /proc/sys/fs/super\-nr
471 This file
472 contains the number of filesystems currently mounted.
473 .SH SEE ALSO
474 .BR proc (5),
475 .BR proc_sys (5)