mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: "David S. Miller" <davem@davemloft.net>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, torvalds@osdl.org,
	ak@suse.de
Subject: Re: [PATCH] compat: add compat functions for *at syscalls
Date: Tue, 7 Feb 2006 11:27:13 +1100	[thread overview]
Message-ID: <20060207112713.7cd0a61c.sfr@canb.auug.org.au> (raw)
In-Reply-To: <20060206.160140.59716704.davem@davemloft.net>

On Mon, 06 Feb 2006 16:01:40 -0800 (PST) "David S. Miller" <davem@davemloft.net> 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                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

  reply	other threads:[~2006-02-07  0:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-06 23:56 Stephen Rothwell
2006-02-07  0:01 ` David S. Miller
2006-02-07  0:27   ` Stephen Rothwell [this message]
2006-02-07  1:15     ` Linus Torvalds
2006-02-07  8:44       ` David S. Miller
2006-02-07  8:43     ` David S. Miller
2006-02-07  9:39       ` Andi Kleen
2006-02-07 10:56         ` David S. Miller
2006-02-07  6:40   ` Stephen Rothwell
2006-02-07  9:31     ` Heiko Carstens
2006-02-07 13:29       ` Heiko Carstens
2006-02-07 22:57         ` David S. Miller
2006-02-07  9:25   ` Andi Kleen

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=20060207112713.7cd0a61c.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®