* ppc64 sys_ipc breakage in 2.6.34-rc2
@ 2010-03-22 6:47 Anton Blanchard
2010-03-22 18:00 ` Andreas Schwab
2010-03-22 20:01 ` Christoph Hellwig
0 siblings, 2 replies; 6+ messages in thread
From: Anton Blanchard @ 2010-03-22 6:47 UTC (permalink / raw)
To: Christoph Hellwig, Ralf Baechle, Benjamin Herrenschmidt,
Paul Mundt, Jeff Dike, Hirokazu Takata, Thomas Gleixner,
Ingo Molnar, H. Peter Anvin, Al Viro, Arnd Bergmann,
Heiko Carstens, Martin Schwidefsky, Luck, Tony, James Morris,
Andreas Schwab, Jesper Nilsson, Russell King, David Howells,
Kyle McMartin, Andrew Morton, Linus Torvalds
Cc: linuxppc-dev
I chased down a fail on ppc64 on 2.6.34-rc2 where an application that uses
shared memory was getting a SEGV.
Commit baed7fc9b580bd3fb8252ff1d9b36eaf1f86b670 (Add generic sys_ipc wrapper)
changed the second argument from an unsigned long to an int. When we call
shmget the system call wrappers for sys_ipc will sign extend second (ie the
size) which truncates it. It took a while to track down because the call
succeeds and strace shows the untruncated size :)
The patch below changes second from an int to an unsigned long which fixes
shmget on ppc64 (and I assume s390, sparc64 and mips64).
Signed-off-by: Anton Blanchard <anton@samba.org>
--
I assume the function prototypes for the other IPC methods would cause us
to sign or zero extend second where appropriate (avoiding any security
issues). Come to think of it, the syscall wrappers for each method should do
that for us as well.
diff --git a/ipc/syscall.c b/ipc/syscall.c
index 355a3da..1d6f53f 100644
--- a/ipc/syscall.c
+++ b/ipc/syscall.c
@@ -13,7 +13,7 @@
#include <linux/syscalls.h>
#include <linux/uaccess.h>
-SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, int, second,
+SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
unsigned long, third, void __user *, ptr, long, fifth)
{
int version, ret;
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: ppc64 sys_ipc breakage in 2.6.34-rc2
2010-03-22 6:47 ppc64 sys_ipc breakage in 2.6.34-rc2 Anton Blanchard
@ 2010-03-22 18:00 ` Andreas Schwab
2010-03-22 18:07 ` Linus Torvalds
2010-03-22 20:01 ` Christoph Hellwig
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2010-03-22 18:00 UTC (permalink / raw)
To: Anton Blanchard
Cc: Heiko Carstens, H. Peter Anvin, Christoph Hellwig, Jesper Nilsson,
Hirokazu Takata, James Morris, Russell King, Ingo Molnar,
Arnd Bergmann, Jeff Dike, Al Viro, Thomas Gleixner, Luck, Tony,
Linus Torvalds, Ralf Baechle, Kyle McMartin, Paul Mundt,
Martin Schwidefsky, Andrew Morton, linuxppc-dev
Anton Blanchard <anton@samba.org> writes:
> diff --git a/ipc/syscall.c b/ipc/syscall.c
> index 355a3da..1d6f53f 100644
> --- a/ipc/syscall.c
> +++ b/ipc/syscall.c
> @@ -13,7 +13,7 @@
> #include <linux/syscalls.h>
> #include <linux/uaccess.h>
>
> -SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, int, second,
> +SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
> unsigned long, third, void __user *, ptr, long, fifth)
ipc/syscall.c:17: error: conflicting types for ‘sys_ipc’
include/linux/syscalls.h:691: note: previous declaration of ‘sys_ipc’ was here
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ppc64 sys_ipc breakage in 2.6.34-rc2
2010-03-22 18:00 ` Andreas Schwab
@ 2010-03-22 18:07 ` Linus Torvalds
2010-03-22 19:56 ` Andreas Schwab
2010-03-22 22:01 ` Anton Blanchard
0 siblings, 2 replies; 6+ messages in thread
From: Linus Torvalds @ 2010-03-22 18:07 UTC (permalink / raw)
To: Andreas Schwab
Cc: Heiko Carstens, H. Peter Anvin, Christoph Hellwig, Jesper Nilsson,
Hirokazu Takata, James Morris, Russell King, Ingo Molnar,
Arnd Bergmann, Jeff Dike, Anton Blanchard, Thomas Gleixner,
Luck, Tony, Ralf Baechle, Kyle McMartin, Paul Mundt,
Martin Schwidefsky, Andrew Morton, linuxppc-dev, Al Viro
On Mon, 22 Mar 2010, Andreas Schwab wrote:
>
> ipc/syscall.c:17: error: conflicting types for ‘sys_ipc’
> include/linux/syscalls.h:691: note: previous declaration of ‘sys_ipc’ was here
Hmm. Right you are. Why don't I see this? (I already applied the patch)
Ahh. Because this only triggers with __ARCH_WANT_SYS_IPC. But why didn't
Anton see it then?
Anyway, I assume the following fixes it. Can you verify?
Linus
---
include/linux/syscalls.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index f994ae5..057929b 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -688,7 +688,7 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg);
asmlinkage long sys_shmget(key_t key, size_t size, int flag);
asmlinkage long sys_shmdt(char __user *shmaddr);
asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
-asmlinkage long sys_ipc(unsigned int call, int first, int second,
+asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
unsigned long third, void __user *ptr, long fifth);
asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: ppc64 sys_ipc breakage in 2.6.34-rc2
2010-03-22 18:07 ` Linus Torvalds
@ 2010-03-22 19:56 ` Andreas Schwab
2010-03-22 22:01 ` Anton Blanchard
1 sibling, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2010-03-22 19:56 UTC (permalink / raw)
To: Linus Torvalds
Cc: Heiko Carstens, H. Peter Anvin, Christoph Hellwig, Jesper Nilsson,
Hirokazu Takata, James Morris, Russell King, Ingo Molnar,
Arnd Bergmann, Jeff Dike, Anton Blanchard, Thomas Gleixner,
Luck, Tony, Ralf Baechle, Kyle McMartin, Paul Mundt,
Martin Schwidefsky, Andrew Morton, linuxppc-dev, Al Viro
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Mon, 22 Mar 2010, Andreas Schwab wrote:
>>
>> ipc/syscall.c:17: error: conflicting types for ‘sys_ipc’
>> include/linux/syscalls.h:691: note: previous declaration of ‘sys_ipc’ was here
>
> Hmm. Right you are. Why don't I see this? (I already applied the patch)
>
> Ahh. Because this only triggers with __ARCH_WANT_SYS_IPC. But why didn't
> Anton see it then?
>
> Anyway, I assume the following fixes it. Can you verify?
Yes, this works.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ppc64 sys_ipc breakage in 2.6.34-rc2
2010-03-22 18:07 ` Linus Torvalds
2010-03-22 19:56 ` Andreas Schwab
@ 2010-03-22 22:01 ` Anton Blanchard
1 sibling, 0 replies; 6+ messages in thread
From: Anton Blanchard @ 2010-03-22 22:01 UTC (permalink / raw)
To: Linus Torvalds
Cc: Heiko Carstens, Andreas Schwab, H. Peter Anvin, Christoph Hellwig,
Jesper Nilsson, Hirokazu Takata, James Morris, Russell King,
Ingo Molnar, Arnd Bergmann, Jeff Dike, Al Viro, Thomas Gleixner,
Luck, Tony, Ralf Baechle, Kyle McMartin, Paul Mundt,
Martin Schwidefsky, Andrew Morton, linuxppc-dev
Hi,
> > ipc/syscall.c:17: error: conflicting types for ‘sys_ipc’
> > include/linux/syscalls.h:691: note: previous declaration of ‘sys_ipc’ was here
>
> Hmm. Right you are. Why don't I see this? (I already applied the patch)
>
> Ahh. Because this only triggers with __ARCH_WANT_SYS_IPC. But why didn't
> Anton see it then?
>
> Anyway, I assume the following fixes it. Can you verify?
Sorry, I forgot to quilt add. Stupid screw up, thanks Andreas for catching
it so quickly.
Anton
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ppc64 sys_ipc breakage in 2.6.34-rc2
2010-03-22 6:47 ppc64 sys_ipc breakage in 2.6.34-rc2 Anton Blanchard
2010-03-22 18:00 ` Andreas Schwab
@ 2010-03-22 20:01 ` Christoph Hellwig
1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2010-03-22 20:01 UTC (permalink / raw)
To: Anton Blanchard
Cc: Heiko Carstens, Andreas Schwab, H. Peter Anvin, Christoph Hellwig,
Jesper Nilsson, Hirokazu Takata, James Morris, Russell King,
Ingo Molnar, Arnd Bergmann, Jeff Dike, Al Viro, Thomas Gleixner,
Luck, Tony, linuxppc-dev, Ralf Baechle, Kyle McMartin, Paul Mundt,
Martin Schwidefsky, Andrew Morton, Linus Torvalds
On Mon, Mar 22, 2010 at 05:47:59PM +1100, Anton Blanchard wrote:
> The patch below changes second from an int to an unsigned long which fixes
> shmget on ppc64 (and I assume s390, sparc64 and mips64).
Looks good, except that the prototype in the header also needs to be
adjusted.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-03-22 22:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-22 6:47 ppc64 sys_ipc breakage in 2.6.34-rc2 Anton Blanchard
2010-03-22 18:00 ` Andreas Schwab
2010-03-22 18:07 ` Linus Torvalds
2010-03-22 19:56 ` Andreas Schwab
2010-03-22 22:01 ` Anton Blanchard
2010-03-22 20:01 ` Christoph Hellwig
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).