Skip to content

[compiler-rt] Fix #122795 for solaris platforms proposal. #122956

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

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

devnexen
Copy link
Member

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Jan 14, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: David CARLIER (devnexen)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/122956.diff

2 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp (+3)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h (+2)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp
index dad7bde1498a7a..7ea6134b702bf7 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp
@@ -32,6 +32,7 @@
 #include <semaphore.h>
 #include <signal.h>
 #include <stddef.h>
+#include <stdio.h>
 #include <sys/ethernet.h>
 #include <sys/filio.h>
 #include <sys/ipc.h>
@@ -135,6 +136,8 @@ namespace __sanitizer {
   unsigned struct_sioc_sg_req_sz = sizeof(struct sioc_sg_req);
   unsigned struct_sioc_vif_req_sz = sizeof(struct sioc_vif_req);
 
+  unsigned fpos_t_sz = sizeof(fpos_t);
+
   const unsigned IOCTL_NOT_PRESENT = 0;
 
   unsigned IOCTL_FIOASYNC = FIOASYNC;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
index 84a81265162c65..bf6586d27228fb 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
@@ -418,6 +418,8 @@ extern unsigned struct_winsize_sz;
 extern unsigned struct_sioc_sg_req_sz;
 extern unsigned struct_sioc_vif_req_sz;
 
+extern unsigned fpos_t_sz;
+
 // ioctl request identifiers
 
 // A special value to mark ioctls that are not present on the target platform,

@devnexen
Copy link
Member Author

Let me know if that s fine with you or you prefer another solution (e.g. not intercepting fseek at all for solaris) or taking care of it yourself. cheers.

Copy link

github-actions bot commented Jan 14, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff dac06e76e0c12a89b750440b4c9a04c68f6baa48 0c8aba36dd4dc34ed03acb8d38b424f35899cef6 --extensions cpp,h -- compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
View the diff from clang-format here.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp
index 7ea6134b70..8deebb0693 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp
@@ -32,32 +32,32 @@
 #include <semaphore.h>
 #include <signal.h>
 #include <stddef.h>
-#include <stdio.h>
-#include <sys/ethernet.h>
-#include <sys/filio.h>
-#include <sys/ipc.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/mtio.h>
-#include <sys/ptyvar.h>
-#include <sys/resource.h>
-#include <sys/shm.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/stat.h>
-#include <sys/statfs.h>
-#include <sys/statvfs.h>
-#include <sys/time.h>
-#include <sys/timeb.h>
-#include <sys/times.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <termios.h>
-#include <time.h>
-#include <utmp.h>
-#include <utmpx.h>
-#include <wchar.h>
-#include <wordexp.h>
+#  include <stdio.h>
+#  include <sys/ethernet.h>
+#  include <sys/filio.h>
+#  include <sys/ipc.h>
+#  include <sys/mman.h>
+#  include <sys/mount.h>
+#  include <sys/mtio.h>
+#  include <sys/ptyvar.h>
+#  include <sys/resource.h>
+#  include <sys/shm.h>
+#  include <sys/socket.h>
+#  include <sys/sockio.h>
+#  include <sys/stat.h>
+#  include <sys/statfs.h>
+#  include <sys/statvfs.h>
+#  include <sys/time.h>
+#  include <sys/timeb.h>
+#  include <sys/times.h>
+#  include <sys/types.h>
+#  include <sys/utsname.h>
+#  include <termios.h>
+#  include <time.h>
+#  include <utmp.h>
+#  include <utmpx.h>
+#  include <wchar.h>
+#  include <wordexp.h>
 
 // Include these after system headers to avoid name clashes and ambiguities.
 #include "sanitizer_internal_defs.h"

@fmayer
Copy link
Contributor

fmayer commented Jan 14, 2025

Does this mean that solaris is SI_POSIX but doesn't use sanitizer_platform_limits_posix? Sadness :(

@devnexen
Copy link
Member Author

Yes ideally the platform posix should take care of all posix things then the os specifics take care of native parts but I guess it s complicated unfortunately.

Copy link
Contributor

@fmayer fmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from sanitizer perspective but let's wait for Solaris reply as well

@devnexen
Copy link
Member Author

AFAIK even freebsd fails now needs to fix it too.

@fmayer
Copy link
Contributor

fmayer commented Jan 14, 2025

Ah, so what was actually wrong in the original CL was the #if. Sorry for the bother

@devnexen
Copy link
Member Author

I myself forgot about this :) In fact only linux/android and macos uses the posix compile unit.

@rorth
Copy link
Collaborator

rorth commented Jan 15, 2025

Yes ideally the platform posix should take care of all posix things then the os specifics take care of native parts but I guess it s complicated unfortunately.

Right: file naming has always been a nightmare inside compiler-rt. Not only might files called *posix* only refer to some POSIX systems, but you regularly have files called *linux* being used on all Unix system. This is extremely confusing, both when working on a new port and when working on the existing code. There's no rhyme or reason here.

@rorth
Copy link
Collaborator

rorth commented Jan 15, 2025

LGTM from sanitizer perspective but let's wait for Solaris reply as well

I've now successfully tested the patch on both amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

@rorth
Copy link
Collaborator

rorth commented Jan 15, 2025

AFAIK even freebsd fails now needs to fix it too.

Can you please update the description for that? For one, please use [sanitizer_common] as tag since that's all the patch touches. And even more importantly, use a descriptive summary: pull request numbers are completely meaningless.

@devnexen devnexen force-pushed the fix_gh122795_forsolaris branch from 9915498 to f7d4bf5 Compare January 15, 2025 13:25
@devnexen devnexen force-pushed the fix_gh122795_forsolaris branch from f7d4bf5 to 0c8aba3 Compare January 15, 2025 13:25
@devnexen devnexen merged commit da4551a into llvm:main Jan 15, 2025
4 of 6 checks passed
@rorth
Copy link
Collaborator

rorth commented Jan 15, 2025

AFAIK even freebsd fails now needs to fix it too.

Can you please update the description for that? For one, please use [sanitizer_common] as tag since that's all the patch touches. And even more importantly, use a descriptive summary: pull request numbers are completely meaningless.

Any reason you ignored this? The current description is a lie.

@rorth
Copy link
Collaborator

rorth commented Jan 15, 2025

Sorry: both the mail and github still showed the old summary, while the commit got it right. What a mess...

Btw., please omit proposal in the future: once a patch is committed, it is no longer a proposal ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants