[all-commits] [llvm/llvm-project] 04364f: [randstruct] Also randomize composite function poi...

Kees Cook via All-commits all-commits at lists.llvm.org
Mon May 5 14:31:03 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04364fb888eea6db9811510607bed4b200bcb082
      https://github.com/llvm/llvm-project/commit/04364fb888eea6db9811510607bed4b200bcb082
  Author: Kees Cook <kees at kernel.org>
  Date:   2025-05-05 (Mon, 05 May 2025)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/Sema/init-randomized-struct.c

  Log Message:
  -----------
  [randstruct] Also randomize composite function pointer structs (#138385)

Check for struct members that are structs filled only with function
pointers by recursively examining it. Since the lamba
IsFunctionPointerOrForwardDecl cannot call itself directly, move it into
a helper function, EntirelyFunctionPointers, so it can be called from
the lambda.

Add test for composite function pointer structs getting automatically
randomized.

Add more tests for validating automatic randomization vs explicitly
annotated with "randomize_layout", and excluded with
"no_randomize_layout".

Reorder the "should we randomize?" "if" statement to check for
enablement before checking for Record details.

Fixes #138355



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list