[PATCH] D126864: [clang] Introduce -fstrict-flex-arrays for stricter handling of flexible arrays

Kees Cook via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 11:49:17 PDT 2022


kees added a comment.

In D126864#3556262 <https://reviews.llvm.org/D126864#3556262>, @efriedma wrote:

> I'm a little concerned about the premise of this, though.  See https://github.com/llvm/llvm-project/issues/29694 for why we relaxed this check in the first place.  I mean, the Linux kernel itself can maybe ensure it isn't doing anything silly, but most code has to deal with system headers, which are apparently broken.  So this option is a trap for most code.

Fixing system headers will likely come after this lands. Code bases that can use it (e.g. Linux kernel) will pave the way. But yes, totally agreed: it cannot be default-enabled.

As for SOCK_MAXADDRLEN, that's a horrid hack, and the definition of `struct sockaddr` needs to change. :) The Linux kernel has played games like that before, but we've been removing them all for saner implementations (which is why `-fstrict-flex-arrays` is desired: flushing out any remaining weird spots).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126864/new/

https://reviews.llvm.org/D126864



More information about the cfe-commits mailing list