mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 12:14:10 +08:00
68a8f64457
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). Also, relocate `hdr->raw_pkcs7_len = sig_len;` so that the __counted_by annotation has effect, and flex-array member `raw_pkcs7` can be properly bounds-checked at run-time. While there, use struct_size() helper, instead of the open-coded version, to calculate the size for the allocation of the whole flexible structure, including of course, the flexible-array member. This code was found with the help of Coccinelle, and audited and fixed manually. Signed-off-by: "Gustavo A. R. Silva" <gustavoars@kernel.org> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/ZSRaDcJNARUUWUwS@work Signed-off-by: Kees Cook <keescook@chromium.org> |
||
---|---|---|
.. | ||
ima_api.c | ||
ima_appraise.c | ||
ima_asymmetric_keys.c | ||
ima_crypto.c | ||
ima_efi.c | ||
ima_fs.c | ||
ima_init.c | ||
ima_kexec.c | ||
ima_main.c | ||
ima_modsig.c | ||
ima_mok.c | ||
ima_policy.c | ||
ima_queue_keys.c | ||
ima_queue.c | ||
ima_template_lib.c | ||
ima_template_lib.h | ||
ima_template.c | ||
ima.h | ||
Kconfig | ||
Makefile |