Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -Wunsafe-buffer-usage warnings #81577

Open
am11 opened this issue Feb 2, 2023 · 3 comments
Open

Fix -Wunsafe-buffer-usage warnings #81577

am11 opened this issue Feb 2, 2023 · 3 comments

Comments

@am11
Copy link
Member

am11 commented Feb 2, 2023

Clang 16 has introduced buffer hardening https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734 which #81573 is suppressing. Filing this issue so we remember to fix the violations and remove suppression.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Feb 2, 2023
@ghost
Copy link

ghost commented Feb 2, 2023

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

Clang 16 has introduced buffer hardening https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734 which #81573 is suppressing. Filing this issue so we remember to fix the violations and remove suppression.

Author: am11
Assignees: -
Labels:

area-Infrastructure-coreclr, untriaged

Milestone: -

@AaronRobinsonMSFT AaronRobinsonMSFT removed the untriaged New issue has not been triaged by the area owner label Feb 3, 2023
@AaronRobinsonMSFT AaronRobinsonMSFT added this to the 8.0.0 milestone Feb 3, 2023
@ayakael
Copy link
Contributor

ayakael commented Mar 28, 2023

On Alpine edge (clang 16), I also get:

/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Security.Cryptography.Native/openssl.c(1444,12): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'void (*)(void)' [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]
5587/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Security.Cryptography.Native/openssl.c(1444,12): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'void (*)(void)' [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]
5588/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Security.Cryptography.Native/openssl.c(1510,37): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'void (*)(void)' [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]
5589/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Security.Cryptography.Native/openssl.c(1510,37): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'void (*)(void)' [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]
5590/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Native/pal_console.c(122,38): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'ConsoleSigTtouHandler' (aka 'void (*)(void)') [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]
5591/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Native/pal_console.c(122,38): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'ConsoleSigTtouHandler' (aka 'void (*)(void)') [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]
5592/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Native/pal_console.c(122,38): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'ConsoleSigTtouHandler' (aka 'void (*)(void)') [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]
5593/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Native/pal_console.c(122,38): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'ConsoleSigTtouHandler' (aka 'void (*)(void)') [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]
5594/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c(136,34): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'void (*)(void)' [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]
5595/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c(136,34): error G6B6F0AA2: incompatible function pointer types passing 'void ()' to parameter of type 'void (*)(void)' [-Wincompatible-function-pointer-types-strict] [/var/lib/gitlab-runner/builds/ayakael/user-aports/user/dotnet7-stage0/src/dotnet-v7.0.104/src/runtime/src/native/libs/build-native.proj]

Applied the following workaround:

diff --git a/src/runtime/eng/native/configurecompiler.cmake b/src/runtime/eng/native/configurecompiler.cmake
index c9a54547c0a..931da2cae5b 100644
--- a/src/runtime/eng/native/configurecompiler.cmake
+++ b/src/runtime/eng/native/configurecompiler.cmake
@@ -488,6 +488,7 @@ if (CLR_CMAKE_HOST_UNIX)
     # other clang 16.0 suppressions
     add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
     add_compile_options(-Wno-cast-function-type-strict)
+    add_compile_options(-Wno-incompatible-function-pointer-types-strict)
   else()
     add_compile_options(-Wno-uninitialized)
     add_compile_options(-Wno-strict-aliasing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants