Skip to content

Commit

Permalink
ARM: only allow 26-bit user mode on CPUs that support it
Browse files Browse the repository at this point in the history
Change-Id: If62616ee826b3786b9fc7a877bff5584e69f7173
Reviewed-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Dima Zavin <dima@android.com>
  • Loading branch information
Dima Zavin committed Aug 10, 2010
1 parent 8097ca0 commit bca5320
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/arm/include/asm/ptrace.h
Expand Up @@ -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;
}
Expand Down

0 comments on commit bca5320

Please sign in to comment.