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 X-Spam-Level: X-Spam-Status: No, score=-4.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CB6CC4743F for ; Tue, 8 Jun 2021 18:50:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B4AEB613CC for ; Tue, 8 Jun 2021 18:50:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4AEB613CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4DF966B006C; Tue, 8 Jun 2021 14:50:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48FE76B006E; Tue, 8 Jun 2021 14:50:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E2616B0070; Tue, 8 Jun 2021 14:50:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0225.hostedemail.com [216.40.44.225]) by kanga.kvack.org (Postfix) with ESMTP id EDD326B006C for ; Tue, 8 Jun 2021 14:50:13 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9152BA77A for ; Tue, 8 Jun 2021 18:50:13 +0000 (UTC) X-FDA: 78231446706.18.A0DA0B3 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf29.hostedemail.com (Postfix) with ESMTP id 1D0A3371 for ; Tue, 8 Jun 2021 18:50:08 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id k22-20020a17090aef16b0290163512accedso2272419pjz.0 for ; Tue, 08 Jun 2021 11:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=qU5dHeM7Iei/1HE/bVj+fk8pM0oepM/NUDc+y4fGy/Q=; b=RnVbzx2ytKyhhSsybuPpb02fAFg5sClPjM4MpfAupUSoWZPiABgKJYUQthcvBdZWbb RVOoD6oYxUQ+ttR7n0asSUuklEEAANGgJKmkk3fow+d64d85ywekzhL6No0SQSXbHaoR 1Wks5W/Kw3IUjKAEJcoL0EPnwBzLcBNR0zzSFbdQXuMxRZiHVS2hIp7rzl8w4kuLqC1O hpp9/KonHaechubdhw8FlxINn9JkOU2lFRjOPUp6w1SKt1fYAlZs2R5YSFXrLTrHAfJa 9fKP1fuUmH6sKKbvpptYU0Mpcy6cDXnDsy9zkYFb1GdmrpS0SH1rARPqvvIunCEacOWU VxJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=qU5dHeM7Iei/1HE/bVj+fk8pM0oepM/NUDc+y4fGy/Q=; b=mV6RlcO4Ly2LDzHkdbkHFRpW5MlvFFVVCYNMazMhaAXNNRJ0y+i9HiYhg+LnIC3OOC 30IWWXHTn/9+ekkdMxCVR7ZyjRvvZ7MKitwUE4/rDlx8EyyyfseOKPch2gLFMnvajcn7 eNlATbwN+a9mmqyrRaorCsQs/3tZbGGrHP37Pia/gIzr53zRVssETOS838/lC5yWZUUu chJf9Sts/5DokMsvmYuPL2QTXutB7ver5G30Scy9DAe/7Lc/U02f9muLdbah1SLk17FX ZJBdeb1ALRnAqKyTq1vNvfIv1BqtbvcvCV6GpBOBIHa9xcOWAarCPc8cbGuWDt24vh7u GhWg== X-Gm-Message-State: AOAM532XzVWD5rFRv76dRcdksm62s7HzChkb7qokcxHDqvqoOkH1V6Nb cxn47kMBAwoZl9JtjyGHQ00FvkGvxU6Zzh3M X-Google-Smtp-Source: ABdhPJxKkBqLT/S1BKpaPPuXyrWzkSJa0XLAJxz6Y4zqbwyAXACAuutjppI0kpoykUNiHTh/mYd4Bg== X-Received: by 2002:a17:902:6902:b029:106:50e3:b2db with SMTP id j2-20020a1709026902b029010650e3b2dbmr1092151plk.35.1623178212256; Tue, 08 Jun 2021 11:50:12 -0700 (PDT) Received: from hyeyoo ([183.99.11.150]) by smtp.gmail.com with ESMTPSA id e2sm11659728pfc.135.2021.06.08.11.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 11:50:12 -0700 (PDT) Date: Wed, 9 Jun 2021 03:50:06 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Vlastimil Babka Cc: kernel test robot , kbuild-all@lists.01.org, Linux Memory Management List , Andrew Morton 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() Message-ID: <20210608185006.GB5505@hyeyoo> References: <202106051442.G1VJubTz-lkp@intel.com> <20210606110839.GA13828@hyeyoo> <20210607122550.GA752464@hyeyoo> <06af75da-ffe9-7070-1da8-bcb2cb7881d2@suse.cz> <20210607154957.GB927582@hyeyoo> <6e1d48f2-409c-0a71-4d04-a907fe4183b8@suse.cz> <20210608170528.GA28015@hyeyoo> <2d2d792e-e189-99a4-36cb-f1473a4df9ad@suse.cz> <20210608184501.GA5505@hyeyoo> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210608184501.GA5505@hyeyoo> Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=RnVbzx2y; spf=pass (imf29.hostedemail.com: domain of 42hyeyoo@gmail.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=42hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: rtfeuheh57nppyuje3mne34xgp5zp51a X-Rspamd-Queue-Id: 1D0A3371 X-Rspamd-Server: rspam06 X-HE-Tag: 1623178208-754600 Content-Transfer-Encoding: quoted-printable 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: 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. >=20 > 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:~/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/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 kmallo= c_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; =20 hyeyoo@hyeyoo:~/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/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 : In function =E2=80=98__kmalloc_index=E2=80=99, inlined from =E2=80=98kmalloc_cache_alignment=E2=80=99 at mm/kfence/k= fence_test.c:200:50: ././include/linux/compiler_types.h:328:38: error: call to =E2=80=98__comp= iletime_assert_131=E2=80=99 declared with attribute error: BUILD_BUG_ON f= ailed: 1 328 | _compiletime_assert(condition, msg, __compiletime_assert_, __COU= NTER__) | ^ ././include/linux/compiler_types.h:309:4: note: in definition of macro =E2= =80=98__compiletime_assert=E2=80=99 309 | prefix ## suffix(); \ | ^~~~~~ ././include/linux/compiler_types.h:328:2: note: in expansion of macro =E2= =80=98_compiletime_assert=E2=80=99 328 | _compiletime_assert(condition, msg, __compiletime_assert_, __COU= NTER__) | ^~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:39:37: note: in expansion of macro =E2=80=98c= ompiletime_assert=E2=80=99 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), m= sg) | ^~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:50:2: note: in expansion of macro =E2=80=98BU= ILD_BUG_ON_MSG=E2=80=99 50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) | ^~~~~~~~~~~~~~~~ ./include/linux/slab.h:383:2: note: in expansion of macro =E2=80=98BUILD_= BUG_ON=E2=80=99 383 | BUILD_BUG_ON(1); | ^~~~~~~~~~~~ In function =E2=80=98__kmalloc_index=E2=80=99, inlined from =E2=80=98test_alloc=E2=80=99 at mm/kfence/kfence_test.c:= 271:47: ././include/linux/compiler_types.h:328:38: error: call to =E2=80=98__comp= iletime_assert_131=E2=80=99 declared with attribute error: BUILD_BUG_ON f= ailed: 1 328 | _compiletime_assert(condition, msg, __compiletime_assert_, __COU= NTER__) | ^ ././include/linux/compiler_types.h:309:4: note: in definition of macro =E2= =80=98__compiletime_assert=E2=80=99 309 | prefix ## suffix(); \ | ^~~~~~ ././include/linux/compiler_types.h:328:2: note: in expansion of macro =E2= =80=98_compiletime_assert=E2=80=99 328 | _compiletime_assert(condition, msg, __compiletime_assert_, __COU= NTER__) | ^~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:39:37: note: in expansion of macro =E2=80=98c= ompiletime_assert=E2=80=99 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), m= sg) | ^~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:50:2: note: in expansion of macro =E2=80=98BU= ILD_BUG_ON_MSG=E2=80=99 50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) | ^~~~~~~~~~~~~~~~ ./include/linux/slab.h:383:2: note: in expansion of macro =E2=80=98BUILD_= BUG_ON=E2=80=99 383 | BUILD_BUG_ON(1); | ^~~~~~~~~~~~ make[2]: *** [scripts/Makefile.build:272: mm/kfence/kfence_test.o] =EC=98= =A4=EB=A5=98 1 make[1]: *** [scripts/Makefile.build:533: mm/kfence] =EC=98=A4=EB=A5=98 2 make: *** [Makefile:1948: mm] =EC=98=A4=EB=A5=98 2 hyeyoo@hyeyoo:~/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next$ make mm/= kfence/kfence_test.o CC=3Dclang-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_PATTER= N) (NEW) 3. zero-init everything on the stack (strongest and safest) (INIT_STACK= _ALL_ZERO) (NEW) choice[1-3?]:=20 Enable heap memory zeroing on allocation by default (INIT_ON_ALLOC_DEFAUL= T_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)=20 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/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/arch/x86/special.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/arch/x86/decode.o LD /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/arch/x86/objtool-in.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/weak.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/check.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/special.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/orc_gen.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/orc_dump.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/builtin-check.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/builtin-orc.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/elf.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/objtool.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/libstring.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/libctype.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/str_error_r.o CC /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/librbtree.o LD /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/objtool-in.o LINK /home/hyeyoo/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next/to= ols/objtool/objtool CC mm/kfence/kfence_test.o hyeyoo@hyeyoo:~/=EB=B0=94=ED=83=95=ED=99=94=EB=A9=B4/linux-next$=20