Re: [PATCH 10/15] misc: Make *[ug]id16 support optional

Zdenek Pavlas
2005-12-20T15:47:36Z

Matt Mackall wrote:

> On Wed, Nov 16, 2005 at 07:21:30AM -0600, Rob Landley wrote:
>>Is there an easy way to make sure our programs aren't using these? (If I
>>build a new system from source with busybox and uclibc, how do I know if I
>>can disable this?)
>
> These should only be found in legacy binaries, ie 5+ years old.

Not true, unfortunately. To make uClibc work with linux-tiny
and [ug]id16 disabled one has to apply patches like this.
uClibc probably assumes 16 bit __kernel_[ug]id_t and uses
legacy syscalls exclusively.

--- uClibc-0.9.28/libc/sysdeps/linux/common/chown.c
+++ uclibc/libc/sysdeps/linux/common/chown.c
@@ -10,16 +10,11 @@
#include "syscalls.h"
#include <unistd.h>

-#define __NR___syscall_chown __NR_chown
+#define __NR___syscall_chown __NR_chown32
static inline _syscall3(int, __syscall_chown, const char *, path,
__kernel_uid_t, owner, __kernel_gid_t, group);

int chown(const char *path, uid_t owner, gid_t group)
{
- if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
- || ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
- __set_errno(EINVAL);
- return -1;
- }
return (__syscall_chown(path, owner, group));
}

--
Zdenek Pavlas
NEXTRA Czech Republic s.r.o. http://www.nextra.cz