Permalink
Browse files

ARM: only allow 26-bit user mode on CPUs that support it

Change-Id: Ia79b3872d395ffe796dd9d564ae08f7c0d5bc49e
Reviewed-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Dima Zavin <dima@android.com>
  • Loading branch information...
Dima Zavin
Dima Zavin committed Jul 29, 2010
1 parent 750bc63 commit 049a7464f34e2d8c73646d2571f1935f19ac694c
Showing with 5 additions and 1 deletion.
  1. +5 −1 arch/arm/include/asm/ptrace.h
@@ -150,7 +150,11 @@ struct pt_regs {
*/
static inline int valid_user_regs(struct pt_regs *regs)
{
- if (user_mode(regs) && (regs->ARM_cpsr & PSR_I_BIT) == 0) {
+ long mode = regs->ARM_cpsr & MODE_MASK;
+
+ if (((mode == USR_MODE) ||
+ ((elf_hwcap & HWCAP_26BIT) && (mode == USR26_MODE))) &&
+ (regs->ARM_cpsr & PSR_I_BIT) == 0) {
regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT);
return 1;
}

0 comments on commit 049a746

Please sign in to comment.