Content-Type: multipart/mixed; boundary="===============6605356466735533646==" MIME-Version: 1.0 From: Kees Cook To: kbuild-all@lists.01.org Subject: Re: [PATCH] x86: Alias memset to __builtin_memset. Date: Mon, 23 Mar 2020 14:59:37 -0700 Message-ID: <202003231457.C83B81234D@keescook> In-Reply-To: <202003240432.AGknaLzA%lkp@intel.com> List-Id: --===============6605356466735533646== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue, Mar 24, 2020 at 04:16:10AM +0800, kbuild test robot wrote: > Hi Clement, > = > Thank you for the patch! Yet something to improve: > = > [auto build test ERROR on tip/x86/core] > [also build test ERROR on v5.6-rc7 next-20200323] > [if your patch is applied to the wrong git tree, please drop us a note to= help > improve the system. BTW, we also suggest to use '--base' option to specif= y the > base tree in git format-patch, please see https://stackoverflow.com/a/374= 06982] > = > url: https://github.com/0day-ci/linux/commits/Clement-Courbet/x86-Alia= s-memset-to-__builtin_memset/20200324-004007 > base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 248ed= 51048c40d36728e70914e38bffd7821da57 > config: x86_64-randconfig-h003-20200323 (attached as .config) > compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 0062= 44152d6c7dd6a390ff89b236cc7801834b46) > reproduce: > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbi= n/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > COMPILER=3Dclang make.cross ARCH=3Dx86_64 = > = > If you fix the issue, kindly add following tag > Reported-by: kbuild test robot > = > All errors (new ones prefixed by >>): > = > In file included from scripts/mod/devicetable-offsets.c:3: > In file included from include/linux/mod_devicetable.h:13: > In file included from include/linux/uuid.h:12: > >> include/linux/string.h:358:24: error: definition of builtin function '= __builtin_memset' > __FORTIFY_INLINE void *memset(void *p, int c, __kernel_size_t size) > ^ > arch/x86/include/asm/string_64.h:27:29: note: expanded from macro 'mem= set' > #define memset(s, c, count) __builtin_memset(s, c, count) > ^ This needs to be within #ifndef CONFIG_FORTIFY_SOURCE. FORTIFY already does this. Additionally, shouldn't this just be done universally, instead of in x86-specific code? -Kees > 1 error generated. > make[2]: *** [scripts/Makefile.build:99: scripts/mod/devicetable-offse= ts.s] Error 1 > make[2]: Target '__build' not remade because of errors. > make[1]: *** [Makefile:1112: prepare0] Error 2 > make[1]: Target 'prepare' not remade because of errors. > make: *** [Makefile:179: sub-make] Error 2 > 27 real 8 user 13 sys 79.89% cpu make prepare > = > vim +/__builtin_memset +358 include/linux/string.h > = > 6974f0c4555e28 Daniel Micay 2017-07-12 357 = > 6974f0c4555e28 Daniel Micay 2017-07-12 @358 __FORTIFY_INLINE void *memse= t(void *p, int c, __kernel_size_t size) > 6974f0c4555e28 Daniel Micay 2017-07-12 359 { > 6974f0c4555e28 Daniel Micay 2017-07-12 360 size_t p_size =3D __builtin= _object_size(p, 0); > 6974f0c4555e28 Daniel Micay 2017-07-12 361 if (__builtin_constant_p(si= ze) && p_size < size) > 6974f0c4555e28 Daniel Micay 2017-07-12 362 __write_overflow(); > 6974f0c4555e28 Daniel Micay 2017-07-12 363 if (p_size < size) > 6974f0c4555e28 Daniel Micay 2017-07-12 364 fortify_panic(__func__); > 6974f0c4555e28 Daniel Micay 2017-07-12 365 return __builtin_memset(p, = c, size); > 6974f0c4555e28 Daniel Micay 2017-07-12 366 } > 6974f0c4555e28 Daniel Micay 2017-07-12 367 = > = > :::::: The code at line 358 was first introduced by commit > :::::: 6974f0c4555e285ab217cee58b6e874f776ff409 include/linux/string.h: a= dd the option of fortified string.h functions > = > :::::: TO: Daniel Micay > :::::: CC: Linus Torvalds > = > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org > = > -- = > You received this message because you are subscribed to the Google Groups= "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an= email to clang-built-linux+unsubscribe(a)googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgi= d/clang-built-linux/202003240432.AGknaLzA%25lkp%40intel.com. -- = Kees Cook --===============6605356466735533646==--