Re: [PATCH 3/3] vmalloc: Add debugfs modfraginfo

From: kbuild test robot
Date: Thu Jul 19 2018 - 01:24:55 EST


Hi Rick,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.18-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Rick-Edgecombe/KASLR-feature-to-randomize-each-loadable-module/20180707-083637
config: um-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=um

All errors (new ones prefixed by >>):

mm/vmalloc.c: In function 'modulefraginfo_debug_show':
>> mm/vmalloc.c:2964:41: error: 'MODULES_RAND_LEN' undeclared (first use in this function); did you mean 'MODULE_NAME_LEN'?
if (obj->va_start >= MODULES_VADDR + MODULES_RAND_LEN)
^~~~~~~~~~~~~~~~
MODULE_NAME_LEN
mm/vmalloc.c:2964:41: note: each undeclared identifier is reported only once for each function it appears in

vim +2964 mm/vmalloc.c

2933
2934 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_64)
2935 #if defined(CONFIG_RANDOMIZE_BASE)
2936 static void print_backup_area(struct seq_file *m, unsigned long backup_cnt)
2937 {
2938 if (kaslr_enabled())
2939 seq_printf(m, "Allocations in backup area:\t%lu\n", backup_cnt);
2940 }
2941 #else
2942 static void print_backup_area(struct seq_file *m, unsigned long backup_cnt)
2943 {
2944 }
2945 #endif
2946 static int modulefraginfo_debug_show(struct seq_file *m, void *v)
2947 {
2948 struct list_head *i;
2949 unsigned long last_end = MODULES_VADDR;
2950 unsigned long total_free = 0;
2951 unsigned long largest_free = 0;
2952 unsigned long backup_cnt = 0;
2953 unsigned long gap;
2954
2955 spin_lock(&vmap_area_lock);
2956
2957 list_for_each(i, &vmap_area_list) {
2958 struct vmap_area *obj = list_entry(i, struct vmap_area, list);
2959
2960 if (!(obj->flags & VM_LAZY_FREE)
2961 && obj->va_start >= MODULES_VADDR
2962 && obj->va_end <= MODULES_END) {
2963
> 2964 if (obj->va_start >= MODULES_VADDR + MODULES_RAND_LEN)
2965 backup_cnt++;
2966
2967 gap = (obj->va_start - last_end);
2968 if (gap > largest_free)
2969 largest_free = gap;
2970 total_free += gap;
2971
2972 last_end = obj->va_end;
2973 }
2974 }
2975
2976 gap = (MODULES_END - last_end);
2977 if (gap > largest_free)
2978 largest_free = gap;
2979 total_free += gap;
2980
2981 spin_unlock(&vmap_area_lock);
2982
2983 seq_printf(m, "Largest free space:\t\t%lu\n", largest_free);
2984 if (total_free)
2985 seq_printf(m, "External Memory Fragmentation:\t%lu%%\n",
2986 100-(100*largest_free/total_free));
2987 else
2988 seq_puts(m, "External Memory Fragmentation:\t0%%\n");
2989
2990 print_backup_area(m, backup_cnt);
2991
2992 return 0;
2993 }
2994

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip