From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BC65C433EF for ; Wed, 27 Apr 2022 06:59:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B89376B0073; Wed, 27 Apr 2022 02:59:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B60206B0075; Wed, 27 Apr 2022 02:59:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A00476B0078; Wed, 27 Apr 2022 02:59:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 90E5E6B0073 for ; Wed, 27 Apr 2022 02:59:40 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 6670381C3C for ; Wed, 27 Apr 2022 06:59:40 +0000 (UTC) X-FDA: 79401758520.21.46F3A5E Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf19.hostedemail.com (Postfix) with ESMTP id 890321A004B for ; Wed, 27 Apr 2022 06:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651042779; x=1682578779; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=FKb9D1yteJKwWEqL2ztVkNTtWnG0z/DBtUvPjCQ9P2Y=; b=PkpLo1+kCxuPaL33un54YN0BU8ckd3C37WSahYUirvvIMnTplGu6ozOG B+zYv1gQYj0SIkoECqQe6jSz0LQRDzN8OkxGR7E0X3ik+VekT4clhZN3i P5P9j/TUlHaKgukITBwxA7IvPr3YEZDnf1dHceUulcFhmIcsUkSPKvlw1 t7aGa3oUSfubQ7n3M4OuyAKeMLCePHkJQ1B2+aToLHZ601okSyKXloE3J 6LWkbDZ9A2BQCjJ9p368GSZQcTzZIpUWJD/B7XsKy1WEzLCP0ZQdhhAZX ol2s3p2kpVVGla5FUivzCYAoiqrS/aRstCoGIYskPfohtqAJHSN1Lpl7U g==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="265999164" X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="265999164" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 23:59:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="807894094" Received: from lkp-server01.sh.intel.com (HELO 5056e131ad90) ([10.239.97.150]) by fmsmga006.fm.intel.com with ESMTP; 26 Apr 2022 23:59:30 -0700 Received: from kbuild by 5056e131ad90 with local (Exim 4.95) (envelope-from ) id 1njbe5-0004Qq-Ql; Wed, 27 Apr 2022 06:59:29 +0000 Date: Wed, 27 Apr 2022 14:58:49 +0800 From: kernel test robot To: Alexander Potapenko Cc: kbuild-all@lists.01.org, Alexander Viro , Andrew Morton , Linux Memory Management List , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Thomas Gleixner , Vasily Gorbik Subject: Re: [PATCH v3 05/46] x86: asm: instrument usercopy in get_user() and __put_user_size() Message-ID: <202204271447.yO4J25Hd-lkp@intel.com> References: <20220426164315.625149-6-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220426164315.625149-6-glider@google.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 890321A004B X-Stat-Signature: i3b5wp83yjpmji13bdyuaqbrmdegikhn Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=PkpLo1+k; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf19.hostedemail.com: domain of lkp@intel.com has no SPF policy when checking 192.55.52.115) smtp.mailfrom=lkp@intel.com X-Rspam-User: X-HE-Tag: 1651042775-328186 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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@intel.com/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 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