From: Nathan Chancellor <nathan@kernel.org>
To: Marco Elver <elver@google.com>
Cc: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Nicolas Schier <nsc@kernel.org>, Dennis Zhou <dennis@kernel.org>,
Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@gentwo.org>,
Harry Yoo <harry@kernel.org>, Hao Li <hao.li@linux.dev>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Alexander Potapenko <glider@google.com>,
Dmitry Vyukov <dvyukov@google.com>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Miguel Ojeda <ojeda@kernel.org>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-hardening@vger.kernel.org,
kasan-dev@googlegroups.com, llvm@lists.linux.dev,
Andrey Konovalov <andreyknvl@gmail.com>,
Florent Revest <revest@google.com>, Jann Horn <jannh@google.com>,
KP Singh <kpsingh@kernel.org>,
Matteo Rizzo <matteorizzo@google.com>,
GONG Ruiqi <gongruiqi1@huawei.com>
Subject: Re: [PATCH v3 1/2] slab: support for compiler-assisted type-based slab cache partitioning
Date: Thu, 7 May 2026 17:38:43 +0800 [thread overview]
Message-ID: <20260507093843.GA1826581@ax162> (raw)
In-Reply-To: <CANpmjNM261J5qefMvmUXWZGBVz-KBs7GkbpdNMfTOvNJ-=LiZQ@mail.gmail.com>
On Wed, May 06, 2026 at 03:03:27PM +0200, Marco Elver wrote:
> Bah, this is why it doesn't work:
>
> >> drivers/gpu/drm/msm/msm_gpu.c:272:4: error: cannot jump from this indirect goto statement to one of its possible targets
> 272 | drm_exec_retry_on_contention(&exec);
> | ^
> include/drm/drm_exec.h:123:4: note: expanded from macro
> 'drm_exec_retry_on_contention'
> 123 | goto *__drm_exec_retry_ptr; \
> | ^
> drivers/gpu/drm/msm/msm_gpu.c:304:16: note: possible target of
> indirect goto statement
> 304 | state->bos = kcalloc(submit->nr_bos,
> | ^
> include/linux/slab.h:1173:34: note: expanded from macro 'kcalloc'
> 1173 | #define kcalloc(n, size, flags) kmalloc_array(n,
> size, (flags) | __GFP_ZERO)
> | ^
> include/linux/slab.h:1133:42: note: expanded from macro 'kmalloc_array'
> 1133 | #define kmalloc_array(...)
> alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
> | ^
> include/linux/slab.h:1132:71: note: expanded from macro
> 'kmalloc_array_noprof'
> 1132 | #define kmalloc_array_noprof(...)
> _kmalloc_array_noprof(__VA_ARGS__, __kmalloc_token(__VA_ARGS__))
> |
> ^
> include/linux/slab.h:506:55: note: expanded from macro '__kmalloc_token'
> 506 | #define __kmalloc_token(...) ((kmalloc_token_t){ .v = _THIS_IP_ })
> | ^
> include/linux/instruction_pointer.h:10:41: note: expanded from
> macro '_THIS_IP_'
> 10 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned
> long)&&__here; })
> | ^
> drivers/gpu/drm/msm/msm_gpu.c:304:16: note: jump enters a statement
> expression
>
>
> Apparently using _THIS_IP_ creates a possible indirect jump target,
> but because it's in a statement expression, it's invalid, so the
> compiler complains. This is obviously nonsense, because the actual
> indirect jump in this gpu driver code would never jump to the
> _THIS_IP_ __here label, but that's what it is.
>
> Given this pre-existing issue, we probably need to continue using
> _RET_IP_, as before. I tried to fix _THIS_IP_, but it's incredibly
> brittle (e.g. __always_inline function returning address of label
> doesn't work on Clang, but would on GCC).
For what it's worth, both LLVM and GCC consider the generic version of
_THIS_IP_ to be broken (even if it works currently), as the address of a
label is only expected to be used with a computed goto (hence the clang
error above, it just looks for possible computed goto targets):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44298
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120071
https://github.com/llvm/llvm-project/issues/138272
--
Cheers,
Nathan
next prev parent reply other threads:[~2026-05-07 9:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 13:24 [PATCH v3 1/2] slab: support for compiler-assisted type-based slab cache partitioning Marco Elver
2026-04-24 13:24 ` [PATCH v3 2/2] slab: fix kernel-docs for mm-api Marco Elver
2026-04-30 13:40 ` Vlastimil Babka (SUSE)
2026-04-30 13:59 ` Marco Elver
2026-05-04 15:00 ` Marco Elver
2026-05-11 12:07 ` Vlastimil Babka (SUSE)
2026-05-11 12:19 ` Jonathan Corbet
2026-05-11 16:34 ` Marco Elver
2026-04-30 13:03 ` [PATCH v3 1/2] slab: support for compiler-assisted type-based slab cache partitioning Vlastimil Babka (SUSE)
2026-05-04 21:22 ` Marco Elver
2026-05-06 13:03 ` Marco Elver
2026-05-07 9:38 ` Nathan Chancellor [this message]
2026-05-07 21:49 ` Harry Yoo (Oracle)
2026-05-08 14:21 ` Marco Elver
2026-05-11 8:31 ` Harry Yoo (Oracle)
2026-05-11 9:34 ` Marco Elver
2026-05-11 18:14 ` Kees Cook
2026-05-12 3:37 ` Harry Yoo (Oracle)
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=20260507093843.GA1826581@ax162 \
--to=nathan@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=cl@gentwo.org \
--cc=david@kernel.org \
--cc=dennis@kernel.org \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=gongruiqi1@huawei.com \
--cc=gustavoars@kernel.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=jannh@google.com \
--cc=justinstitt@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=kees@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=llvm@lists.linux.dev \
--cc=matteorizzo@google.com \
--cc=mhocko@suse.com \
--cc=morbo@google.com \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=revest@google.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=tj@kernel.org \
--cc=vbabka@kernel.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.