Hi Alexander, I love your patch! Yet something to improve: [auto build test ERROR on tip/x86/core] [also build test ERROR on tip/x86/mm linus/master v5.18-rc4 next-20220426] [cannot apply to hnaz-mm/master] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/intel-lab-lkp/linux/commits/Alexander-Potapenko/Add-KernelMemorySanitizer-infrastructure/20220427-004851 base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 203d8919a9eda5d1bc68ac3cd7637588334c9dc1 config: i386-randconfig-a014-20220425 (https://download.01.org/0day-ci/archive/20220427/202204271447.yO4J25Hd-lkp@xxxxxxxxx/config) compiler: gcc-11 (Debian 11.2.0-20) 11.2.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/d216de19c8dd97fb6b0eac84fce4362489a61b2e git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Alexander-Potapenko/Add-KernelMemorySanitizer-infrastructure/20220427-004851 git checkout d216de19c8dd97fb6b0eac84fce4362489a61b2e # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): In file included from include/linux/uaccess.h:11, from include/linux/sched/task.h:11, from include/linux/sched/signal.h:9, from include/linux/rcuwait.h:6, from include/linux/percpu-rwsem.h:7, from include/linux/fs.h:33, from include/linux/huge_mm.h:8, from include/linux/mm.h:700, from arch/x86/math-emu/fpu_system.h:18, from arch/x86/math-emu/fpu_emu.h:73, from arch/x86/math-emu/reg_ld_str.c:21: arch/x86/math-emu/reg_ld_str.c: In function 'fldenv': >> arch/x86/include/asm/uaccess.h:103:50: error: cannot take address of bit-field 'selector' 103 | instrument_copy_from_user_before((void *)&(x), ptr, sizeof(*(ptr))); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1043:17: note: in expansion of macro 'FPU_get_user' 1043 | FPU_get_user(instruction_address.selector, | ^~~~~~~~~~~~ arch/x86/include/asm/uaccess.h:109:49: error: cannot take address of bit-field 'selector' 109 | instrument_copy_from_user_after((void *)&(x), ptr, sizeof(*(ptr)), 0); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1043:17: note: in expansion of macro 'FPU_get_user' 1043 | FPU_get_user(instruction_address.selector, | ^~~~~~~~~~~~ >> arch/x86/include/asm/uaccess.h:103:50: error: cannot take address of bit-field 'selector' 103 | instrument_copy_from_user_before((void *)&(x), ptr, sizeof(*(ptr))); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1047:17: note: in expansion of macro 'FPU_get_user' 1047 | FPU_get_user(operand_address.selector, | ^~~~~~~~~~~~ arch/x86/include/asm/uaccess.h:109:49: error: cannot take address of bit-field 'selector' 109 | instrument_copy_from_user_after((void *)&(x), ptr, sizeof(*(ptr)), 0); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1047:17: note: in expansion of macro 'FPU_get_user' 1047 | FPU_get_user(operand_address.selector, | ^~~~~~~~~~~~ >> arch/x86/include/asm/uaccess.h:103:50: error: cannot take address of bit-field 'selector' 103 | instrument_copy_from_user_before((void *)&(x), ptr, sizeof(*(ptr))); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1065:17: note: in expansion of macro 'FPU_get_user' 1065 | FPU_get_user(instruction_address.selector, | ^~~~~~~~~~~~ arch/x86/include/asm/uaccess.h:109:49: error: cannot take address of bit-field 'selector' 109 | instrument_copy_from_user_after((void *)&(x), ptr, sizeof(*(ptr)), 0); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1065:17: note: in expansion of macro 'FPU_get_user' 1065 | FPU_get_user(instruction_address.selector, | ^~~~~~~~~~~~ >> arch/x86/include/asm/uaccess.h:103:50: error: cannot take address of bit-field 'opcode' 103 | instrument_copy_from_user_before((void *)&(x), ptr, sizeof(*(ptr))); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1067:17: note: in expansion of macro 'FPU_get_user' 1067 | FPU_get_user(instruction_address.opcode, | ^~~~~~~~~~~~ arch/x86/include/asm/uaccess.h:109:49: error: cannot take address of bit-field 'opcode' 109 | instrument_copy_from_user_after((void *)&(x), ptr, sizeof(*(ptr)), 0); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1067:17: note: in expansion of macro 'FPU_get_user' 1067 | FPU_get_user(instruction_address.opcode, | ^~~~~~~~~~~~ >> arch/x86/include/asm/uaccess.h:103:50: error: cannot take address of bit-field 'selector' 103 | instrument_copy_from_user_before((void *)&(x), ptr, sizeof(*(ptr))); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1071:17: note: in expansion of macro 'FPU_get_user' 1071 | FPU_get_user(operand_address.selector, | ^~~~~~~~~~~~ arch/x86/include/asm/uaccess.h:109:49: error: cannot take address of bit-field 'selector' 109 | instrument_copy_from_user_after((void *)&(x), ptr, sizeof(*(ptr)), 0); \ | ^ arch/x86/include/asm/uaccess.h:131:43: note: in expansion of macro 'do_get_user_call' 131 | #define get_user(x,ptr) ({ might_fault(); do_get_user_call(get_user,x,ptr); }) | ^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_system.h:127:36: note: in expansion of macro 'get_user' 127 | #define FPU_get_user(x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) | ^~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1071:17: note: in expansion of macro 'FPU_get_user' 1071 | FPU_get_user(operand_address.selector, | ^~~~~~~~~~~~ vim +/selector +103 arch/x86/include/asm/uaccess.h 66 67 /* 68 * This is the smallest unsigned integer type that can fit a value 69 * (up to 'long long') 70 */ 71 #define __inttype(x) __typeof__( \ 72 __typefits(x,char, \ 73 __typefits(x,short, \ 74 __typefits(x,int, \ 75 __typefits(x,long,0ULL))))) 76 77 #define __typefits(x,type,not) \ 78 __builtin_choose_expr(sizeof(x)<=sizeof(type),(unsigned type)0,not) 79 80 /* 81 * This is used for both get_user() and __get_user() to expand to 82 * the proper special function call that has odd calling conventions 83 * due to returning both a value and an error, and that depends on 84 * the size of the pointer passed in. 85 * 86 * Careful: we have to cast the result to the type of the pointer 87 * for sign reasons. 88 * 89 * The use of _ASM_DX as the register specifier is a bit of a 90 * simplification, as gcc only cares about it as the starting point 91 * and not size: for a 64-bit value it will use %ecx:%edx on 32 bits 92 * (%ecx being the next register in gcc's x86 register sequence), and 93 * %rdx on 64 bits. 94 * 95 * Clang/LLVM cares about the size of the register, but still wants 96 * the base register for something that ends up being a pair. 97 */ 98 #define do_get_user_call(fn,x,ptr) \ 99 ({ \ 100 int __ret_gu; \ 101 register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX); \ 102 __chk_user_ptr(ptr); \ > 103 instrument_copy_from_user_before((void *)&(x), ptr, sizeof(*(ptr))); \ 104 asm volatile("call __" #fn "_%P4" \ 105 : "=a" (__ret_gu), "=r" (__val_gu), \ 106 ASM_CALL_CONSTRAINT \ 107 : "0" (ptr), "i" (sizeof(*(ptr)))); \ 108 (x) = (__force __typeof__(*(ptr))) __val_gu; \ 109 instrument_copy_from_user_after((void *)&(x), ptr, sizeof(*(ptr)), 0); \ 110 __builtin_expect(__ret_gu, 0); \ 111 }) 112 -- 0-DAY CI Kernel Test Service https://01.org/lkp