Skip to content

Commit 3b0c062

Browse files
wildea01Russell King
authored andcommitted
ARM: 7442/1: Revert "remove unused restart trampoline"
This reverts commit fa18484. We need the restart trampoline back so that we can revert a related problematic patch 6b5c804 ("arm: new way of handling ERESTART_RESTARTBLOCK"). Acked-by: Catalin Marinas <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 82401bf commit 3b0c062

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

arch/arm/kernel/signal.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
#define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE))
2929
#define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE))
30+
#define SWI_SYS_RESTART (0xef000000|__NR_restart_syscall|__NR_OABI_SYSCALL_BASE)
3031

3132
/*
3233
* With EABI, the syscall number has to be loaded into r7.
@@ -46,6 +47,18 @@ const unsigned long sigreturn_codes[7] = {
4647
MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN,
4748
};
4849

50+
/*
51+
* Either we support OABI only, or we have EABI with the OABI
52+
* compat layer enabled. In the later case we don't know if
53+
* user space is EABI or not, and if not we must not clobber r7.
54+
* Always using the OABI syscall solves that issue and works for
55+
* all those cases.
56+
*/
57+
const unsigned long syscall_restart_code[2] = {
58+
SWI_SYS_RESTART, /* swi __NR_restart_syscall */
59+
0xe49df004, /* ldr pc, [sp], #4 */
60+
};
61+
4962
/*
5063
* atomically swap in the new signal mask, and wait for a signal.
5164
*/

arch/arm/kernel/signal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
* published by the Free Software Foundation.
99
*/
1010
#define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500)
11+
#define KERN_RESTART_CODE (KERN_SIGRETURN_CODE + sizeof(sigreturn_codes))
1112

1213
extern const unsigned long sigreturn_codes[7];
14+
extern const unsigned long syscall_restart_code[2];

arch/arm/kernel/traps.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,8 @@ void __init early_trap_init(void *vectors_base)
820820
*/
821821
memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE),
822822
sigreturn_codes, sizeof(sigreturn_codes));
823+
memcpy((void *)(vectors + KERN_RESTART_CODE - CONFIG_VECTORS_BASE),
824+
syscall_restart_code, sizeof(syscall_restart_code));
823825

824826
flush_icache_range(vectors, vectors + PAGE_SIZE);
825827
modify_domain(DOMAIN_USER, DOMAIN_CLIENT);

0 commit comments

Comments
 (0)