All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] x86: Alias memset to __builtin_memset.
Date: Mon, 23 Mar 2020 14:59:37 -0700	[thread overview]
Message-ID: <202003231457.C83B81234D@keescook> (raw)
In-Reply-To: <202003240432.AGknaLzA%lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4178 bytes --]

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 specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Clement-Courbet/x86-Alias-memset-to-__builtin_memset/20200324-004007
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 248ed51048c40d36728e70914e38bffd7821da57
> config: x86_64-randconfig-h003-20200323 (attached as .config)
> compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 006244152d6c7dd6a390ff89b236cc7801834b46)
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         COMPILER=clang make.cross ARCH=x86_64 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> 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 'memset'
>    #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-offsets.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 *memset(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 = __builtin_object_size(p, 0);
> 6974f0c4555e28 Daniel Micay 2017-07-12  361  	if (__builtin_constant_p(size) && 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: add the option of fortified string.h functions
> 
> :::::: TO: Daniel Micay <danielmicay@gmail.com>
> :::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
> 
> ---
> 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/msgid/clang-built-linux/202003240432.AGknaLzA%25lkp%40intel.com.



-- 
Kees Cook

  reply	other threads:[~2020-03-23 21:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23 11:42 [PATCH] x86: Alias memset to __builtin_memset Clement Courbet
2020-03-23 15:47 ` Nathan Chancellor
2020-03-23 20:16 ` kbuild test robot
2020-03-23 21:59   ` Kees Cook [this message]
2020-03-24  1:22 ` Nick Desaulniers
2020-03-24  1:26   ` Nick Desaulniers
2020-03-24 14:06 ` Clement Courbet
2020-03-24 17:29   ` Nick Desaulniers
2020-03-24 14:07 ` [PATCH v2] " Clement Courbet
2020-03-24 15:08   ` Joe Perches
2020-03-24 15:59 ` [PATCH v3] " Clement Courbet
2020-03-25 11:33   ` Bernd Petrovitsch
2020-03-24 16:02 ` [PATCH] " Clement Courbet
2020-03-25  7:59 ` Clement Courbet
2020-03-26 12:25 ` [PATCH v4] " Clement Courbet
2020-03-26 12:38 ` [PATCH] " Clement Courbet
2020-03-26 12:38   ` Clement Courbet
2020-03-26 17:18   ` Nick Desaulniers
2020-03-26 17:18     ` Nick Desaulniers
2020-03-27  4:06   ` Michael Ellerman
2020-03-27  4:06     ` Michael Ellerman
2020-03-27 17:12   ` Segher Boessenkool
2020-03-27 17:12     ` Segher Boessenkool

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202003231457.C83B81234D@keescook \
    --to=keescook@chromium.org \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.