Re: [linux-next:master 7012/7430] include/linux/compiler_types.h:328:38: error: call to '__compiletime_assert_183' declared with attribute error: unexpected size in kmalloc_index()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 09, 2021 at 03:45:01AM +0900, Hyeonggon Yoo wrote:
> I verified as below.
> clang didn't make an error, gcc worked as expected.
> 
> then I can explain why there is no error with clang:
> 	it just did nothing with BUILD_BUG_ON.
>

Well I deleted output something too much... (making it confusing)
I send output without deleting part of it

hyeyoo@hyeyoo:~/바탕화면/linux-next$ git diff
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 8d8dd8571261..f2f9a6a7e663 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -379,6 +379,9 @@ static __always_inline enum kmalloc_cache_type kmalloc_type(gfp_t flags)
 static __always_inline unsigned int __kmalloc_index(size_t size,
                                                    bool size_is_constant)
 {
+
+       BUILD_BUG_ON(1);
+
        if (!size)
                return 0;
 
hyeyoo@hyeyoo:~/바탕화면/linux-next$ make mm/kfence/kfence_test.o
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND objtool
  CC      mm/kfence/kfence_test.o
In file included from <command-line>:
In function ‘__kmalloc_index’,
    inlined from ‘kmalloc_cache_alignment’ at mm/kfence/kfence_test.c:200:50:
././include/linux/compiler_types.h:328:38: error: call to ‘__compiletime_assert_131’ declared with attribute error: BUILD_BUG_ON failed: 1
  328 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |                                      ^
././include/linux/compiler_types.h:309:4: note: in definition of macro ‘__compiletime_assert’
  309 |    prefix ## suffix();    \
      |    ^~~~~~
././include/linux/compiler_types.h:328:2: note: in expansion of macro ‘_compiletime_assert’
  328 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |  ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
   50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
      |  ^~~~~~~~~~~~~~~~
./include/linux/slab.h:383:2: note: in expansion of macro ‘BUILD_BUG_ON’
  383 |  BUILD_BUG_ON(1);
      |  ^~~~~~~~~~~~
In function ‘__kmalloc_index’,
    inlined from ‘test_alloc’ at mm/kfence/kfence_test.c:271:47:
././include/linux/compiler_types.h:328:38: error: call to ‘__compiletime_assert_131’ declared with attribute error: BUILD_BUG_ON failed: 1
  328 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |                                      ^
././include/linux/compiler_types.h:309:4: note: in definition of macro ‘__compiletime_assert’
  309 |    prefix ## suffix();    \
      |    ^~~~~~
././include/linux/compiler_types.h:328:2: note: in expansion of macro ‘_compiletime_assert’
  328 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |  ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
   50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
      |  ^~~~~~~~~~~~~~~~
./include/linux/slab.h:383:2: note: in expansion of macro ‘BUILD_BUG_ON’
  383 |  BUILD_BUG_ON(1);
      |  ^~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:272: mm/kfence/kfence_test.o] 오류 1
make[1]: *** [scripts/Makefile.build:533: mm/kfence] 오류 2
make: *** [Makefile:1948: mm] 오류 2
hyeyoo@hyeyoo:~/바탕화면/linux-next$ make mm/kfence/kfence_test.o CC=clang-11
  SYNC    include/config/auto.conf.cmd
*
* Restart config...
*
*
* Memory initialization
*
Initialize kernel stack variables at function entry
> 1. no automatic initialization (weakest) (INIT_STACK_NONE)
  2. 0xAA-init everything on the stack (strongest) (INIT_STACK_ALL_PATTERN) (NEW)
  3. zero-init everything on the stack (strongest and safest) (INIT_STACK_ALL_ZERO) (NEW)
choice[1-3?]: 
Enable heap memory zeroing on allocation by default (INIT_ON_ALLOC_DEFAULT_ON) [Y/n/?] y
Enable heap memory zeroing on free by default (INIT_ON_FREE_DEFAULT_ON) [N/y/?] n
*
* KCSAN: dynamic data race detector
*
KCSAN: dynamic data race detector (KCSAN) [N/y/?] (NEW) 
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      kernel/bounds.s
  CC      arch/x86/kernel/asm-offsets.s
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND objtool
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/arch/x86/special.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/arch/x86/decode.o
  LD      /home/hyeyoo/바탕화면/linux-next/tools/objtool/arch/x86/objtool-in.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/weak.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/check.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/special.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/orc_gen.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/orc_dump.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/builtin-check.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/builtin-orc.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/elf.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/objtool.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/libstring.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/libctype.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/str_error_r.o
  CC      /home/hyeyoo/바탕화면/linux-next/tools/objtool/librbtree.o
  LD      /home/hyeyoo/바탕화면/linux-next/tools/objtool/objtool-in.o
  LINK    /home/hyeyoo/바탕화면/linux-next/tools/objtool/objtool
  CC      mm/kfence/kfence_test.o
hyeyoo@hyeyoo:~/바탕화면/linux-next$ 





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux