[PATCH] D135713: [cmake][Fuchsia] Add -ftrivial-auto-var-init=zero to runtimes build

2022-10-17 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

any chance of using pattern init rather than zero init, so this doesn't hide 
uninitialized bugs?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135713

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D135713: [cmake][Fuchsia] Add -ftrivial-auto-var-init=zero to runtimes build

2022-10-11 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka added a comment.

It may help with some cases, but still does not guarantee that pointer will not 
survive in paddings or red-zones.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135713

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D135713: [cmake][Fuchsia] Add -ftrivial-auto-var-init=zero to runtimes build

2022-10-11 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment.

In D135713#3850730 , @mcgrathr wrote:

> I had imagined making lsan always do this since there's a specific 
> lsan-related rationale for it that applies to everybody.
> I'm not clear on how cmake structures things and whether sanitizer_common 
> would have to do it unconditionally since it's used by lsan code.
>
> Doing this generally seems fine to me, but in the general case it's 
> considered a bug-masking feature (with =zero) and we should contemplate how 
> much we want to expect that compiler-rt might have bugs that we will be 
> making it harder for us to notice and properly fix.

Oh I see. Yeah I had just been thinking of turning it on for us rather than for 
all of lsan for everyone. Is something like https://reviews.llvm.org/D135716 
what you were thinking?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135713

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D135713: [cmake][Fuchsia] Add -ftrivial-auto-var-init=zero to runtimes build

2022-10-11 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr added a comment.

I had imagined making lsan always do this since there's a specific lsan-related 
rationale for it that applies to everybody.
I'm not clear on how cmake structures things and whether sanitizer_common would 
have to do it unconditionally since it's used by lsan code.

Doing this generally seems fine to me, but in the general case it's considered 
a bug-masking feature (with =zero) and we should contemplate how much we want 
to expect that compiler-rt might have bugs that we will be making it harder for 
us to notice and properly fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135713

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D135713: [cmake][Fuchsia] Add -ftrivial-auto-var-init=zero to runtimes build

2022-10-11 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr.
leonardchan added a project: clang.
Herald added a subscriber: abrachet.
Herald added a project: All.
leonardchan requested review of this revision.

This might allow lsan to find more leaks that would have gone undetected. When 
lsan searches for leaked pointers on the stack, if a leaked pointer that was 
pushed to the stack in a prior function call would not be scrubbed on a future 
function call, then the memory snapshot will see the pointer on the stack and 
not mark it as leaked. Such holes can exist in the lsan runtime where there may 
 be uninitialized data. Adding auto-var-init can scrub some of that data and 
might be able to catch more leaks that would've gone undetected this way.

See https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=111351 for more details.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135713

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -145,7 +145,7 @@
   set(FUCHSIA_x86_64-unknown-fuchsia_NAME x64)
   set(FUCHSIA_riscv64-unknown-fuchsia_NAME riscv64)
   foreach(target 
i386-unknown-fuchsia;x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia)
-set(FUCHSIA_${target}_COMPILER_FLAGS "--target=${target} 
-I${FUCHSIA_SDK}/pkg/sync/include -I${FUCHSIA_SDK}/pkg/fdio/include")
+set(FUCHSIA_${target}_COMPILER_FLAGS "--target=${target} 
-I${FUCHSIA_SDK}/pkg/sync/include -I${FUCHSIA_SDK}/pkg/fdio/include 
-ftrivial-auto-var-init=zero")
 set(FUCHSIA_${target}_LINKER_FLAGS 
"-L${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/lib")
 set(FUCHSIA_${target}_SYSROOT 
"${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/sysroot")
   endforeach()


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -145,7 +145,7 @@
   set(FUCHSIA_x86_64-unknown-fuchsia_NAME x64)
   set(FUCHSIA_riscv64-unknown-fuchsia_NAME riscv64)
   foreach(target i386-unknown-fuchsia;x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia)
-set(FUCHSIA_${target}_COMPILER_FLAGS "--target=${target} -I${FUCHSIA_SDK}/pkg/sync/include -I${FUCHSIA_SDK}/pkg/fdio/include")
+set(FUCHSIA_${target}_COMPILER_FLAGS "--target=${target} -I${FUCHSIA_SDK}/pkg/sync/include -I${FUCHSIA_SDK}/pkg/fdio/include -ftrivial-auto-var-init=zero")
 set(FUCHSIA_${target}_LINKER_FLAGS "-L${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/lib")
 set(FUCHSIA_${target}_SYSROOT "${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/sysroot")
   endforeach()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits