linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] flags parameter for linkat
@ 2006-02-23 14:10 Ulrich Drepper
  2006-02-23 14:19 ` David Vrabel
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ulrich Drepper @ 2006-02-23 14:10 UTC (permalink / raw)
  To: akpm, linux-kernel, torvalds

I'm currently at the POSIX meeting and one thing covered was the
incompatibility of Linux's link() with the POSIX definition.  The
difference is the treatment of symbolic links in the destination
name.  Linux does not follow symlinks, POSIX requires it does.

Even somebody thinks this is a good default behavior we cannot
change this because it would break the ABI.  But the fact remains
that some application might want this behavior.

We have one chance to help implementing this without breaking the
behavior.  For this we could use the new linkat interface which
would need a new flags parameter.  If the new parameter is
AT_SYMLINK_FOLLOW the new behavior could be invoked.

I do not want to introduce such a patch now.  But we could add the
parameter now, just don't use it.  The patch below would do this.
Can we get this late patch applied before the release more or less
fixes the syscall API?

Signed-Off-By: Ulrich Drepper <drepper@redhat.com>


--- fs/namei.c	2006-02-23 05:51:45.000000000 -0800
+++ fs/namei.c-new	2006-02-23 05:58:31.000000000 -0800
@@ -2232,13 +2232,17 @@
  * and other special files.  --ADM
  */
 asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
-			   int newdfd, const char __user *newname)
+			   int newdfd, const char __user *newname,
+			   int flags)
 {
 	struct dentry *new_dentry;
 	struct nameidata nd, old_nd;
 	int error;
 	char * to;
 
+	if (flags != 0)
+		return -EINVAL;
+
 	to = getname(newname);
 	if (IS_ERR(to))
 		return PTR_ERR(to);
@@ -2271,7 +2275,7 @@
 
 asmlinkage long sys_link(const char __user *oldname, const char __user *newname)
 {
-	return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname);
+	return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
 }
 
 /*
--- ./arch/s390/kernel/compat_wrapper.S-new	2006-02-23 06:00:12.000000000 -0800
+++ ./arch/s390/kernel/compat_wrapper.S	2006-02-23 05:51:32.000000000 -0800
@@ -1552,7 +1552,6 @@
 	llgtr	%r3,%r3			# const char *
 	lgfr	%r4,%r4			# int
 	llgtr	%r5,%r5			# const char *
-	lgfr	%r6,%r6			# int
 	jg	sys_linkat
 
 	.globl sys_symlinkat_wrapper

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

* Re: [PATCH] flags parameter for linkat
  2006-02-23 14:10 [PATCH] flags parameter for linkat Ulrich Drepper
@ 2006-02-23 14:19 ` David Vrabel
  2006-02-23 20:26 ` Ralf Baechle
  2006-02-25  9:16 ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: David Vrabel @ 2006-02-23 14:19 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: akpm, linux-kernel, torvalds

Ulrich Drepper wrote:
> 
> --- ./arch/s390/kernel/compat_wrapper.S-new	2006-02-23 06:00:12.000000000 -0800
> +++ ./arch/s390/kernel/compat_wrapper.S	2006-02-23 05:51:32.000000000 -0800
> @@ -1552,7 +1552,6 @@
>  	llgtr	%r3,%r3			# const char *
>  	lgfr	%r4,%r4			# int
>  	llgtr	%r5,%r5			# const char *
> -	lgfr	%r6,%r6			# int
>  	jg	sys_linkat

This hunk appears to be reversed.

David Vrabel

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

* Re: [PATCH] flags parameter for linkat
  2006-02-23 14:10 [PATCH] flags parameter for linkat Ulrich Drepper
  2006-02-23 14:19 ` David Vrabel
