Skip to content

Commit 3f4aa45

Browse files
murzinvRussell King
authored andcommitted
ARM: 8226/1: cacheflush: get rid of restarting block
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. Cc: stable@vger.kernel.org # 3.12+ Reported-by: Chanho Min <chanho.min@lge.com> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 995ab51 commit 3f4aa45

File tree

2 files changed

+2
-40
lines changed

2 files changed

+2
-40
lines changed

arch/arm/include/asm/thread_info.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ struct cpu_context_save {
4444
__u32 extra[2]; /* Xscale 'acc' register, etc */
4545
};
4646

47-
struct arm_restart_block {
48-
union {
49-
/* For user cache flushing */
50-
struct {
51-
unsigned long start;
52-
unsigned long end;
53-
} cache;
54-
};
55-
};
56-
5747
/*
5848
* low level task data that entry.S needs immediate access to.
5949
* __switch_to() assumes cpu_context follows immediately after cpu_domain.
@@ -79,7 +69,6 @@ struct thread_info {
7969
unsigned long thumbee_state; /* ThumbEE Handler Base register */
8070
#endif
8171
struct restart_block restart_block;
82-
struct arm_restart_block arm_restart_block;
8372
};
8473

8574
#define INIT_THREAD_INFO(tsk) \

arch/arm/kernel/traps.c

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,6 @@ static int bad_syscall(int n, struct pt_regs *regs)
533533
return regs->ARM_r0;
534534
}
535535

536-
static long do_cache_op_restart(struct restart_block *);
537-
538536
static inline int
539537
__do_cache_op(unsigned long start, unsigned long end)
540538
{
@@ -543,24 +541,8 @@ __do_cache_op(unsigned long start, unsigned long end)
543541
do {
544542
unsigned long chunk = min(PAGE_SIZE, end - start);
545543

546-
if (signal_pending(current)) {
547-
struct thread_info *ti = current_thread_info();
548-
549-
ti->restart_block = (struct restart_block) {
550-
.fn = do_cache_op_restart,
551-
};
552-
553-
ti->arm_restart_block = (struct arm_restart_block) {
554-
{
555-
.cache = {
556-
.start = start,
557-
.end = end,
558-
},
559-
},
560-
};
561-
562-
return -ERESTART_RESTARTBLOCK;
563-
}
544+
if (fatal_signal_pending(current))
545+
return 0;
564546

565547
ret = flush_cache_user_range(start, start + chunk);
566548
if (ret)
@@ -573,15 +555,6 @@ __do_cache_op(unsigned long start, unsigned long end)
573555
return 0;
574556
}
575557

576-
static long do_cache_op_restart(struct restart_block *unused)
577-
{
578-
struct arm_restart_block *restart_block;
579-
580-
restart_block = &current_thread_info()->arm_restart_block;
581-
return __do_cache_op(restart_block->cache.start,
582-
restart_block->cache.end);
583-
}
584-
585558
static inline int
586559
do_cache_op(unsigned long start, unsigned long end, int flags)
587560
{

0 commit comments

Comments
 (0)