Jinoh Kang (@iamahuman) commented about dlls/ntdll/unix/signal_x86_64.c:
- Check for fault caused by invalid %gs value (some copy protection schemes mess with it).
- */
+static inline BOOL check_invalid_gs( ucontext_t *sigcontext, CONTEXT *context ) +{
- const BYTE *instr = (const BYTE *)context->Rip;
- TEB *teb = get_current_teb();
- WORD system_gs = ds64_sel;
- ULONG_PTR cur_gs = 0;
+#ifdef __linux__
- if (syscall_flags & SYSCALL_HAVE_WRFSGSBASE)
__asm__ volatile ("rdgsbase %0" : "=r" (cur_gs));
- else
cur_gs = arch_prctl( ARCH_GET_GS, teb );
ARCH_GET_GS yields value by writing to pointer. The return value is just error status.
```suggestion:-0+0 arch_prctl( ARCH_GET_GS, &cur_gs ); ```