From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Thorsten Glaser <tg@debian.org>,
Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [ 10/12] m68k/atari: ARAnyM - Fix NatFeat module support
Date: Sun, 18 Aug 2013 13:30:19 -0700 [thread overview]
Message-ID: <20130818202951.855698379@linuxfoundation.org> (raw)
In-Reply-To: <20130818202949.875887601@linuxfoundation.org>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <geert@linux-m68k.org>
commit e8184e10f89736a23ea6eea8e24cd524c5c513d2 upstream.
As pointed out by Andreas Schwab, pointers passed to ARAnyM NatFeat calls
should be physical addresses, not virtual addresses.
Fortunately on Atari, physical and virtual kernel addresses are the same,
as long as normal kernel memory is concerned, so this usually worked fine
without conversion.
But for modules, pointers to literal strings are located in vmalloc()ed
memory. Depending on the version of ARAnyM, this causes the nf_get_id()
call to just fail, or worse, crash ARAnyM itself with e.g.
Gotcha! Illegal memory access. Atari PC = $968c
This is a big issue for distro kernels, who want to have all drivers as
loadable modules in an initrd.
Add a wrapper for nf_get_id() that copies the literal to the stack to
work around this issue.
Reported-by: Thorsten Glaser <tg@debian.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/m68k/emu/natfeat.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
--- a/arch/m68k/emu/natfeat.c
+++ b/arch/m68k/emu/natfeat.c
@@ -18,9 +18,11 @@
#include <asm/machdep.h>
#include <asm/natfeat.h>
+extern long nf_get_id2(const char *feature_name);
+
asm("\n"
-" .global nf_get_id,nf_call\n"
-"nf_get_id:\n"
+" .global nf_get_id2,nf_call\n"
+"nf_get_id2:\n"
" .short 0x7300\n"
" rts\n"
"nf_call:\n"
@@ -29,12 +31,25 @@ asm("\n"
"1: moveq.l #0,%d0\n"
" rts\n"
" .section __ex_table,\"a\"\n"
-" .long nf_get_id,1b\n"
+" .long nf_get_id2,1b\n"
" .long nf_call,1b\n"
" .previous");
-EXPORT_SYMBOL_GPL(nf_get_id);
EXPORT_SYMBOL_GPL(nf_call);
+long nf_get_id(const char *feature_name)
+{
+ /* feature_name may be in vmalloc()ed memory, so make a copy */
+ char name_copy[32];
+ size_t n;
+
+ n = strlcpy(name_copy, feature_name, sizeof(name_copy));
+ if (n >= sizeof(name_copy))
+ return 0;
+
+ return nf_get_id2(name_copy);
+}
+EXPORT_SYMBOL_GPL(nf_get_id);
+
void nfprint(const char *fmt, ...)
{
static char buf[256];
next prev parent reply other threads:[~2013-08-18 20:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-18 20:30 [ 00/12] 3.0.92-stable review Greg Kroah-Hartman
2013-08-18 20:30 ` [ 01/12] futex: Take hugepages into account when generating futex_key Greg Kroah-Hartman
2013-08-18 20:30 ` [ 02/12] CRIS: Add _sdata to vmlinux.lds.S Greg Kroah-Hartman
2013-08-18 20:30 ` [ 03/12] af_key: initialize satype in key_notify_policy_flush() Greg Kroah-Hartman
2013-08-18 20:30 ` [ 04/12] genetlink: fix family dump race Greg Kroah-Hartman
2013-08-18 20:30 ` [ 05/12] usb: add two quirky touchscreen Greg Kroah-Hartman
2013-08-18 20:30 ` [ 06/12] USB: mos7720: fix broken control requests Greg Kroah-Hartman
2013-08-18 20:30 ` [ 07/12] sparc32: add ucmpdi2 Greg Kroah-Hartman
2013-08-18 20:30 ` [ 08/12] sparc32: Add ucmpdi2.o to obj-y instead of lib-y Greg Kroah-Hartman
2013-08-18 20:30 ` [ 09/12] powerpc: Use -mtraceback=no Greg Kroah-Hartman
2013-08-18 20:30 ` Greg Kroah-Hartman [this message]
2013-08-18 20:30 ` [ 11/12] ARM: 7080/1: l2x0: make sure I&D are not locked down on init Greg Kroah-Hartman
2013-08-18 20:30 ` [ 12/12] vm: add no-mmu vm_iomap_memory() stub Greg Kroah-Hartman
2013-08-18 20:37 ` [ 00/12] 3.0.92-stable review Geert Uytterhoeven
2013-08-18 20:52 ` Greg Kroah-Hartman
2013-08-19 1:39 ` Guenter Roeck
2013-08-19 22:53 ` Shuah Khan
2013-08-19 23:10 ` Greg Kroah-Hartman
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=20130818202951.855698379@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tg@debian.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).