-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[compiler-rt][Mips] Fix mips SP register definition #124493
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
Conversation
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 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. |
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Jens Reidel (Gelbpunkt) ChangesThe mainline Linux kernel defines EF_R29, not EF_REG29 1. Further, the asm/reg.h header requires Full diff: https://github.com/llvm/llvm-project/pull/124493.diff 1 Files Affected:
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
index 945da99d41f4ea..95483cb79db263 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
@@ -37,25 +37,28 @@
# include <asm/ptrace.h>
#endif
#include <sys/user.h> // for user_regs_struct
-#if SANITIZER_ANDROID && SANITIZER_MIPS
-# include <asm/reg.h> // for mips SP register in sys/user.h
-#endif
-#include <sys/wait.h> // for signal-related stuff
-
-#ifdef sa_handler
-# undef sa_handler
-#endif
-
-#ifdef sa_sigaction
-# undef sa_sigaction
-#endif
-
-#include "sanitizer_common.h"
-#include "sanitizer_flags.h"
-#include "sanitizer_libc.h"
-#include "sanitizer_linux.h"
-#include "sanitizer_mutex.h"
-#include "sanitizer_placement_new.h"
+# if SANITIZER_MIPS
+// clang-format off
+# include <asm/sgidefs.h> // for _MIPS_SIM_* defines used in asm/reg.h
+# include <asm/reg.h> // for mips SP register in sys/user.h
+// clang-format on
+# endif
+# include <sys/wait.h> // for signal-related stuff
+
+# ifdef sa_handler
+# undef sa_handler
+# endif
+
+# ifdef sa_sigaction
+# undef sa_sigaction
+# endif
+
+# include "sanitizer_common.h"
+# include "sanitizer_flags.h"
+# include "sanitizer_libc.h"
+# include "sanitizer_linux.h"
+# include "sanitizer_mutex.h"
+# include "sanitizer_placement_new.h"
// Sufficiently old kernel headers don't provide this value, but we can still
// call prctl with it. If the runtime kernel is new enough, the prctl call will
@@ -510,11 +513,7 @@ typedef pt_regs regs_struct;
#elif defined(__mips__)
typedef struct user regs_struct;
-# if SANITIZER_ANDROID
-# define REG_SP regs[EF_R29]
-# else
-# define REG_SP regs[EF_REG29]
-# endif
+# define REG_SP regs[EF_R29]
#elif defined(__aarch64__)
typedef struct user_pt_regs regs_struct;
|
Ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please undo reformat, or extract into a separate commit or PR
compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
Show resolved
Hide resolved
Sorry, I was following https://llvm.org/docs/Contributing.html#how-to-submit-a-patch which says to use |
The mainline Linux kernel defines EF_R29, not EF_REG29 [1]. Further, the asm/reg.h header requires _MIPS_SIM_* to be defined, which reside in asm/sgidefs.h [2]. [1]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/reg.h#L151 [2]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/sgidefs.h#L33-L35 Signed-off-by: Jens Reidel <[email protected]>
Signed-off-by: Jens Reidel <[email protected]>
b356c45
to
ee356a7
Compare
compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
Show resolved
Hide resolved
That's relevant, but it assume the pre-existing code is already clang formatted. But there is "be an isolated change. Independent changes should be submitted as separate patches as this makes reviewing easier." This file have legacy formatting, which we incrementally change to new format. |
@Gelbpunkt Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
The mainline Linux kernel defines EF_R29, not EF_REG29 [1]. Further, the asm/reg.h header requires `_MIPS_SIM_*` to be defined, which reside in asm/sgidefs.h [2]. [1]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/reg.h#L151 [2]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/sgidefs.h#L33-L35 --------- Signed-off-by: Jens Reidel <[email protected]>
The mainline Linux kernel defines EF_R29, not EF_REG29 [1]. Further, the asm/reg.h header requires `_MIPS_SIM_*` to be defined, which reside in asm/sgidefs.h [2]. [1]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/reg.h#L151 [2]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/sgidefs.h#L33-L35 --------- Signed-off-by: Jens Reidel <[email protected]>
The mainline Linux kernel defines EF_R29, not EF_REG29 [1]. Further, the asm/reg.h header requires `_MIPS_SIM_*` to be defined, which reside in asm/sgidefs.h [2]. [1]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/reg.h#L151 [2]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/sgidefs.h#L33-L35 --------- Signed-off-by: Jens Reidel <[email protected]>
The mainline Linux kernel defines EF_R29, not EF_REG29 1. Further, the asm/reg.h header requires
_MIPS_SIM_*
to be defined, which reside in asm/sgidefs.h 2.