lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <e2a0debe-e99f-2259-1cb9-35193c387c82@gotplt.org> Date: Thu, 22 Sep 2022 16:26:54 -0400 From: Siddhesh Poyarekar <siddhesh@...plt.org> To: Kees Cook <keescook@...omium.org>, linux-hardening@...r.kernel.org Cc: Nathan Chancellor <nathan@...nel.org>, Nick Desaulniers <ndesaulniers@...gle.com>, Arnd Bergmann <arnd@...db.de>, Juergen Gross <jgross@...e.com>, Boris Ostrovsky <boris.ostrovsky@...cle.com>, Tom Rix <trix@...hat.com>, Miguel Ojeda <ojeda@...nel.org>, linux-kernel@...r.kernel.org, llvm@...ts.linux.dev Subject: Re: [PATCH 0/4] fortify: Use __builtin_dynamic_object_size() when available On 2022-09-20 15:21, Kees Cook wrote: > Hi, > > This adjusts CONFIG_FORTIFY_SOURCE's coverage to include greater runtime > size checking from GCC and Clang's __builtin_dynamic_object_size(), which > the compilers can track either via code flow or from __alloc_size() hints. > FTR, I ran a linux build using gcc with allyesconfig and fortify-metrics[1] to get a sense of how much object size coverage would improve with __builtin_dynamic_object_size. With a total of 3,877 __builtin_object_size calls, about 11.37% succeed in getting a result that is not (size_t)-1. If they were replaced by __builtin_dynamic_object_size as this patch proposes, the success rate improves to 16.25%, which is a ~1.4x improvement. This is a decent improvement by itself but it can be amplified further by adding __attribute__((access (...)))[2] to function prototypes and definitions, especially for functions that take in buffers and their sizes as arguments since __builtin_dynamic_object_size in gcc is capable of recognizing that and using it for object size determination (and hence to fortify calls) within those functions. Thanks, Sid [1] https://github.com/siddhesh/fortify-metrics [2] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
Powered by blists - more mailing lists