@@ -63,6 +63,7 @@ static void free_vma_snapshot(struct coredump_params *cprm);
6363
6464static int core_uses_pid ;
6565static unsigned int core_pipe_limit ;
66+ static unsigned int core_sort_vma ;
6667static char core_pattern [CORENAME_MAX_SIZE ] = "core" ;
6768static int core_name_size = CORENAME_MAX_SIZE ;
6869unsigned int core_file_note_size_limit = CORE_FILE_NOTE_SIZE_DEFAULT ;
@@ -1025,6 +1026,15 @@ static struct ctl_table coredump_sysctls[] = {
10251026 .extra1 = (unsigned int * )& core_file_note_size_min ,
10261027 .extra2 = (unsigned int * )& core_file_note_size_max ,
10271028 },
1029+ {
1030+ .procname = "core_sort_vma" ,
1031+ .data = & core_sort_vma ,
1032+ .maxlen = sizeof (int ),
1033+ .mode = 0644 ,
1034+ .proc_handler = proc_douintvec_minmax ,
1035+ .extra1 = SYSCTL_ZERO ,
1036+ .extra2 = SYSCTL_ONE ,
1037+ },
10281038};
10291039
10301040static int __init init_fs_coredump_sysctls (void )
@@ -1255,8 +1265,9 @@ static bool dump_vma_snapshot(struct coredump_params *cprm)
12551265 cprm -> vma_data_size += m -> dump_size ;
12561266 }
12571267
1258- sort (cprm -> vma_meta , cprm -> vma_count , sizeof (* cprm -> vma_meta ),
1259- cmp_vma_size , NULL );
1268+ if (core_sort_vma )
1269+ sort (cprm -> vma_meta , cprm -> vma_count , sizeof (* cprm -> vma_meta ),
1270+ cmp_vma_size , NULL );
12601271
12611272 return true;
12621273}
0 commit comments