Skip to content

Commit c72d914

Browse files
committed
coredump: show supported coredump modes
Allow userspace to discover what coredump modes are supported. Link: https://lore.kernel.org/[email protected] Acked-by: Luca Boccassi <[email protected]> Reviewed-by: Jann Horn <[email protected]> Reviewed-by: Alexander Mikhalitsyn <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 1d8db6f commit c72d914

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

fs/coredump.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,12 @@ static int proc_dostring_coredump(const struct ctl_table *table, int write,
12481248

12491249
static const unsigned int core_file_note_size_min = CORE_FILE_NOTE_SIZE_DEFAULT;
12501250
static const unsigned int core_file_note_size_max = CORE_FILE_NOTE_SIZE_MAX;
1251+
static char core_modes[] = {
1252+
"file\npipe"
1253+
#ifdef CONFIG_UNIX
1254+
"\nsocket"
1255+
#endif
1256+
};
12511257

12521258
static const struct ctl_table coredump_sysctls[] = {
12531259
{
@@ -1291,6 +1297,13 @@ static const struct ctl_table coredump_sysctls[] = {
12911297
.extra1 = SYSCTL_ZERO,
12921298
.extra2 = SYSCTL_ONE,
12931299
},
1300+
{
1301+
.procname = "core_modes",
1302+
.data = core_modes,
1303+
.maxlen = sizeof(core_modes) - 1,
1304+
.mode = 0444,
1305+
.proc_handler = proc_dostring,
1306+
},
12941307
};
12951308

12961309
static int __init init_fs_coredump_sysctls(void)

0 commit comments

Comments
 (0)