Re: [PATCH] compat: add compat functions for *at syscalls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 06 Feb 2006 16:01:40 -0800 (PST) "David S. Miller" <[email protected]> wrote:
>
> I do the sign extension with tiny stubs in arch/sparc64/kernel/sys32.S
> so that the arg frobbing does not consume a stack frame, which is what
> happens if you do this in C code.

In which case you need to to stubs for all the *at syscalls.

> We need to revisit this at some point and make a way for all
> compat platforms to do this with a portable table of some kind
> that expands a bunch of macros defined by the platform.

*If* we do get is_compat_task(), what would be you reaction to something
like this:

diff --git a/fs/namei.c b/fs/namei.c
index faf61c3..83d6cd1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1877,6 +1877,8 @@ asmlinkage long sys_mkdirat(int dfd, con
 	int error = 0;
 	char * tmp;
 
+	if (is_compat_task())
+		dfd = compat_sign_extend(dfd);
 	tmp = getname(pathname);
 	error = PTR_ERR(tmp);
 	if (!IS_ERR(tmp)) {
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f9ca534..e6c9db6 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -162,4 +162,10 @@ int get_compat_sigevent(struct sigevent 
 		const struct compat_sigevent __user *u_event);
 
 #endif /* CONFIG_COMPAT */
+
+static inline int compat_sign_extend(long i)
+{
+	return i;
+}
+
 #endif /* _LINUX_COMPAT_H */

On powerpc64, this is sufficient to get the 32 to 64 bit sign extension
we need done in place.
-- 
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux