[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0DC67CE5-6006-4949-A81D-882DBDF4DAC4@kernel.org>
Date: Mon, 25 Aug 2025 16:17:53 -0400
From: Kees Cook <kees@...nel.org>
To: Marco Elver <elver@...gle.com>, elver@...gle.com
CC: linux-kernel@...r.kernel.org, kasan-dev@...glegroups.com,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Alexander Potapenko <glider@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrey Konovalov <andreyknvl@...il.com>,
David Hildenbrand <david@...hat.com>, David Rientjes <rientjes@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>, Florent Revest <revest@...gle.com>,
GONG Ruiqi <gongruiqi@...weicloud.com>, Harry Yoo <harry.yoo@...cle.com>,
Jann Horn <jannh@...gle.com>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Matteo Rizzo <matteorizzo@...gle.com>, Michal Hocko <mhocko@...e.com>,
Mike Rapoport <rppt@...nel.org>, Nathan Chancellor <nathan@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Suren Baghdasaryan <surenb@...gle.com>, Vlastimil Babka <vbabka@...e.cz>,
linux-hardening@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH RFC] slab: support for compiler-assisted type-based slab cache partitioning
On August 25, 2025 11:44:40 AM EDT, Marco Elver <elver@...gle.com> wrote:
>Additionally, when I compile my kernel with -Rpass=alloc-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. 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).
Can the type be extracted from an AST analysis of the lhs?
struct foo *p = kmalloc(bytes, gfp);
Doesn't tell us much from "bytes", but typeof(*p) does...
--
Kees Cook
Powered by blists - more mailing lists