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

[compiler-rt] [safestack] store unsafe stack pointer in TCB #85878

Closed
wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Mar 19, 2024

I modified the safestack runtime library to store the unsafe stack pointer directly in the TCB. By storing the pointer in the TCB, instead of a thread-local variable, access to the unsafe stack pointer can be faster by eliminating an additional level of indirection.

I modified the safestack runtime library to store the unsafe stack pointer directly in the TCB. By storing the pointer in the TCB, instead of a thread-local variable, access to the unsafe stack pointer can be faster by eliminating an additional level of indirection.
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@ghost ghost changed the title [safestack] store unsafe stack pointer in TCB [compiler-rt] [safestack] store unsafe stack pointer in TCB Mar 19, 2024
Copy link

github-actions bot commented Mar 19, 2024

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

You can test this locally with the following command:
git-clang-format --diff e28d3e9b4e5779028a38ca39ed060938ff62c498 1430f4892fb563a54920674284d7de276983c849 -- compiler-rt/lib/safestack/safestack.cpp
View the diff from clang-format here.
diff --git a/compiler-rt/lib/safestack/safestack.cpp b/compiler-rt/lib/safestack/safestack.cpp
index 0f2eab2f12..19e740964a 100644
--- a/compiler-rt/lib/safestack/safestack.cpp
+++ b/compiler-rt/lib/safestack/safestack.cpp
@@ -38,13 +38,13 @@ __attribute__((visibility(
 }
 
 #if defined(__linux__) && defined(__x86_64__)
-#include <stdint.h>
-#include <sys/types.h>
+#  include <stdint.h>
+#  include <sys/types.h>
 
 typedef struct {
-  void *tcb; /* Pointer to the TCB. Not necessarily the
-                thread descriptor used by libpthread. */
-  uint64_t *stack_guard; /* Stack guard value for the thread. */
+  void *tcb;              /* Pointer to the TCB. Not necessarily the
+                             thread descriptor used by libpthread. */
+  uint64_t *stack_guard;  /* Stack guard value for the thread. */
   void *unsafe_stack_ptr; /* Unsafe stack pointer for the thread. */
 } tcbhead_t;
 

@ghost ghost closed this by deleting the head repository Mar 19, 2024
This pull request was closed.
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.

None yet

1 participant