2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1994, 1995, 1996, 1998, 1999, 2002, 2003 Ralf Baechle
|
2011-04-05 04:15:29 +07:00
|
|
|
* Copyright (C) 1996 David S. Miller (davem@davemloft.net)
|
2005-04-17 05:20:36 +07:00
|
|
|
* Copyright (C) 1994, 1995, 1996, by Andreas Busse
|
|
|
|
* Copyright (C) 1999 Silicon Graphics, Inc.
|
|
|
|
* Copyright (C) 2000 MIPS Technologies, Inc.
|
|
|
|
* written by Carsten Langgaard, carstenl@mips.com
|
|
|
|
*/
|
|
|
|
#include <asm/asm.h>
|
|
|
|
#include <asm/cachectl.h>
|
|
|
|
#include <asm/mipsregs.h>
|
2005-09-10 03:32:31 +07:00
|
|
|
#include <asm/asm-offsets.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <asm/regdef.h>
|
|
|
|
#include <asm/stackframe.h>
|
|
|
|
#include <asm/thread_info.h>
|
|
|
|
|
|
|
|
#include <asm/asmmacro.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* task_struct *resume(task_struct *prev, task_struct *next,
|
2015-08-03 22:49:30 +07:00
|
|
|
* struct thread_info *next_ti)
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
.align 5
|
|
|
|
LEAF(resume)
|
2007-04-14 00:37:26 +07:00
|
|
|
mfc0 t1, CP0_STATUS
|
|
|
|
LONG_S t1, THREAD_STATUS(a0)
|
2005-04-17 05:20:36 +07:00
|
|
|
cpu_save_nonscratch a0
|
|
|
|
LONG_S ra, THREAD_REG31(a0)
|
|
|
|
|
Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables
The changes to automatically test for working stack protector compiler
support in the Kconfig files removed the special STACKPROTECTOR_AUTO
option that picked the strongest stack protector that the compiler
supported.
That was all a nice cleanup - it makes no sense to have the AUTO case
now that the Kconfig phase can just determine the compiler support
directly.
HOWEVER.
It also meant that doing "make oldconfig" would now _disable_ the strong
stackprotector if you had AUTO enabled, because in a legacy config file,
the sane stack protector configuration would look like
CONFIG_HAVE_CC_STACKPROTECTOR=y
# CONFIG_CC_STACKPROTECTOR_NONE is not set
# CONFIG_CC_STACKPROTECTOR_REGULAR is not set
# CONFIG_CC_STACKPROTECTOR_STRONG is not set
CONFIG_CC_STACKPROTECTOR_AUTO=y
and when you ran this through "make oldconfig" with the Kbuild changes,
it would ask you about the regular CONFIG_CC_STACKPROTECTOR (that had
been renamed from CONFIG_CC_STACKPROTECTOR_REGULAR to just
CONFIG_CC_STACKPROTECTOR), but it would think that the STRONG version
used to be disabled (because it was really enabled by AUTO), and would
disable it in the new config, resulting in:
CONFIG_HAVE_CC_STACKPROTECTOR=y
CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
CONFIG_CC_STACKPROTECTOR=y
# CONFIG_CC_STACKPROTECTOR_STRONG is not set
CONFIG_CC_HAS_SANE_STACKPROTECTOR=y
That's dangerously subtle - people could suddenly find themselves with
the weaker stack protector setup without even realizing.
The solution here is to just rename not just the old RECULAR stack
protector option, but also the strong one. This does that by just
removing the CC_ prefix entirely for the user choices, because it really
is not about the compiler support (the compiler support now instead
automatially impacts _visibility_ of the options to users).
This results in "make oldconfig" actually asking the user for their
choice, so that we don't have any silent subtle security model changes.
The end result would generally look like this:
CONFIG_HAVE_CC_STACKPROTECTOR=y
CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
CONFIG_STACKPROTECTOR=y
CONFIG_STACKPROTECTOR_STRONG=y
CONFIG_CC_HAS_SANE_STACKPROTECTOR=y
where the "CC_" versions really are about internal compiler
infrastructure, not the user selections.
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-06-14 10:21:18 +07:00
|
|
|
#if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_SMP)
|
2013-10-07 18:14:26 +07:00
|
|
|
PTR_LA t8, __stack_chk_guard
|
2013-06-18 02:36:07 +07:00
|
|
|
LONG_L t9, TASK_STACK_CANARY(a1)
|
|
|
|
LONG_S t9, 0(t8)
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* The order of restoring the registers takes care of the race
|
|
|
|
* updating $28, $29 and kernelsp without disabling ints.
|
|
|
|
*/
|
|
|
|
move $28, a2
|
|
|
|
cpu_restore_nonscratch a1
|
|
|
|
|
2007-07-11 14:32:21 +07:00
|
|
|
PTR_ADDU t0, $28, _THREAD_SIZE - 32
|
2005-04-17 05:20:36 +07:00
|
|
|
set_saved_sp t0, t1, t2
|
|
|
|
mfc0 t1, CP0_STATUS /* Do we really need this? */
|
|
|
|
li a3, 0xff01
|
|
|
|
and t1, a3
|
|
|
|
LONG_L a2, THREAD_STATUS(a1)
|
|
|
|
nor a3, $0, a3
|
|
|
|
and a2, a3
|
|
|
|
or a2, t1
|
|
|
|
mtc0 a2, CP0_STATUS
|
|
|
|
move v0, a0
|
|
|
|
jr ra
|
|
|
|
END(resume)
|