linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] truncate()/ftruncate() fix length argument on ia32 emulation.
@ 2011-09-17 18:01 Thomas Meyer
  2011-09-18 15:26 ` Arnd Bergmann
  2011-09-19 13:16 ` Heiko Carstens
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Meyer @ 2011-09-17 18:01 UTC (permalink / raw)
  To: Linux Kernel Mailing List, linux-arch

move signed-extended int to long, because of signed test.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 arch/x86/ia32/ia32entry.S |    4 ++--
 fs/compat.c               |   10 ++++++++++
 include/linux/compat.h    |    2 ++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 30f4116..074b9d3 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -595,8 +595,8 @@ ia32_sys_call_table:
 	.quad compat_sys_old_readdir
 	.quad sys32_mmap		/* 90 */
 	.quad sys_munmap
-	.quad sys_truncate
-	.quad sys_ftruncate
+	.quad compat_sys_truncate
+	.quad compat_sys_ftruncate
 	.quad sys_fchmod
 	.quad sys_fchown16		/* 95 */
 	.quad sys_getpriority
diff --git a/fs/compat.c b/fs/compat.c
index 232675e..315ea2d 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1814,3 +1814,13 @@ compat_sys_open_by_handle_at(int mountdirfd,
 	return do_handle_open(mountdirfd, handle, flags);
 }
 #endif
+
+asmlinkage long compat_sys_truncate(const char __user *path, int length)
+{
+	return sys_truncate(path, length);
+}
+
+asmlinkage long compat_sys_ftruncate(unsigned int fd, int length)
+{
+	return sys_ftruncate(fd, length);
+}
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 3bfb30a..7a3b0e7 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -544,6 +544,8 @@ asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
 			const struct compat_timespec __user *u_abs_timeout);
 asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
 asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args);
+asmlinkage long compat_sys_truncate(const char __user *path, int length);
+asmlinkage long compat_sys_ftruncate(unsigned int fd, int length);
 
 extern ssize_t compat_rw_copy_check_uvector(int type,
 		const struct compat_iovec __user *uvector,
-- 
1.7.6

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

* Re: [PATCH 3/3] truncate()/ftruncate() fix length argument on ia32 emulation.
  2011-09-17 18:01 [PATCH 3/3] truncate()/ftruncate() fix length argument on ia32 emulation Thomas Meyer
@ 2011-09-18 15:26 ` Arnd Bergmann
  2011-09-19 13:16 ` Heiko Carstens
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2011-09-18 15:26 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: Linux Kernel Mailing List, linux-arch

On Saturday 17 September 2011 20:01:17 Thomas Meyer wrote:
> move signed-extended int to long, because of signed test.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

I would expect that the same is needed on ia64 and parisc and mips.
powerpc, s390 and sparc probably don't need it because they
have architecture specific code that already does this, but you
can probably remove the powerpc version if you add a generic
one.

New architectures (including tile) won't need the wrapper because
the 32-bit ABI there only has truncate64.

	Arnd

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

* Re: [PATCH 3/3] truncate()/ftruncate() fix length argument on ia32 emulation.
  2011-09-17 18:01 [PATCH 3/3] truncate()/ftruncate() fix length argument on ia32 emulation Thomas Meyer
  2011-09-18 15:26 ` Arnd Bergmann
@ 2011-09-19 13:16 ` Heiko Carstens
  1 sibling, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2011-09-19 13:16 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: Linux Kernel Mailing List, linux-arch

On Sat, Sep 17, 2011 at 08:01:17PM +0200, Thomas Meyer wrote:
> move signed-extended int to long, because of signed test.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

[...]

> +asmlinkage long compat_sys_ftruncate(unsigned int fd, int length)
> +{
> +	return sys_ftruncate(fd, length);
> +}

That seems to be wrong... just look at this patch I sent two years
ago (which btw. introduced the compat truncate sign extension bug
on some architecutures).

http://www.spinics.net/lists/linux-arch/msg08633.html

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

end of thread, other threads:[~2011-09-19 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-17 18:01 [PATCH 3/3] truncate()/ftruncate() fix length argument on ia32 emulation Thomas Meyer
2011-09-18 15:26 ` Arnd Bergmann
2011-09-19 13:16 ` Heiko Carstens

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).