From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CB7535971; Thu, 23 Oct 2025 00:47:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761180464; cv=none; b=sXP+DUQmNf6poApR+Ui5V4w5gNlGyyBK1L8mynlDSiCx+giZDJ4U8wm+vecXf/M3tLH+HKzx39B04U3vUFZklhfPVRfokRVwd0NHzGAlx7ginMmFMLtfPPQ08G2+6tnrNpsUMtPcTe+zthnaPcT9+dUQOVlMJjqpsPP0ZI+Y/7M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761180464; c=relaxed/simple; bh=x9rSFwmVcc1dqviTA6H/hsJMHWMdaIFdGDx7xFW94uM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TFmXG/uZfg2RvoZznKZHqLUMsmQHX8ENqd+PHVUrJ/A6Wj2g3407zEbePuMQmZ+Jie4XAvGog5AJ2SF/xF6m+Q4Oz4bQ71pgWtiZ1IRCZ+OZReenVFg7K/C8tNrfSueXiU2eP3N7LM1nJfk3yXz0O2UscMJfjcppTINmU/tMmh0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m8kpsJdF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m8kpsJdF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09DA9C4CEE7; Thu, 23 Oct 2025 00:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761180464; bh=x9rSFwmVcc1dqviTA6H/hsJMHWMdaIFdGDx7xFW94uM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m8kpsJdF4vUC1ysDarElbHTVBNPhQ4Os5dHN8IFNM36jK6EYrm0/27DnzrFm6FqBw ICkkcf2X0ed/Ch5CddqCNMblqtvRvRvRJd0vNiz7aNjcGZroYxm0qt2vFydOLoL14c oztNEWWSPZLJYjhMG6SAepWYWAnBGXgX9BXpuFikHw1lF5HpFLXgB3Pc0fnpyjQPH5 OacjHZ1jODozGTrtkFMPjlTE1WfmdfqtrTpjEwst8ncCRH2KClWMwCQ+pE3Pj4V7zb /f6kL8pWuUcYyvSkDIYiQo48r2CY2oQOlgg7dqLuoU2IWC7k1mH28oxtPkrVR746ME F7hdchGd36MgA== Date: Wed, 22 Oct 2025 17:47:43 -0700 From: Kees Cook To: Peter Zijlstra Cc: Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Marco Elver , Przemek Kitszel , Andrew Morton , Masahiro Yamada , Christophe Leroy , Johannes Weiner , llvm@lists.linux.dev, Al Viro , Arnd Bergmann , Greg Kroah-Hartman , Christian Brauner , Jan Kara , Nicolas Schier , Shuah Khan , "Gustavo A. R. Silva" , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Tamir Duberstein , Michael Kelley , kernel test robot , Heiko Carstens , Uros Bizjak , Jan Hendrik Farr , Yafang Shao , Marc Herbert , Christopher Ferris , Jakub Kicinski , Alexander Lobakin , Paolo Abeni , Tejun Heo , Jeff Xu , Michal =?iso-8859-1?Q?Koutn=FD?= , Shakeel Butt , Randy Dunlap , Brian Gerst , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 1/3] compiler_types: Introduce __counted_by_ptr() Message-ID: <202510221746.7C09BBE@keescook> References: <20251020220005.work.095-kees@kernel.org> <20251020220118.1226740-1-kees@kernel.org> <20251021095447.GL3245006@noisy.programming.kicks-ass.net> <202510211210.84D670D1C@keescook> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202510211210.84D670D1C@keescook> On Tue, Oct 21, 2025 at 12:24:05PM -0700, Kees Cook wrote: > On Tue, Oct 21, 2025 at 11:54:47AM +0200, Peter Zijlstra wrote: > > > [...] > > > Unfortunately, this annotation cannot be used for "void *" members > > > (since such a member is considered a pointer to an incomplete type, > > > and neither Clang nor GCC developers could be convinced otherwise[1], > > > even in the face of the GNU extension that "void *" has size "1 byte" > > > for pointer arithmetic). For "void *" members, we must use the coming > > > "sized_by" attribute. > > > > So why do we need both __counted_by_ptr() and this __sized_by(), won't > > one be good enough? > [...] > Let me take another stab at it... It seems this will be acceptable as long as it is gated by GNU extensions. GCC patch in progress. Clang PR here: https://github.com/llvm/llvm-project/pull/163698 -- Kees Cook