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 82B1D1DE2D7; Mon, 25 Aug 2025 20:18:17 +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=1756153100; cv=none; b=PZYcxUXE6fLf3gSYPTgrLIziw9NOJjDrjXnIffGxcMPHUxyEns6GQVPWktE8oVYAhCMGEm5AgAV/PagbrA1jwrcYP6GA+cNLbQGDr9uWiWxzzFqUX/dihveP9J5aloGipkLENobd9FW67FniEx6Q3NKF/o6ASDQtP4JXMZLNLz4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756153100; c=relaxed/simple; bh=yNerjuxI+KYbw3mNCEHMV8i09CJJK9GCt86H4fr7e/g=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=EqjvvKR8wtt/HRd9Vx+m+7UK0WN17o4MgZaxym6z8xT2/b4VXRjQG5mgMOCzPF8L4eQRR3lrBFqLuUzEcUNaf+Z7DdfApeiqxP0ATARvthrC2qz2FFyNWWU1gyNIDoE5a/yVajweSlOe+EPkB3oBgpwRvgXP9GyW6wkhwTFrxls= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hFlxFsri; 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="hFlxFsri" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51237C4CEED; Mon, 25 Aug 2025 20:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756153097; bh=yNerjuxI+KYbw3mNCEHMV8i09CJJK9GCt86H4fr7e/g=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=hFlxFsrioVHoPBVPmP1nQAdWfA6sGqieK/3eJIPNwb/fgHtGy72TnnSEvhYryibRv GFKFFoV8oSOgWAtWyCNJNocRKr9FJwZ2ZGpaUfnsOhsyI0kupY0SZiqYyBfPilEvcE lC8u05P6vI385iou8sEtH/JARLmrK/KjWR9Gq8DplgFKfLbZgXtCTwPYWtcQRGEdVk RPbLgoMWeYCoQ2qRe5bF0p/PlmOi7wwTGbEdmACDi9xjXr3qRzKZgG4IvzRNF2m7fK PHyxc8DoAeOJeLn60+cbpo9WKw0T1FU8V8yljOwRUbnW4SHutpvZMkzdJxcZLgjaNC 4b0+vQDoj+Kgw== Date: Mon, 25 Aug 2025 16:17:53 -0400 From: Kees Cook To: Marco Elver , elver@google.com CC: linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, "Gustavo A. R. Silva" , "Liam R. Howlett" , Alexander Potapenko , Andrew Morton , Andrey Konovalov , David Hildenbrand , David Rientjes , Dmitry Vyukov , Florent Revest , GONG Ruiqi , Harry Yoo , Jann Horn , Lorenzo Stoakes , Matteo Rizzo , Michal Hocko , Mike Rapoport , Nathan Chancellor , Roman Gushchin , Suren Baghdasaryan , Vlastimil Babka , linux-hardening@vger.kernel.org, linux-mm@kvack.org Subject: =?US-ASCII?Q?Re=3A_=5BPATCH_RFC=5D_slab=3A_support_for_compiler-?= =?US-ASCII?Q?assisted_type-based_slab_cache_partitioning?= User-Agent: K-9 Mail for Android In-Reply-To: <20250825154505.1558444-1-elver@google.com> References: <20250825154505.1558444-1-elver@google.com> Message-ID: <0DC67CE5-6006-4949-A81D-882DBDF4DAC4@kernel.org> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On August 25, 2025 11:44:40 AM EDT, Marco Elver wrote= : >Additionally, when I compile my kernel with -Rpass=3Dalloc-token, which >provides diagnostics where (after dead-code elimination) type inference >failed, I see 966 allocation sites where the compiler failed to identify >a type=2E Some initial review confirms these are mostly variable sized >buffers, but also include structs with trailing flexible length arrays >(the latter could be recognized by the compiler by teaching it to look >more deeply into complex expressions such as those generated by >struct_size)=2E Can the type be extracted from an AST analysis of the lhs? struct foo *p =3D kmalloc(bytes, gfp); Doesn't tell us much from "bytes", but typeof(*p) does=2E=2E=2E --=20 Kees Cook