From: Kees Cook <kees@kernel.org>
To: Bill Wendling <morbo@google.com>
Cc: Thorsten Blum <thorsten.blum@toblux.com>,
Nathan Chancellor <nathan@kernel.org>,
gustavoars@kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
mcgrof@kernel.org, linux-hardening@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by()
Date: Tue, 17 Sep 2024 04:43:32 -0700 [thread overview]
Message-ID: <202409170436.C3C6E7F7A@keescook> (raw)
In-Reply-To: <CAGG=3QWawMUJv83UBGFk0izrP1+FdftB7x7ZLSYx4NvcGPWyYg@mail.gmail.com>
On Mon, Sep 16, 2024 at 02:45:47AM -0700, Bill Wendling wrote:
> The 4294967295 simply means "I don't know." There's probably a bug in
> the size calculation. I'll look into it.
I was able to build a minimized PoC, if that's helpful:
https://godbolt.org/z/qohGd5xh1
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
struct variable {
int a;
int b;
int length;
short array[] __attribute__((counted_by(length)));
};
struct bucket {
int a;
struct variable *growable;
int b;
};
int main(int argc, char *argv[])
{
struct bucket *p;
struct variable *v;
p = malloc(sizeof(*p));
v = malloc(sizeof(*p->growable) + sizeof(*p->growable->array) * 32);
v->length = 32;
printf("%zu\n", __builtin_dynamic_object_size(v->array, 1));
p->growable = v;
printf("%zu\n", __builtin_dynamic_object_size(p->growable->array, 1));
return 0;
}
GCC shows 64 64, but Clang shows 64 0.
--
Kees Cook
next prev parent reply other threads:[~2024-09-17 11:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 16:27 [RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by() Thorsten Blum
2024-09-11 17:59 ` Luis Chamberlain
2024-09-13 16:46 ` Nathan Chancellor
2024-09-13 16:55 ` Luis Chamberlain
2024-09-13 18:40 ` Andy Shevchenko
2024-09-13 19:03 ` Thorsten Blum
2024-09-13 19:09 ` Andy Shevchenko
2024-09-13 19:12 ` Andy Shevchenko
2024-09-13 23:32 ` Thorsten Blum
2024-09-13 23:44 ` Nathan Chancellor
2024-09-14 0:23 ` Thorsten Blum
2024-09-16 9:45 ` Bill Wendling
2024-09-17 11:43 ` Kees Cook [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-12-21 9:48 Thorsten Blum
2025-01-07 10:55 Thorsten Blum
2025-01-14 21:49 Thorsten Blum
2025-02-04 16:44 ` Thorsten Blum
2025-02-11 13:18 ` Thorsten Blum
2025-02-13 21:51 ` Luis Chamberlain
2025-02-13 22:13 Thorsten Blum
2025-02-13 22:21 ` Luis Chamberlain
2025-02-17 10:04 ` Petr Pavlu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202409170436.C3C6E7F7A@keescook \
--to=kees@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gustavoars@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=thorsten.blum@toblux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.