[v2] Move some chown / lchown / fchown definitions to syscalls.list (bug 14138)

Message ID Pine.LNX.4.64.1410062320010.25827@digraph.polyomino.org.uk
State Committed
Headers

Commit Message

Joseph Myers Oct. 6, 2014, 11:22 p.m. UTC
  (This is an updated version of
<https://sourceware.org/ml/libc-alpha/2014-09/msg00546.html>, for the
architectures for which that has not been reviewed, combined with the
parts of <https://sourceware.org/ml/libc-alpha/2014-09/msg00559.html>
related to chown for those architectures.  I've committed the reviewed
parts of the first patch and the parts of the second patch not
depending on unreviewed parts of the first.  i386, s390, sh and sparc
changes have not been reviewed so far.)

Continuing the move of syscall definitions to syscalls.list, where the
removal of support for old kernel versions has made this possible,
this patch moves various definitions of chown, lchown and fchown.

In most cases the need for special syscalls.list entries (rather than
existing generic ones) is because these architectures use chown32,
lchown32 and fchown32 as syscall names.  Some architectures also have
symbol versioning compatibility for older versions of chown having
been equivalent to lchown.

The aliases specified for s390-32 had the effect of exporting
__chown@@GLIBC_2.1 (but not __chown@GLIBC_2.0) despite it not being
listed in Versions files.  (I'm not sure why versioned_symbol but not
compat_symbol were effective like that to create such __chown exports
in the absence of Versions entries.)  The natural way to preserve that
versioned export of __chown seems to be to add it in a Versions file,
so I did so.  (Maybe actually it should be a compat symbol,
__chown@GLIBC_2.1, unless there's a good reason for that export, but
this patch doesn't change anything there.)

Tested for x86.

2014-10-06  Joseph Myers  <joseph@codesourcery.com>

	[BZ #14138]
	* sysdeps/unix/sysv/linux/i386/chown.c: Remove file.
	* sysdeps/unix/sysv/linux/i386/fchown.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/lchown.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/chown.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/fchown.c: Remove file.
	* sysdeps/unix/sysv/linux/s390/s390-32/lchown.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/chown.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/fchown.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/lchown.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/chown.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/Versions (GLIBC_2.1): Add
	__chown.
	* sysdeps/unix/sysv/linux/i386/syscalls.list (chown): Add syscall.
	(lchown): Likewise.
	(fchown): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (chown):
	Likewise.
	(lchown): Likewise.
	(fchown): Likewise.
	* sysdeps/unix/sysv/linux/sh/syscalls.list (chown): Likewise.
	(lchown): Likewise.
	(fchown): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list (chown):
	Likewise.
	(lchown): Likewise.
	(fchown): Likewise.
  

Comments

Stefan Liebler Oct. 7, 2014, 1:03 p.m. UTC | #1
Hi,

i have tested this patch on s390.
Before this patch, the symbol lchown@@GLIBC_2.0 was weak. Now it is global.
Changing the corresponding line in syscalls.list to
"lchown        -    lchown32    i:sii    __lchown    lchown chown@GLIBC_2.0"
leads to the weak symbol.

Bye
Stefan

On 10/07/2014 01:22 AM, Joseph S. Myers wrote:
> (This is an updated version of
> <https://sourceware.org/ml/libc-alpha/2014-09/msg00546.html>, for the
> architectures for which that has not been reviewed, combined with the
> parts of <https://sourceware.org/ml/libc-alpha/2014-09/msg00559.html>
> related to chown for those architectures.  I've committed the reviewed
> parts of the first patch and the parts of the second patch not
> depending on unreviewed parts of the first.  i386, s390, sh and sparc
> changes have not been reviewed so far.)
>
> Continuing the move of syscall definitions to syscalls.list, where the
> removal of support for old kernel versions has made this possible,
> this patch moves various definitions of chown, lchown and fchown.
>
> In most cases the need for special syscalls.list entries (rather than
> existing generic ones) is because these architectures use chown32,
> lchown32 and fchown32 as syscall names.  Some architectures also have
> symbol versioning compatibility for older versions of chown having
> been equivalent to lchown.
>
> The aliases specified for s390-32 had the effect of exporting
> __chown@@GLIBC_2.1 (but not __chown@GLIBC_2.0) despite it not being
> listed in Versions files.  (I'm not sure why versioned_symbol but not
> compat_symbol were effective like that to create such __chown exports
> in the absence of Versions entries.)  The natural way to preserve that
> versioned export of __chown seems to be to add it in a Versions file,
> so I did so.  (Maybe actually it should be a compat symbol,
> __chown@GLIBC_2.1, unless there's a good reason for that export, but
> this patch doesn't change anything there.)
>
> Tested for x86.
  
Joseph Myers Oct. 7, 2014, 4:38 p.m. UTC | #2
On Tue, 7 Oct 2014, Stefan Liebler wrote:

> Hi,
> 
> i have tested this patch on s390.
> Before this patch, the symbol lchown@@GLIBC_2.0 was weak. Now it is global.
> Changing the corresponding line in syscalls.list to
> "lchown        -    lchown32    i:sii    __lchown    lchown chown@GLIBC_2.0"
> leads to the weak symbol.

That syscalls.list line you give won't work (with the current 
make-syscalls.sh) because if any symbol versions are given, the symbol is 
treated as shared-only unless some @@ version is given.  That is, it would 
result in lchown being missing from the static libc.

You don't say if you see any ABI test failures, or just a change in a 
symbol from weak to non-weak.  As long as there aren't any ABI test 
failures, I don't believe the change in question is a problem.

The reason names such as lchown need to be weak aliases is for the 
following combination of circumstances:

(a) a program uses only interfaces in a standard that does not include 
lchown;

(b) that program defines its own symbol called lchown, which may have no 
relation to glibc's;

(c) one of the glibc interfaces the program uses is implemented in a way 
that uses __lchown internally;

(d) the lchown alias to __lchown now conflicts with the program's own 
definition of lchown.

But this is generally only a problem for static linking.  And for 
non-SHARED, versioned_symbol is defined to weak_alias, so you should find 
that lchown in static libc.a is still a weak symbol after my patch.  In 
shared libc, it shouldn't matter whether lchown is strong or weak; either 
way, it won't conflict with a symbol called lchown in the user's program 
and calls to __lchown from within libc will go to the right place.

In shared libc, it should only matter whether a symbol is weak if it's one 
of a limited number of symbols the user's program is actually allowed to 
override with the intention that the user's version of the symbol gets 
used in libc - for the vast bulk of libc symbols, the rule is that if the 
user defines their own symbol with that name, then behavior is undefined 
if the user also uses any libc symbol from a standard containing the 
symbol they defined, and otherwise the two definitions won't interfere.
  
Joseph Myers Oct. 13, 2014, 11:34 a.m. UTC | #3
Ping.  This patch 
<https://sourceware.org/ml/libc-alpha/2014-10/msg00149.html> is pending 
review.
  
Joseph Myers Oct. 20, 2014, 3:28 p.m. UTC | #4
Ping^2.  This patch 
<https://sourceware.org/ml/libc-alpha/2014-10/msg00149.html> is still 
pending review.
  
Stefan Liebler Oct. 21, 2014, 6:46 a.m. UTC | #5
Hi Joseph,

there are no ABI test failures on s390/s390x. There is the mentioned 
change from weak to non-weak in libc.so. In libc.a the lchown symbol is 
weak as you said.

Thanks.
Bye

On 10/07/2014 06:38 PM, Joseph S. Myers wrote:
> On Tue, 7 Oct 2014, Stefan Liebler wrote:
>
>> Hi,
>>
>> i have tested this patch on s390.
>> Before this patch, the symbol lchown@@GLIBC_2.0 was weak. Now it is global.
>> Changing the corresponding line in syscalls.list to
>> "lchown        -    lchown32    i:sii    __lchown    lchown chown@GLIBC_2.0"
>> leads to the weak symbol.
>
> That syscalls.list line you give won't work (with the current
> make-syscalls.sh) because if any symbol versions are given, the symbol is
> treated as shared-only unless some @@ version is given.  That is, it would
> result in lchown being missing from the static libc.
>
> You don't say if you see any ABI test failures, or just a change in a
> symbol from weak to non-weak.  As long as there aren't any ABI test
> failures, I don't believe the change in question is a problem.
>
> The reason names such as lchown need to be weak aliases is for the
> following combination of circumstances:
>
> (a) a program uses only interfaces in a standard that does not include
> lchown;
>
> (b) that program defines its own symbol called lchown, which may have no
> relation to glibc's;
>
> (c) one of the glibc interfaces the program uses is implemented in a way
> that uses __lchown internally;
>
> (d) the lchown alias to __lchown now conflicts with the program's own
> definition of lchown.
>
> But this is generally only a problem for static linking.  And for
> non-SHARED, versioned_symbol is defined to weak_alias, so you should find
> that lchown in static libc.a is still a weak symbol after my patch.  In
> shared libc, it shouldn't matter whether lchown is strong or weak; either
> way, it won't conflict with a symbol called lchown in the user's program
> and calls to __lchown from within libc will go to the right place.
>
> In shared libc, it should only matter whether a symbol is weak if it's one
> of a limited number of symbols the user's program is actually allowed to
> override with the intention that the user's version of the symbol gets
> used in libc - for the vast bulk of libc symbols, the rule is that if the
> user defines their own symbol with that name, then behavior is undefined
> if the user also uses any libc symbol from a standard containing the
> symbol they defined, and otherwise the two definitions won't interfere.
>
  
Mike Frysinger Oct. 24, 2014, 1:57 a.m. UTC | #6
lgtm, albeit i'm not the arch maintainer for any of those four
-mike
  
Kaz Kojima Oct. 24, 2014, 4:16 a.m. UTC | #7
"Joseph S. Myers" <joseph@codesourcery.com> wrote:
> Ping^2.  This patch 
> <https://sourceware.org/ml/libc-alpha/2014-10/msg00149.html> is still 
> pending review.

Works fine on SH.  Sorry for not replying sooner.

Regards,
	kaz
  

Patch

diff --git a/sysdeps/unix/sysv/linux/i386/chown.c b/sysdeps/unix/sysv/linux/i386/chown.c
deleted file mode 100644
index 4f63b2c..0000000
--- a/sysdeps/unix/sysv/linux/i386/chown.c
+++ /dev/null
@@ -1,67 +0,0 @@ 
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <shlib-compat.h>
-
-#include <linux/posix_types.h>
-
-/*
-  In Linux 2.1.x the chown functions have been changed.  A new function lchown
-  was introduced.  The new chown now follows symlinks - the old chown and the
-  new lchown do not follow symlinks.
-  The new lchown function has the same number as the old chown had and the
-  new chown has a new number.  When compiling with headers from Linux > 2.1.8x
-  it's impossible to run this libc with older kernels.  In these cases libc
-  has therefore to route calls to chown to the old chown function.
-*/
-
-extern int __chown_is_lchown (const char *__file, uid_t __owner,
-			      gid_t __group);
-extern int __real_chown (const char *__file, uid_t __owner, gid_t __group);
-
-
-/* Consider moving to syscalls.list.  */
-
-int
-__real_chown (const char *file, uid_t owner, gid_t group)
-{
-  return INLINE_SYSCALL (chown32, 3, file, owner, group);
-}
-
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
-/* Compiling for compatibility.  */
-int
-attribute_compat_text_section
-__chown_is_lchown (const char *file, uid_t owner, gid_t group)
-{
-  return __lchown (file, owner, group);
-}
-#endif
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
-compat_symbol (libc, __chown_is_lchown, chown, GLIBC_2_0);
-#endif
-
-versioned_symbol (libc, __real_chown, chown, GLIBC_2_1);
-strong_alias (__real_chown, __chown)
-libc_hidden_def (__chown)
diff --git a/sysdeps/unix/sysv/linux/i386/fchown.c b/sysdeps/unix/sysv/linux/i386/fchown.c
deleted file mode 100644
index 7fbfd93..0000000
--- a/sysdeps/unix/sysv/linux/i386/fchown.c
+++ /dev/null
@@ -1,34 +0,0 @@ 
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-#include <linux/posix_types.h>
-
-/* Consider moving to syscalls.list.  */
-
-int
-__fchown (int fd, uid_t owner, gid_t group)
-{
-  return INLINE_SYSCALL (fchown32, 3, fd, owner, group);
-}
-
-weak_alias (__fchown, fchown)
diff --git a/sysdeps/unix/sysv/linux/i386/lchown.c b/sysdeps/unix/sysv/linux/i386/lchown.c
deleted file mode 100644
index cfa7e97..0000000
--- a/sysdeps/unix/sysv/linux/i386/lchown.c
+++ /dev/null
@@ -1,34 +0,0 @@ 
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-#include <linux/posix_types.h>
-
-/* Consider moving to syscalls.list.  */
-
-int
-__lchown (const char *file, uid_t owner, gid_t group)
-{
-  return INLINE_SYSCALL (lchown32, 3, file, owner, group);
-}
-
-weak_alias (__lchown, lchown)
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index 0d3eabe..db375a8 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -1,5 +1,9 @@ 
 # File name	Caller	Syscall name	Args	Strong name	Weak names
 
+chown		-	chown32		i:sii	__chown		chown@@GLIBC_2.1
+lchown		-	lchown32	i:sii	__lchown	lchown@@GLIBC_2.0 chown@GLIBC_2.0
+fchown		-	fchown32	i:iii	__fchown	fchown
+
 modify_ldt	EXTRA	modify_ldt	i:ipi	__modify_ldt	modify_ldt
 vm86old		EXTRA	vm86old		i:p	__vm86old	vm86@GLIBC_2.0
 vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
index 24e0b1d4..1c120e8 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/Versions
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
@@ -4,6 +4,9 @@  libc {
     __register_frame; __register_frame_table; __deregister_frame;
     __frame_state_for; __register_frame_info_table;
   }
+  GLIBC_2.1 {
+    __chown;
+  }
   GLIBC_2.2 {
     # functions used in other libraries
     __xstat64; __fxstat64; __lxstat64;
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
deleted file mode 100644
index 1fee84a..0000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
+++ /dev/null
@@ -1,71 +0,0 @@ 
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <shlib-compat.h>
-
-#include <linux/posix_types.h>
-
-/*
-  In Linux 2.1.x the chown functions have been changed.  A new function lchown
-  was introduced.  The new chown now follows symlinks - the old chown and the
-  new lchown do not follow symlinks.
-  The new lchown function has the same number as the old chown had and the
-  new chown has a new number.  When compiling with headers from Linux > 2.1.8x
-  it's impossible to run this libc with older kernels.  In these cases libc
-  has therefore to route calls to chown to the old chown function.
-*/
-
-/* Running under Linux > 2.1.80.  */
-
-/* Consider moving to syscalls.list.  */
-
-int
-__real_chown (const char *file, uid_t owner, gid_t group)
-{
-  return INLINE_SYSCALL (chown32, 3, file, owner, group);
-}
-
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
-/* Compiling for compatibility.  */
-int
-attribute_compat_text_section
-__chown_is_lchown (const char *file, uid_t owner, gid_t group)
-{
-  return __lchown (file, owner, group);
-}
-#endif
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
-strong_alias (__chown_is_lchown, _chown_is_lchown)
-compat_symbol (libc, __chown_is_lchown, __chown, GLIBC_2_0);
-compat_symbol (libc, _chown_is_lchown, chown, GLIBC_2_0);
-
-strong_alias (__real_chown, _real_chown)
-versioned_symbol (libc, __real_chown, __chown, GLIBC_2_1);
-versioned_symbol (libc, _real_chown, chown, GLIBC_2_1);
-libc_hidden_ver (__real_chown, __chown)
-#else
-strong_alias (__real_chown, __chown)
-libc_hidden_def (__chown)
-weak_alias (__real_chown, chown)
-#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/fchown.c
deleted file mode 100644
index 3a69ecc..0000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/fchown.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
deleted file mode 100644
index cfa7e97..0000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
+++ /dev/null
@@ -1,34 +0,0 @@ 
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-#include <linux/posix_types.h>
-
-/* Consider moving to syscalls.list.  */
-
-int
-__lchown (const char *file, uid_t owner, gid_t group)
-{
-  return INLINE_SYSCALL (lchown32, 3, file, owner, group);
-}
-
-weak_alias (__lchown, lchown)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
index 902491c..7a6015a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
@@ -1,5 +1,9 @@ 
 # File name	Caller	Syscall name	Args	Strong name	Weak names
 
+chown		-	chown32		i:sii	__chown		chown@@GLIBC_2.1
+lchown		-	lchown32	i:sii	__lchown	lchown@@GLIBC_2.0 chown@GLIBC_2.0
+fchown		-	fchown32	i:iii	__fchown	fchown
+
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
 setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit@GLIBC_2.0 setrlimit@@GLIBC_2.2
 
diff --git a/sysdeps/unix/sysv/linux/sh/chown.c b/sysdeps/unix/sysv/linux/sh/chown.c
deleted file mode 100644
index 27be894..0000000
--- a/sysdeps/unix/sysv/linux/sh/chown.c
+++ /dev/null
@@ -1,34 +0,0 @@ 
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-#include <linux/posix_types.h>
-
-/* Consider moving to syscalls.list.  */
-
-int
-__chown (const char *file, uid_t owner, gid_t group)
-{
-  return INLINE_SYSCALL (chown32, 3, file, owner, group);
-}
-libc_hidden_def (__chown)
-weak_alias (__chown, chown)
diff --git a/sysdeps/unix/sysv/linux/sh/fchown.c b/sysdeps/unix/sysv/linux/sh/fchown.c
deleted file mode 100644
index 3a69ecc..0000000
--- a/sysdeps/unix/sysv/linux/sh/fchown.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/sh/lchown.c b/sysdeps/unix/sysv/linux/sh/lchown.c
deleted file mode 100644
index c89de99..0000000
--- a/sysdeps/unix/sysv/linux/sh/lchown.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/sh/syscalls.list b/sysdeps/unix/sysv/linux/sh/syscalls.list
index faffe37..899d4e7 100644
--- a/sysdeps/unix/sysv/linux/sh/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sh/syscalls.list
@@ -1,5 +1,9 @@ 
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
+chown		-	chown32		i:sii	__chown		chown
+lchown		-	lchown32	i:sii	__lchown	lchown
+fchown		-	fchown32	i:iii	__fchown	fchown
+
 waitpid		-	waitpid		Ci:ipi	__waitpid	waitpid	__libc_waitpid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c b/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
deleted file mode 100644
index 3741316..0000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/sh/chown.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c b/sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c
deleted file mode 100644
index 3a69ecc..0000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c b/sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c
deleted file mode 100644
index c89de99..0000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
index 3d70185..e71a044 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
@@ -1,5 +1,9 @@ 
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
+chown		-	chown32		i:sii	__chown		chown
+lchown		-	lchown32	i:sii	__lchown	lchown
+fchown		-	fchown32	i:iii	__fchown	fchown
+
 setrlimit	-	setrlimit	2	__setrlimit	setrlimit
 getrlimit	-	getrlimit	2	__getrlimit	getrlimit
 getresuid	-	getresuid32	3	getresuid