Getting ESP
This can be called individually, but in the case of local privilege escalation, from within our exploit program:
#include <stdio.h>
unsigned long get_sp(void) {
  __asm__(“movl %esp, %eax”);
}
int main() {
printf(“Stack pointer (ESP): 0x%p\n”,get_sp());
}