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 B7083ECAAA1 for ; Fri, 2 Sep 2022 22:51:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF86780140; Fri, 2 Sep 2022 18:51:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA72480120; Fri, 2 Sep 2022 18:51:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6F1680140; Fri, 2 Sep 2022 18:51:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A74B580120 for ; Fri, 2 Sep 2022 18:51:35 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 713261401BD for ; Fri, 2 Sep 2022 22:51:35 +0000 (UTC) X-FDA: 79868643750.06.480C101 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by imf19.hostedemail.com (Postfix) with ESMTP id 8A57C1A0043 for ; Fri, 2 Sep 2022 22:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662159094; x=1693695094; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=c/19cmV74+lMDRhNQPWjhl5pMjXYVED88nc4t0Rx8I8=; b=SZ22cxdunRzPFlBnXONAWJYAVZlLJkVCfW1BpluML2JrYSTY+B1AM+ni 71syhayUAYlaHaNYLlzo2sQi3iIrFNXbLI458FZ2Ko65T5s9hSq0CrVNS DJJOoRnz+49ux+TP3WEel8L4WVPhCU+JZjRlrt7Ma89bWSdF3v7RrdHr4 TJbOkTxeI0PAL/N9yp5zmLsys8ay0OMToQfrGKEYFeTsQfX5kyO+eDsAX T4fkeMgHR/jVc7CDJik8F5A5WGfpitzWhcUIvSYSfz8XsaTvHbWy8A6+t UYSA+iejXVtRrg4wfCN9LBy4pAFIVxWh8EK6DzgWqH56+4IDddkE8zIIB Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10458"; a="357818429" X-IronPort-AV: E=Sophos;i="5.93,285,1654585200"; d="scan'208";a="357818429" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2022 15:51:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,285,1654585200"; d="scan'208";a="613191709" Received: from lkp-server02.sh.intel.com (HELO 95dfd251caa2) ([10.239.97.151]) by orsmga002.jf.intel.com with ESMTP; 02 Sep 2022 15:51:27 -0700 Received: from kbuild by 95dfd251caa2 with local (Exim 4.96) (envelope-from ) id 1oUFVX-0000gt-0M; Fri, 02 Sep 2022 22:51:27 +0000 Date: Sat, 3 Sep 2022 06:50:55 +0800 From: kernel test robot To: Kees Cook , Nick Desaulniers Cc: kbuild-all@lists.01.org, Kees Cook , linux-hardening@vger.kernel.org, Nathan Chancellor , Tom Rix , Andrew Morton , Linux Memory Management List , Vlastimil Babka , "Steven Rostedt (Google)" , David Gow , Yury Norov , Masami Hiramatsu , Sander Vanheule , Peter Zijlstra , Josh Poimboeuf , Dan Williams , Isabella Basso , Eric Dumazet , Rasmus Villemoes , Eric Biggers , Hannes Reinecke , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v2 3/3] fortify: Use SIZE_MAX instead of (size_t)-1 Message-ID: <202209030625.wdoOhjAW-lkp@intel.com> References: <20220902204351.2521805-4-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220902204351.2521805-4-keescook@chromium.org> ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=SZ22cxdu; spf=pass (imf19.hostedemail.com: domain of lkp@intel.com designates 134.134.136.31 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662159095; a=rsa-sha256; cv=none; b=rdkMRT//rlVuRptVVeJb61eLlrXlip1DAutc4cKuvtnoX26CVRIkOxGIViFdql5XCYOOxG yb9I9seNjqi9hSaFSucpld9KO4yGSn34+ZCuOO20jU7p7Fkol6rHm1XUmMXZcTdGnV5lZj ldXIJc9e8cYZ5dWn2EoB1Hn6HPcqu6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662159095; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+AqynezTg+2y76J2r7H3STQKFhbzdkGT4OzzVnLjWUg=; b=zJ394CusVfHo8Y0HZyri/dZunAk6MEb+qhdsYfuFL8H2J0C7KlfeapSQkiDqU4nrBQ8xIA bFc6L00y1+su2bpouIA4HQ2cbqNcAnH64LkrQwVbEsO7KymRy5z7aI1YZG3y3ndsSdJVSB 21BTjKKiEP70Me/n9U/1X8YXLMjxKZc= X-Stat-Signature: wxongrte8r9mjcpaxhpz174iyh73ntpf X-Rspamd-Queue-Id: 8A57C1A0043 Authentication-Results: imf19.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=SZ22cxdu; spf=pass (imf19.hostedemail.com: domain of lkp@intel.com designates 134.134.136.31 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1662159094-640119 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 Kees, I love your patch! Yet something to improve: [auto build test ERROR on akpm-mm/mm-everything] [also build test ERROR on linus/master kees/for-next/pstore v6.0-rc3 next-20220901] [cannot apply to kees/for-next/hardening] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Kees-Cook/Fix-FORTIFY-y-UBSAN_LOCAL_BOUNDS-y/20220903-044622 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20220903/202209030625.wdoOhjAW-lkp@intel.com/config) compiler: powerpc-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/6c991b3511a531e44e856fdf2b64020b70fd7b22 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Kees-Cook/Fix-FORTIFY-y-UBSAN_LOCAL_BOUNDS-y/20220903-044622 git checkout 6c991b3511a531e44e856fdf2b64020b70fd7b22 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc prepare If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot All errors (new ones prefixed by >>): scripts/genksyms/parse.y: warning: 9 shift/reduce conflicts [-Wconflicts-sr] scripts/genksyms/parse.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr] scripts/genksyms/parse.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples In file included from include/linux/string.h:253, from include/linux/uuid.h:12, from include/linux/mod_devicetable.h:13, from scripts/mod/devicetable-offsets.c:3: include/linux/fortify-string.h: In function 'strcat': >> include/linux/fortify-string.h:98:23: error: 'SIZE_MAX' undeclared (first use in this function) 98 | if (p_size == SIZE_MAX) | ^~~~~~~~ include/linux/fortify-string.h:6:1: note: 'SIZE_MAX' is defined in header ''; did you forget to '#include '? 5 | #include +++ |+#include 6 | include/linux/fortify-string.h:98:23: note: each undeclared identifier is reported only once for each function it appears in 98 | if (p_size == SIZE_MAX) | ^~~~~~~~ include/linux/fortify-string.h: In function 'strnlen': include/linux/fortify-string.h:20:24: error: 'SIZE_MAX' undeclared (first use in this function) 20 | size_t __ret = SIZE_MAX; \ | ^~~~~~~~ include/linux/fortify-string.h:109:24: note: in expansion of macro '__compiletime_strlen' 109 | size_t p_len = __compiletime_strlen(p); | ^~~~~~~~~~~~~~~~~~~~ include/linux/fortify-string.h:20:24: note: 'SIZE_MAX' is defined in header ''; did you forget to '#include '? 20 | size_t __ret = SIZE_MAX; \ | ^~~~~~~~ include/linux/fortify-string.h:109:24: note: in expansion of macro '__compiletime_strlen' 109 | size_t p_len = __compiletime_strlen(p); | ^~~~~~~~~~~~~~~~~~~~ include/linux/fortify-string.h: In function '__fortify_strlen': include/linux/fortify-string.h:141:23: error: 'SIZE_MAX' undeclared (first use in this function) 141 | if (p_size == SIZE_MAX) | ^~~~~~~~ include/linux/fortify-string.h:141:23: note: 'SIZE_MAX' is defined in header ''; did you forget to '#include '? include/linux/fortify-string.h: In function 'strlcpy': include/linux/fortify-string.h:158:23: error: 'SIZE_MAX' undeclared (first use in this function) 158 | if (p_size == SIZE_MAX && q_size == SIZE_MAX) | ^~~~~~~~ include/linux/fortify-string.h:158:23: note: 'SIZE_MAX' is defined in header ''; did you forget to '#include '? include/linux/fortify-string.h: In function 'strscpy': include/linux/fortify-string.h:186:23: error: 'SIZE_MAX' undeclared (first use in this function) 186 | if (p_size == SIZE_MAX && q_size == SIZE_MAX) | ^~~~~~~~ include/linux/fortify-string.h:186:23: note: 'SIZE_MAX' is defined in header ''; did you forget to '#include '? include/linux/fortify-string.h: In function 'strncat': include/linux/fortify-string.h:231:23: error: 'SIZE_MAX' undeclared (first use in this function) 231 | if (p_size == SIZE_MAX && q_size == SIZE_MAX) | ^~~~~~~~ include/linux/fortify-string.h:231:23: note: 'SIZE_MAX' is defined in header ''; did you forget to '#include '? include/linux/fortify-string.h: In function 'fortify_memset_chk': include/linux/fortify-string.h:275:23: error: 'SIZE_MAX' undeclared (first use in this function) 275 | if (p_size != SIZE_MAX && p_size < size) | ^~~~~~~~ include/linux/fortify-string.h:275:23: note: 'SIZE_MAX' is defined in header ''; did you forget to '#include '? include/linux/fortify-string.h: In function 'fortify_memcpy_chk': include/linux/fortify-string.h:369:24: error: 'SIZE_MAX' undeclared (first use in this function) 369 | if ((p_size != SIZE_MAX && p_size < size) || | ^~~~~~~~ include/linux/fortify-string.h:369:24: note: 'SIZE_MAX' is defined in header ''; did you forget to '#include '? include/linux/fortify-string.h: In function 'strcpy': include/linux/fortify-string.h:469:23: error: 'SIZE_MAX' undeclared (first use in this function) 469 | if (p_size == SIZE_MAX && q_size == SIZE_MAX) | ^~~~~~~~ include/linux/fortify-string.h:469:23: note: 'SIZE_MAX' is defined in header ''; did you forget to '#include '? make[2]: *** [scripts/Makefile.build:117: scripts/mod/devicetable-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors. make[1]: *** [Makefile:1204: prepare0] Error 2 make[1]: Target 'prepare' not remade because of errors. make: *** [Makefile:222: __sub-make] Error 2 make: Target 'prepare' not remade because of errors. vim +/SIZE_MAX +98 include/linux/fortify-string.h 92 93 __FORTIFY_INLINE __diagnose_as(__builtin_strcat, 1, 2) 94 char *strcat(char * const POS p, const char *q) 95 { 96 size_t p_size = __builtin_object_size(p, 1); 97 > 98 if (p_size == SIZE_MAX) 99 return __underlying_strcat(p, q); 100 if (strlcat(p, q, p_size) >= p_size) 101 fortify_panic(__func__); 102 return p; 103 } 104 -- 0-DAY CI Kernel Test Service https://01.org/lkp