History

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.

Vladimir Murzin committed 11 years ago

Commit 3f4aa451 parent 995ab512 files · +2 −40Browse files

Unified · Split

2 files
  1. arch/arm/include/asm/thread_info.h +0 −11
  2. arch/arm/kernel/traps.c +2 −29
arch/arm/include/asm/thread_info.h+0−11
@@ -44,16 +44,6 @@ struct cpu_context_save { · 43 unmodified lines
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 { · 19 unmodified lines
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+2−29
@@ -533,8 +533,6 @@ static int bad_syscall(int n, struct pt_regs *regs) · 532 unmodified lines
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) · 2 unmodified lines
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) · 6 unmodified lines
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 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t