From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: iwmmxt signal frame handling
Date: Thu, 14 Oct 2010 16:09:10 +0200 [thread overview]
Message-ID: <201010141609.10889.arnd@arndb.de> (raw)
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
next reply other threads:[~2010-10-14 14:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 14:09 Arnd Bergmann [this message]
2010-10-15 4:15 ` iwmmxt signal frame handling 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201010141609.10889.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.