diff options
author | Kees Cook <keescook@chromium.org> | 2023-05-17 22:08:44 +0300 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2023-05-31 02:42:00 +0300 |
commit | dd06e72e68bcb4070ef211be100d2896e236c8fb (patch) | |
tree | fb9019ef605e93017f0c8056d0730d0174612925 /ipc/util.c | |
parent | e910c8e3aa02dc456e2f4c32cb479523c326b534 (diff) | |
download | linux-dd06e72e68bcb4070ef211be100d2896e236c8fb.tar.xz |
Compiler Attributes: Add __counted_by macro
In an effort to annotate all flexible array members with their run-time
size information, the "element_count" attribute is being introduced by
Clang[1] and GCC[2] in future releases. This annotation will provide
the CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE features the ability
to perform run-time bounds checking on otherwise unknown-size flexible
arrays.
Even though the attribute is under development, we can start the
annotation process in the kernel. This requires defining a macro for
it, even if we have to change the name of the actual attribute later.
Since it is likely that this attribute may change its name to "counted_by"
in the future (to better align with a future total bytes "sized_by"
attribute), name the wrapper macro "__counted_by", which also reads more
clearly (and concisely) in structure definitions.
[1] https://reviews.llvm.org/D148381
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896
Cc: Bill Wendling <morbo@google.com>
Cc: Qing Zhao <qing.zhao@oracle.com>
Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Tom Rix <trix@redhat.com>
Cc: llvm@lists.linux.dev
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/r/20230517190841.gonna.796-kees@kernel.org
Diffstat (limited to 'ipc/util.c')
0 files changed, 0 insertions, 0 deletions