@ 2006-02-23 20:26 ` Ralf Baechle
  2006-02-25  9:16 ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2006-02-23 20:26 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: akpm, linux-kernel, torvalds

On Thu, Feb 23, 2006 at 09:10:22AM -0500, Ulrich Drepper wrote:

> I'm currently at the POSIX meeting and one thing covered was the
> incompatibility of Linux's link() with the POSIX definition.  The
> difference is the treatment of symbolic links in the destination
> name.  Linux does not follow symlinks, POSIX requires it does.
> 
> Even somebody thinks this is a good default behavior we cannot
> change this because it would break the ABI.  But the fact remains
> that some application might want this behavior.
> 
> We have one chance to help implementing this without breaking the
> behavior.  For this we could use the new linkat interface which
> would need a new flags parameter.  If the new parameter is
> AT_SYMLINK_FOLLOW the new behavior could be invoked.
> 
> I do not want to introduce such a patch now.  But we could add the
> parameter now, just don't use it.  The patch below would do this.
> Can we get this late patch applied before the release more or less
> fixes the syscall API?

The number of arguments changes, so below patch would be needed for
32-bit MIPS.

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index d83e033..2f2dc54 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -626,7 +626,7 @@ einval:	li	v0, -EINVAL
 	sys	sys_fstatat64		4
 	sys	sys_unlinkat		3
 	sys	sys_renameat		4	/* 4295 */
-	sys	sys_linkat		4
+	sys	sys_linkat		5
 	sys	sys_symlinkat		3
 	sys	sys_readlinkat		4
 	sys	sys_fchmodat		3

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

* Re: [PATCH] flags parameter for linkat
  2006-02-23 14:10 [PATCH] flags parameter for linkat Ulrich Drepper
  2006-02-23 14:19 ` David Vrabel
  2006-02-23 20:26 ` Ralf Baechle
@ 2006-02-25  9:16 ` Christoph Hellwig
  2006-02-25 10:13   ` Al Viro
  2 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2006-02-25  9:16 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: akpm, linux-kernel, torvalds

On Thu, Feb 23, 2006 at 09:10:22AM -0500, Ulrich Drepper wrote:
> I'm currently at the POSIX meeting and one thing covered was the
> incompatibility of Linux's link() with the POSIX definition.  The
> difference is the treatment of symbolic links in the destination
> name.  Linux does not follow symlinks, POSIX requires it does.
> 
> Even somebody thinks this is a good default behavior we cannot
> change this because it would break the ABI.  But the fact remains
> that some application might want this behavior.
> 
> We have one chance to help implementing this without breaking the
> behavior.  For this we could use the new linkat interface which
> would need a new flags parameter.  If the new parameter is
> AT_SYMLINK_FOLLOW the new behavior could be invoked.
> 
> I do not want to introduce such a patch now.  But we could add the
> parameter now, just don't use it.  The patch below would do this.
> Can we get this late patch applied before the release more or less
> fixes the syscall API?

Please stop adding these crappy flags argument everywhere, they're also
creaping like a cancer through the other *at stuff.  Just make linkat
do the righ thing per posix spec for link, and then you can implement
a posix link based on it in glibc if the user compiles with XOPEN_SOURCE
or whatever.

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

* Re: [PATCH] flags parameter for linkat
  2006-02-25  9:16 ` Christoph Hellwig
@ 2006-02-25 10:13   ` Al Viro
  0 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2006-02-25 10:13 UTC (permalink / raw)
  To: Christoph Hellwig, Ulrich Drepper, akpm, linux-kernel, torvalds

On Sat, Feb 25, 2006 at 09:16:07AM +0000, Christoph Hellwig wrote:
> Please stop adding these crappy flags argument everywhere, they're also
> creaping like a cancer through the other *at stuff.  Just make linkat
> do the righ thing per posix spec for link, and then you can implement
> a posix link based on it in glibc if the user compiles with XOPEN_SOURCE
> or whatever.

It's a bloody bad idea, since XOPEN_SOURCE is nowhere near fine-grained
enough and could be forced by any number of things.

The _real_ issue with flags is the lack of filtering.  I.e. we blindly
pass userland argument there, exposing both internal flag values _and_
flags that really shouldn't be exposed that way at all.

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

end of thread, other threads:[~2006-02-25 10:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-23 14:10 [PATCH] flags parameter for linkat Ulrich Drepper
2006-02-23 14:19 ` David Vrabel
2006-02-23 20:26 ` Ralf Baechle
2006-02-25  9:16 ` Christoph Hellwig
2006-02-25 10:13   ` Al Viro

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