linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: kernel test robot <lkp@intel.com>,
	kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: 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: Wed, 9 Jun 2021 03:50:06 +0900	[thread overview]
Message-ID: <20210608185006.GB5505@hyeyoo> (raw)
In-Reply-To: <20210608184501.GA5505@hyeyoo>

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$ 


  reply	other threads:[~2021-06-08 18:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05  6:10 kernel test robot
2021-06-06 11:08 ` Hyeonggon Yoo
2021-06-07 11:40   ` Vlastimil Babka
2021-06-07 12:25     ` Hyeonggon Yoo
2021-06-07 15:27       ` Vlastimil Babka
2021-06-07 15:49         ` Hyeonggon Yoo
2021-06-08  7:57           ` Vlastimil Babka
2021-06-08 17:05             ` Hyeonggon Yoo
2021-06-08 17:27               ` Vlastimil Babka
2021-06-08 18:45                 ` Hyeonggon Yoo
2021-06-08 18:50                   ` Hyeonggon Yoo [this message]
2021-06-10  5:17                   ` Some logical errors on my words, but I still wonder Hyeonggon Yoo
2021-06-10 11:43                   ` [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() Vlastimil Babka
     [not found]                     ` <CAB=+i9StdrGQWXXoQHKU5oLK3eKuNcuCAbrd88kPLzM_Yw==Jg@mail.gmail.com>
2021-06-11 16:56                       ` Nathan Chancellor
2021-06-12  0:31                         ` Hyeonggon Yoo
     [not found]                       ` <d89798b1-ac4f-ab3e-27be-b1d40b8d7193@suse.cz>
     [not found]                         ` <CAB=+i9Snmu7ML3Zqrbii1-jtS0BF_KeGEhn-R49Z2bh=uW-rGg@mail.gmail.com>
2021-06-11 23:59                           ` Vlastimil Babka
2021-06-12  0:19                             ` Hyeonggon Yoo
2021-06-14  9:26                               ` [PATCH FIX -next] " Vlastimil Babka

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=20210608185006.GB5505@hyeyoo \
    --to=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=vbabka@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox