Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 136362
b: refs/heads/master
c: af9ff78
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and Ingo Molnar committed Jul 13, 2008
1 parent c87e2a5 commit 90764a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aa92db14270b79f0f91a9060b547a46f9e2639da
refs/heads/master: af9ff7868f0f76d3364351b1641b9dfa99588e77
1 change: 1 addition & 0 deletions trunk/include/asm-x86/pda.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ do { \

#define PDA_STACKOFFSET (5*8)

#define refresh_stack_canary() write_pda(stack_canary, current->stack_canary)
#endif
29 changes: 7 additions & 22 deletions trunk/kernel/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,37 +328,21 @@ EXPORT_SYMBOL(warn_on_slowpath);
#ifndef GCC_HAS_SP
#warning You have selected the CONFIG_CC_STACKPROTECTOR option, but the gcc used does not support this.
#endif

static unsigned long __stack_check_testing;

/*
* Self test function for the stack-protector feature.
* This test requires that the local variable absolutely has
* a stack slot, hence the barrier()s.
* a stack slot.
*/
static noinline void __stack_chk_test_func(void)
{
unsigned long foo;
barrier();
/*
* we need to make sure we're not about to clobber the return address,
* while real exploits do this, it's unhealthy on a running system.
* Besides, if we would, the test is already failed anyway so
* time to pull the emergency brake on it.
*/
if ((unsigned long)__builtin_return_address(0) ==
*(((unsigned long *)&foo)+1)) {
printk(KERN_ERR "No -fstack-protector-stack-frame!\n");
}
#ifdef CONFIG_FRAME_POINTER
/* We also don't want to clobber the frame pointer */
if ((unsigned long)__builtin_return_address(0) ==
*(((unsigned long *)&foo)+2)) {
printk(KERN_ERR "No -fstack-protector-stack-frame!\n");
}
#endif
if (current->stack_canary != *(((unsigned long *)&foo)+1))
printk(KERN_ERR "No -fstack-protector canary found\n");
unsigned long dummy_buffer[64]; /* force gcc to use the canary */

current->stack_canary = ~current->stack_canary;
refresh_stack_canary();
dummy_buffer[3] = 1; /* fool gcc into keeping the variable */
}

static int __stack_chk_test(void)
Expand All @@ -371,6 +355,7 @@ static int __stack_chk_test(void)
WARN_ON(1);
};
current->stack_canary = ~current->stack_canary;
refresh_stack_canary();
return 0;
}
/*
Expand Down

0 comments on commit 90764a6

Please sign in to comment.