Hi Nathan and Kees,
On 2/27/24 17:00, Kees Cook wrote:
On Tue, Feb 27, 2024 at 05:47:44PM +0100, Daniel Lezcano wrote:
Ok my misunderstanding was I thought sizeof() was calling _bdos under the
hood, so when calling sizeof(flex_array), it was returning the computed size
inferring from the __counted_by field.
Yeah, sizeof() has a very limited scope. __builtin_object_size() has
more flexibility (via the 2nd argument, "type"), but it was still
compile-time only. __builtin_dynamic_object_size() was added to bring
runtime evaluations into the mix (initially to support the alloc_size
attribute, and now includes the counted_by attribute too).
Thanks for your earlier emails explaining these stuff.
Do you have maybe some presentation about those features
for the kernel (ideally w/ a video from some conference)?
Regards,
Lukasz