public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* iwmmxt signal frame handling
@ 2010-10-14 14:09 Arnd Bergmann
  2010-10-15  4:15 ` Nicolas Pitre
  2010-10-15  9:17 ` Eric Miao
  0 siblings, 2 replies; 10+ messages in thread
From: Arnd Bergmann @ 2010-10-14 14:09 UTC (permalink / raw)
  To: linux-arm-kernel

Peter Maydell noticed during code review that the signal frame might
be written incorrectly for kernels with CONFIG_IWMMXT set running
processes without TIF_USING_IWMMXT, where the magic/size values
for the iwmmxt section of the frame are left uninitialized.
Instead of skipping this part of the frame, we should instead
write a valid header with zero data.

This patch is compile-tested only since the problem was only
found in review and neither Peter nor myself have access to
IWMMXT capable hardware to test this on.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: Peter Maydell <peter.maydell@linaro.org>

--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -154,7 +154,10 @@ static int preserve_iwmmxt_context(struct iwmmxt_sigframe *frame)
 	kframe = (struct iwmmxt_sigframe *)((unsigned long)(kbuf + 8) & ~7);
 	kframe->magic = IWMMXT_MAGIC;
 	kframe->size = IWMMXT_STORAGE_SIZE;
-	iwmmxt_task_copy(current_thread_info(), &kframe->storage);
+	if (test_thread_flag(TIF_USING_IWMMXT))
+		iwmmxt_task_copy(current_thread_info(), &kframe->storage);
+	else
+		memset(&kframe->storage, 0, sizeof(kframe->storage));
 	return __copy_to_user(frame, kframe, sizeof(*frame));
 }
 
@@ -429,7 +432,7 @@ setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set)
 		err |= preserve_crunch_context(&aux->crunch);
 #endif
 #ifdef CONFIG_IWMMXT
-	if (err == 0 && test_thread_flag(TIF_USING_IWMMXT))
+	if (err == 0)
 		err |= preserve_iwmmxt_context(&aux->iwmmxt);
 #endif
 #ifdef CONFIG_VFP

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-10-18  1:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-14 14:09 iwmmxt signal frame handling Arnd Bergmann
2010-10-15  4:15 ` Nicolas Pitre
2010-10-15  9:17 ` Eric Miao
2010-10-15 13:32   ` Eric Miao
2010-10-15 13:40     ` Arnd Bergmann
2010-10-15 15:19       ` Eric Miao
2010-10-15 18:46         ` Nicolas Pitre
2010-10-18  1:37         ` Haojian Zhuang
2010-10-15 18:38       ` Nicolas Pitre
2010-10-15 20:22         ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox