@@ -2091,12 +2091,19 @@ static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
2091
2091
*sp = ucontext->uc_mcontext .gregs [REG_UESP];
2092
2092
# endif
2093
2093
#elif defined(__powerpc__) || defined(__powerpc64__)
2094
+ # if SANITIZER_FREEBSD
2095
+ ucontext_t *ucontext = (ucontext_t *)context;
2096
+ *pc = ucontext->uc_mcontext .mc_srr0 ;
2097
+ *sp = ucontext->uc_mcontext .mc_frame [1 ];
2098
+ *bp = ucontext->uc_mcontext .mc_frame [31 ];
2099
+ # else
2094
2100
ucontext_t *ucontext = (ucontext_t *)context;
2095
2101
*pc = ucontext->uc_mcontext .regs ->nip ;
2096
2102
*sp = ucontext->uc_mcontext .regs ->gpr [PT_R1];
2097
2103
// The powerpc{,64}-linux ABIs do not specify r31 as the frame
2098
2104
// pointer, but GCC always uses r31 when we need a frame pointer.
2099
2105
*bp = ucontext->uc_mcontext .regs ->gpr [PT_R31];
2106
+ # endif
2100
2107
#elif defined(__sparc__)
2101
2108
#if defined(__arch64__) || defined(__sparcv9)
2102
2109
#define STACK_BIAS 2047
@@ -2185,17 +2192,6 @@ void CheckASLR() {
2185
2192
GetArgv ()[0 ]);
2186
2193
Die ();
2187
2194
}
2188
- #elif SANITIZER_PPC64V2
2189
- // Disable ASLR for Linux PPC64LE.
2190
- int old_personality = personality (0xffffffff );
2191
- if (old_personality != -1 && (old_personality & ADDR_NO_RANDOMIZE) == 0 ) {
2192
- VReport (1 , " WARNING: Program is being run with address space layout "
2193
- " randomization (ASLR) enabled which prevents the thread and "
2194
- " memory sanitizers from working on powerpc64le.\n "
2195
- " ASLR will be disabled and the program re-executed.\n " );
2196
- CHECK_NE (personality (old_personality | ADDR_NO_RANDOMIZE), -1 );
2197
- ReExec ();
2198
- }
2199
2195
#elif SANITIZER_FREEBSD
2200
2196
int aslr_status;
2201
2197
if (UNLIKELY (procctl (P_PID, 0 , PROC_ASLR_STATUS, &aslr_status) == -1 )) {
@@ -2209,9 +2205,21 @@ void CheckASLR() {
2209
2205
" and binaries compiled with PIE\n " );
2210
2206
Die ();
2211
2207
}
2212
- #else
2208
+ # elif SANITIZER_PPC64V2
2209
+ // Disable ASLR for Linux PPC64LE.
2210
+ int old_personality = personality (0xffffffff );
2211
+ if (old_personality != -1 && (old_personality & ADDR_NO_RANDOMIZE) == 0 ) {
2212
+ VReport (1 ,
2213
+ " WARNING: Program is being run with address space layout "
2214
+ " randomization (ASLR) enabled which prevents the thread and "
2215
+ " memory sanitizers from working on powerpc64le.\n "
2216
+ " ASLR will be disabled and the program re-executed.\n " );
2217
+ CHECK_NE (personality (old_personality | ADDR_NO_RANDOMIZE), -1 );
2218
+ ReExec ();
2219
+ }
2220
+ # else
2213
2221
// Do nothing
2214
- #endif
2222
+ # endif
2215
2223
}
2216
2224
2217
2225
void CheckMPROTECT () {
0 commit comments