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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4F7BCD3442 for ; Thu, 7 May 2026 09:38:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C16716B0088; Thu, 7 May 2026 05:38:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA0356B008A; Thu, 7 May 2026 05:38:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A67CB6B008C; Thu, 7 May 2026 05:38:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 910C26B0088 for ; Thu, 7 May 2026 05:38:56 -0400 (EDT) Received: from smtpin07.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2BA16A0447 for ; Thu, 7 May 2026 09:38:56 +0000 (UTC) X-FDA: 84740124672.07.73C551C Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf23.hostedemail.com (Postfix) with ESMTP id 6B36E14000B for ; Thu, 7 May 2026 09:38:54 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XyO8gvHl; spf=pass (imf23.hostedemail.com: domain of nathan@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=nathan@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1778146734; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dGnQthdyPgFlyTGEgbgSwRm6V9l8GiDfrbUfyvvTqO0=; b=DtBjfbn4wOB5slSOvgGpsW+UENuTDkEonO/tF5E3bUiAiKXlBkIP9OqldS+Q7ZC5q3lpG8 HIazzEBW9UBq/6otYqM4iTdGQBDgBcxThh/dURP2nQOZEW/r8OXQ/ysQHSn5KIY747hKaH g+Ok8eQcZGRhT1F2dNb/0JA6qRcorxY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XyO8gvHl; spf=pass (imf23.hostedemail.com: domain of nathan@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=nathan@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1778146734; a=rsa-sha256; cv=none; b=Ir70t3H5kTAP6HU7x7ufZZ7pyJIZTEPPwlBo+zDoZeZNZnfql1burb51pNyRwDJz2xcex/ avcv97jGkG6IEKjx8nu46N//40Ew3Q/RmhPIu3D+Pr+cnAF/Q/aXQWXVqLmMlAmcR0W6+U H8CyXwd3yClTGDHuGclYZwDucwNoxoQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 4C1FF40C56; Thu, 7 May 2026 09:38:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BFC9C2BCB2; Thu, 7 May 2026 09:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778146733; bh=DeehgTNF5Iahk7h3I13ggfT+xXDlph1I0HFCnVNDg0U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XyO8gvHlTYz5Ac3kAslP2rYTLBXXjZBXfAg33vMz43SMC73uGVpdjA7lqedr4NbZS r4++aofHVyBihvJdp4Ii6SozxNddx4pbxHH/H5S66/G06kMHKw3BmnBO12S8t41QNT zbOCDErsoabOWxotbveYBwdayaw1VLGyYwMYsXwFRh0pmQVV2TRvS1QKRBgYQqlrTC BK447mA28HbOjWW6piRRG0Q7sfGLGC+m7J+JRqObbZizbiwjc1sH5W3jpNSM/m2o5L IZyp3aaYELVPdN50gxcjZiUr6jEwr8U6T6k5E5+60ZhibIwXnoDZS5mgWDHiSImqCG bEYnJFheuItMg== Date: Thu, 7 May 2026 17:38:43 +0800 From: Nathan Chancellor To: Marco Elver Cc: "Vlastimil Babka (SUSE)" , Andrew Morton , Nicolas Schier , Dennis Zhou , Tejun Heo , Christoph Lameter , Harry Yoo , Hao Li , David Rientjes , Roman Gushchin , Kees Cook , "Gustavo A. R. Silva" , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Alexander Potapenko , Dmitry Vyukov , Nick Desaulniers , Bill Wendling , Justin Stitt , Miguel Ojeda , 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 , Florent Revest , Jann Horn , KP Singh , Matteo Rizzo , GONG Ruiqi Subject: Re: [PATCH v3 1/2] slab: support for compiler-assisted type-based slab cache partitioning Message-ID: <20260507093843.GA1826581@ax162> References: <20260424132427.2703076-1-elver@google.com> <6f2bd63a-dc02-4631-a3a5-7ec8e58a4a4e@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: pgxpgoenebfd8867frqi4mpbg5mb3dhi X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6B36E14000B X-Rspam-User: X-HE-Tag: 1778146734-859292 X-HE-Meta: U2FsdGVkX1+4onfjd4Lto9CzH4knBVK39PHuImbpe4fd0ELyS9qPdYzY4oBgCkoopNK1Xe1dFJInc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fzwsFchppD+sC5pvxNp7IK/iR0Ko85zwSQvs0mhmCygHW367yfNjHdCUamIC6KprWvdjHox/d28NT0+6U4by3uepSK8esY1Iqea+ViMMxBPLt3+Ot8/QTYKykB8mWMrTXQ5WbHBHwXVj6xxW5yUG40nV3l5MSiizKq8zWPQzxkKSL5IOIgHj1HBRXyDpzr6/tClD9fPg== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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