mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ARM: Tighten check for allowable CPSR values
Reviewed-by: Arve Hjønnevåg <arve@android.com> Acked-by: Dima Zavin <dima@android.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
21d93e2e29
commit
41e2e8fd34
1 changed files with 13 additions and 4 deletions
|
@ -158,15 +158,24 @@ struct pt_regs {
|
|||
*/
|
||||
static inline int valid_user_regs(struct pt_regs *regs)
|
||||
{
|
||||
if (user_mode(regs) && (regs->ARM_cpsr & PSR_I_BIT) == 0) {
|
||||
regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT);
|
||||
return 1;
|
||||
unsigned long mode = regs->ARM_cpsr & MODE_MASK;
|
||||
|
||||
/*
|
||||
* Always clear the F (FIQ) and A (delayed abort) bits
|
||||
*/
|
||||
regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT);
|
||||
|
||||
if ((regs->ARM_cpsr & PSR_I_BIT) == 0) {
|
||||
if (mode == USR_MODE)
|
||||
return 1;
|
||||
if (elf_hwcap & HWCAP_26BIT && mode == USR26_MODE)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Force CPSR to something logical...
|
||||
*/
|
||||
regs->ARM_cpsr &= PSR_f | PSR_s | (PSR_x & ~PSR_A_BIT) | PSR_T_BIT | MODE32_BIT;
|
||||
regs->ARM_cpsr &= PSR_f | PSR_s | PSR_x | PSR_T_BIT | MODE32_BIT;
|
||||
if (!(elf_hwcap & HWCAP_26BIT))
|
||||
regs->ARM_cpsr |= USR_MODE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue