Commit 932307a4 authored by Vladimir Murzin's avatar Vladimir Murzin Committed by Jiri Slaby

ARM: 8226/1: cacheflush: get rid of restarting block

commit 3f4aa45c upstream.

We cannot restart cacheflush safely if a process provides user-defined
signal handler and signal is pending. In this case -EINTR is returned
and it is expected that process re-invokes syscall. However, there are
a few problems with that:
 * looks like nobody bothers checking return value from cacheflush
 * but if it did, we don't provide the restart address for that, so the
   process has to use the same range again
 * ...and again, what might lead to looping forever

So, remove cacheflush restarting code and terminate cache flushing
as early as fatal signal is pending.
Reported-by: default avatarChanho Min <chanho.min@lge.com>
Signed-off-by: default avatarVladimir Murzin <vladimir.murzin@arm.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 72741f17
...@@ -43,16 +43,6 @@ struct cpu_context_save { ...@@ -43,16 +43,6 @@ struct cpu_context_save {
__u32 extra[2]; /* Xscale 'acc' register, etc */ __u32 extra[2]; /* Xscale 'acc' register, etc */
}; };
struct arm_restart_block {
union {
/* For user cache flushing */
struct {
unsigned long start;
unsigned long end;
} cache;
};
};
/* /*
* low level task data that entry.S needs immediate access to. * low level task data that entry.S needs immediate access to.
* __switch_to() assumes cpu_context follows immediately after cpu_domain. * __switch_to() assumes cpu_context follows immediately after cpu_domain.
...@@ -78,7 +68,6 @@ struct thread_info { ...@@ -78,7 +68,6 @@ struct thread_info {
unsigned long thumbee_state; /* ThumbEE Handler Base register */ unsigned long thumbee_state; /* ThumbEE Handler Base register */
#endif #endif
struct restart_block restart_block; struct restart_block restart_block;
struct arm_restart_block arm_restart_block;
}; };
#define INIT_THREAD_INFO(tsk) \ #define INIT_THREAD_INFO(tsk) \
......
...@@ -503,8 +503,6 @@ static int bad_syscall(int n, struct pt_regs *regs) ...@@ -503,8 +503,6 @@ static int bad_syscall(int n, struct pt_regs *regs)
return regs->ARM_r0; return regs->ARM_r0;
} }
static long do_cache_op_restart(struct restart_block *);
static inline int static inline int
__do_cache_op(unsigned long start, unsigned long end) __do_cache_op(unsigned long start, unsigned long end)
{ {
...@@ -513,24 +511,8 @@ __do_cache_op(unsigned long start, unsigned long end) ...@@ -513,24 +511,8 @@ __do_cache_op(unsigned long start, unsigned long end)
do { do {
unsigned long chunk = min(PAGE_SIZE, end - start); unsigned long chunk = min(PAGE_SIZE, end - start);
if (signal_pending(current)) { if (fatal_signal_pending(current))
struct thread_info *ti = current_thread_info(); return 0;
ti->restart_block = (struct restart_block) {
.fn = do_cache_op_restart,
};
ti->arm_restart_block = (struct arm_restart_block) {
{
.cache = {
.start = start,
.end = end,
},
},
};
return -ERESTART_RESTARTBLOCK;
}
ret = flush_cache_user_range(start, start + chunk); ret = flush_cache_user_range(start, start + chunk);
if (ret) if (ret)
...@@ -543,15 +525,6 @@ __do_cache_op(unsigned long start, unsigned long end) ...@@ -543,15 +525,6 @@ __do_cache_op(unsigned long start, unsigned long end)
return 0; return 0;
} }
static long do_cache_op_restart(struct restart_block *unused)
{
struct arm_restart_block *restart_block;
restart_block = &current_thread_info()->arm_restart_block;
return __do_cache_op(restart_block->cache.start,
restart_block->cache.end);
}
static inline int static inline int
do_cache_op(unsigned long start, unsigned long end, int flags) do_cache_op(unsigned long start, unsigned long end, int flags)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment