From: David Miller <davem@davemloft.net>
To: sparclinux@vger.kernel.org
Subject: Re: Unaligned accesses in compat_sys_msgrcv and sys_msgrcv
Date: Mon, 23 Oct 2006 04:54:19 +0000 [thread overview]
Message-ID: <20061022.215419.74747802.davem@davemloft.net> (raw)
In-Reply-To: <20061021041107.GA4629@droopy.oc.cox.net>
From: Jurij Smakov <jurij@wooyd.org>
Date: Fri, 20 Oct 2006 21:11:08 -0700
> p = compat_alloc_user_space(second + sizeof(struct msgbuf));
Thanks again for this report Jurij, this patch should fix it up.
commit a94b1d1fd7ca3129e1d38d38167779fa6ee69780
Author: David S. Miller <davem@sunset.davemloft.net>
Date: Sun Oct 22 21:53:30 2006 -0700
[SPARC64]: 8-byte align return value from compat_alloc_user_space()
Otherwise we get a ton of unaligned exceptions, for cases such
as compat_sys_msgrcv() which go:
p = compat_alloc_user_space(second + sizeof(struct msgbuf));
and here 'second' can for example be an arbitrary odd value.
Based upon a bug report from Jurij Smakov.
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h
index c73935d..36511ca 100644
--- a/include/asm-sparc64/compat.h
+++ b/include/asm-sparc64/compat.h
@@ -164,7 +164,7 @@ static inline compat_uptr_t ptr_to_compa
return (u32)(unsigned long)uptr;
}
-static __inline__ void __user *compat_alloc_user_space(long len)
+static inline void __user *compat_alloc_user_space(long len)
{
struct pt_regs *regs = current_thread_info()->kregs;
unsigned long usp = regs->u_regs[UREG_I6];
@@ -174,7 +174,10 @@ static __inline__ void __user *compat_al
else
usp &= 0xffffffffUL;
- return (void __user *) (usp - len);
+ usp -= len;
+ usp &= ~0x7UL;
+
+ return (void __user *) usp;
}
struct compat_ipc64_perm {
next prev parent reply other threads:[~2006-10-23 4:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-21 4:11 Unaligned accesses in compat_sys_msgrcv and sys_msgrcv Jurij Smakov
2006-10-21 6:35 ` David Miller
2006-10-23 4:54 ` David Miller [this message]
2006-10-23 16:52 ` Jurij Smakov
2006-10-23 21:01 ` David Miller
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=20061022.215419.74747802.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=sparclinux@vger.kernel.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.