Update.
2004-11-10 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/setreuid.c: Remove sys/syscall.h, sys/types.h, linux/posix_types.h, sysdep.h and pthread-functions.h includes. Include setxid.h. Use INLINE_SETXID_SYSCALL macro instead of INLINE_SYSCALL, kill the HAVE_PTR__NPTL_SETXID guarded snippets. * sysdeps/unix/sysv/linux/setegid.c: Likewise. * sysdeps/unix/sysv/linux/setuid.c: Likewise. * sysdeps/unix/sysv/linux/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/setgid.c: Likewise. * sysdeps/unix/sysv/linux/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/setregid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setregid.c: Likewise. * sysdeps/unix/sysv/linux/alpha/setreuid.c: Likewise. Formatting. Change signed int into int. * sysdeps/unix/sysv/linux/alpha/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/alpha/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/alpha/setregid.c: Likewise. * sysdeps/unix/sysv/linux/syscalls.list (setresuid, setresgid): Remove. * sysdeps/unix/setxid.h: New file. * Rules (binaries-static): Add xtests-static. * Makeconfig (run-program-prefix): Filter also xtests-static.
This commit is contained in:
parent
85bd633137
commit
ccd8de9aa6
34
ChangeLog
34
ChangeLog
@ -1,3 +1,37 @@
|
||||
2004-11-10 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/setreuid.c: Remove sys/syscall.h,
|
||||
sys/types.h, linux/posix_types.h, sysdep.h and pthread-functions.h
|
||||
includes. Include setxid.h. Use INLINE_SETXID_SYSCALL macro
|
||||
instead of INLINE_SYSCALL, kill the HAVE_PTR__NPTL_SETXID guarded
|
||||
snippets.
|
||||
* sysdeps/unix/sysv/linux/setegid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/setuid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/seteuid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/setgid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/setresuid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/setresgid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/setregid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/setegid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/setuid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/setgid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/setregid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/alpha/setreuid.c: Likewise.
|
||||
Formatting. Change signed int into int.
|
||||
* sysdeps/unix/sysv/linux/alpha/setresuid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/alpha/setresgid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/alpha/setregid.c: Likewise.
|
||||
* sysdeps/unix/sysv/linux/syscalls.list (setresuid, setresgid):
|
||||
Remove.
|
||||
* sysdeps/unix/setxid.h: New file.
|
||||
|
||||
* Rules (binaries-static): Add xtests-static.
|
||||
* Makeconfig (run-program-prefix): Filter also xtests-static.
|
||||
|
||||
2004-11-09 Paul Eggert <eggert@cs.ucla.edu.
|
||||
|
||||
[BZ #535]
|
||||
|
@ -541,7 +541,7 @@ $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
|
||||
$(filter -Wl$(comma)-rpath-link=%,\
|
||||
$(sysdep-LDFLAGS)))))
|
||||
run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\
|
||||
$(tests-static)),, \
|
||||
$(tests-static) $(xtests-static)),, \
|
||||
$(elf-objpfx)$(rtld-installed-name) \
|
||||
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)))
|
||||
else
|
||||
|
2
Rules
2
Rules
@ -104,7 +104,7 @@ endif
|
||||
|
||||
ifeq ($(build-programs),yes)
|
||||
binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs)
|
||||
binaries-static = $(others-static) $(tests-static)
|
||||
binaries-static = $(others-static) $(tests-static) $(xtests-static)
|
||||
else
|
||||
binaries-all = $(tests) $(xtests) $(test-srcs)
|
||||
binaries-static =
|
||||
|
@ -1,3 +1,20 @@
|
||||
2004-11-10 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* sysdeps/pthread/setxid.h: New file.
|
||||
* sysdeps/pthread/pthread-functions.h (HAVE_PTR__NPTL_SETXID): Remove.
|
||||
(struct xid_command): Add forward decl.
|
||||
(struct pthread_functions): Change return type of __nptl_setxid hook
|
||||
to int.
|
||||
* pthreadP.h (__nptl_setxid): Change return type to int.
|
||||
* allocatestack.c (__nptl_setxid): Call INTERNAL_SYSCALL_NCS in the
|
||||
calling thread, return its return value and set errno on failure.
|
||||
* descr.h (struct xid_command): Change id type to long array.
|
||||
|
||||
* Makefile: Add rules to build and test tst-setuid1 and
|
||||
tst-setuid1-static.
|
||||
* tst-setuid1.c: New test.
|
||||
* tst-setuid1-static.c: New test.
|
||||
|
||||
2004-11-10 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* Makefile (tests): Add tst-exit3.
|
||||
|
@ -242,6 +242,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
|
||||
tst-backtrace1 \
|
||||
tst-oddstacklimit \
|
||||
tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x
|
||||
xtests = tst-setuid1 tst-setuid1-static
|
||||
|
||||
# Files which must not be linked with libpthread.
|
||||
tests-nolibpthread = tst-unload
|
||||
@ -342,6 +343,7 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
|
||||
|
||||
ifeq ($(build-static),yes)
|
||||
tests-static += tst-locale1 tst-locale2
|
||||
xtests-static += tst-setuid1-static
|
||||
endif
|
||||
# These tests are linked with libc before libpthread
|
||||
tests-reverse += tst-cancel5 tst-cancel23 tst-vfork1x tst-vfork2x
|
||||
@ -499,9 +501,10 @@ $(objpfx)libpthread.so: $(common-objpfx)libc.so \
|
||||
# Make sure we link with the thread library.
|
||||
ifeq ($(build-shared),yes)
|
||||
$(addprefix $(objpfx), \
|
||||
$(filter-out $(tests-static) $(tests-reverse) $(tests-nolibpthread), \
|
||||
$(tests) $(test-srcs))): $(objpfx)libpthread.so \
|
||||
$(objpfx)libpthread_nonshared.a
|
||||
$(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
|
||||
$(tests-nolibpthread), \
|
||||
$(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so \
|
||||
$(objpfx)libpthread_nonshared.a
|
||||
$(objpfx)tst-unload: $(common-objpfx)dlfcn/libdl.so
|
||||
# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
|
||||
# since otherwise libpthread.so comes before libc.so when linking.
|
||||
@ -509,7 +512,7 @@ $(addprefix $(objpfx), $(tests-reverse)): \
|
||||
$(objpfx)../libc.so $(objpfx)libpthread.so \
|
||||
$(objpfx)libpthread_nonshared.a
|
||||
$(objpfx)../libc.so: $(common-objpfx)libc.so ;
|
||||
$(addprefix $(objpfx),$(tests-static)): $(objpfx)libpthread.a
|
||||
$(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(objpfx)libpthread.a
|
||||
|
||||
$(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
|
||||
else
|
||||
|
@ -816,10 +816,11 @@ __find_thread_by_id (pid_t tid)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
int
|
||||
attribute_hidden
|
||||
__nptl_setxid (struct xid_command *cmdp)
|
||||
{
|
||||
int result;
|
||||
lll_lock (stack_cache_lock);
|
||||
|
||||
__xidcmd = cmdp;
|
||||
@ -891,7 +892,18 @@ __nptl_setxid (struct xid_command *cmdp)
|
||||
cur = cmdp->cntr;
|
||||
}
|
||||
|
||||
/* This must be last, otherwise the current thread might not have
|
||||
permissions to send SIGSETXID syscall to the other threads. */
|
||||
result = INTERNAL_SYSCALL_NCS (cmdp->syscall_no, err, 3,
|
||||
cmdp->id[0], cmdp->id[1], cmdp->id[2]);
|
||||
if (INTERNAL_SYSCALL_ERROR_P (result, err))
|
||||
{
|
||||
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
|
||||
result = -1;
|
||||
}
|
||||
|
||||
lll_unlock (stack_cache_lock);
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline void __attribute__((always_inline))
|
||||
|
@ -97,7 +97,7 @@ struct pthread_unwind_buf
|
||||
struct xid_command
|
||||
{
|
||||
int syscall_no;
|
||||
id_t id[3];
|
||||
long id[3];
|
||||
volatile int cntr;
|
||||
};
|
||||
|
||||
|
@ -448,6 +448,6 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer
|
||||
|
||||
extern void __nptl_deallocate_tsd (void) attribute_hidden;
|
||||
|
||||
extern void __nptl_setxid (struct xid_command *cmdp) attribute_hidden;
|
||||
extern int __nptl_setxid (struct xid_command *cmdp) attribute_hidden;
|
||||
|
||||
#endif /* pthreadP.h */
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <setjmp.h>
|
||||
#include <internaltypes.h>
|
||||
|
||||
struct xid_command;
|
||||
|
||||
/* Data type shared with libc. The libc uses it to pass on calls to
|
||||
the thread functions. */
|
||||
@ -93,8 +94,7 @@ struct pthread_functions
|
||||
void (*ptr___pthread_unwind) (__pthread_unwind_buf_t *)
|
||||
__attribute ((noreturn)) __cleanup_fct_attribute;
|
||||
void (*ptr__nptl_deallocate_tsd) (void);
|
||||
#define HAVE_PTR__NPTL_SETXID
|
||||
void (*ptr__nptl_setxid) (struct xid_command *);
|
||||
int (*ptr__nptl_setxid) (struct xid_command *);
|
||||
};
|
||||
|
||||
/* Variable in libc.so. */
|
||||
|
64
nptl/sysdeps/pthread/setxid.h
Normal file
64
nptl/sysdeps/pthread/setxid.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* Copyright (C) 2004 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, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <pthreadP.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#define __SETXID_1(cmd, arg1) \
|
||||
cmd.id[0] = arg1
|
||||
#define __SETXID_2(cmd, arg1, arg2) \
|
||||
__SETXID_1 (cmd, arg1); cmd.id[1] = arg2
|
||||
#define __SETXID_3(cmd, arg1, arg2, arg3) \
|
||||
__SETXID_2 (cmd, arg1, arg2); cmd.id[2] = arg3
|
||||
|
||||
#ifdef SINGLE_THREAD
|
||||
# define INLINE_SETXID_SYSCALL(name, nr, args...) \
|
||||
INLINE_SYSCALL (name, nr, args)
|
||||
#elif defined SHARED
|
||||
# define INLINE_SETXID_SYSCALL(name, nr, args...) \
|
||||
({ \
|
||||
int __result; \
|
||||
if (__builtin_expect (__libc_pthread_functions.ptr__nptl_setxid \
|
||||
!= NULL, 0)) \
|
||||
{ \
|
||||
struct xid_command __cmd; \
|
||||
__cmd.syscall_no = __NR_##name; \
|
||||
__SETXID_##nr (__cmd, args); \
|
||||
__result = __libc_pthread_functions.ptr__nptl_setxid (&__cmd); \
|
||||
} \
|
||||
else \
|
||||
__result = INLINE_SYSCALL (name, nr, args); \
|
||||
__result; \
|
||||
})
|
||||
#else
|
||||
# define INLINE_SETXID_SYSCALL(name, nr, args...) \
|
||||
({ \
|
||||
extern __typeof (__nptl_setxid) __nptl_setxid __attribute__((weak));\
|
||||
int __result; \
|
||||
if (__builtin_expect (__nptl_setxid != NULL, 0)) \
|
||||
{ \
|
||||
struct xid_command __cmd; \
|
||||
__cmd.syscall_no = __NR_##name; \
|
||||
__SETXID_##nr (__cmd, args); \
|
||||
__result =__nptl_setxid (&__cmd); \
|
||||
} \
|
||||
else \
|
||||
__result = INLINE_SYSCALL (name, nr, args); \
|
||||
__result; \
|
||||
})
|
||||
#endif
|
1
nptl/tst-setuid1-static.c
Normal file
1
nptl/tst-setuid1-static.c
Normal file
@ -0,0 +1 @@
|
||||
#include "tst-setuid1.c"
|
1085
nptl/tst-setuid1.c
Normal file
1085
nptl/tst-setuid1.c
Normal file
File diff suppressed because it is too large
Load Diff
4
sysdeps/unix/setxid.h
Normal file
4
sysdeps/unix/setxid.h
Normal file
@ -0,0 +1,4 @@
|
||||
#include <sysdep.h>
|
||||
|
||||
#define INLINE_SETXID_SYSCALL(name, nr, args...) \
|
||||
INLINE_SYSCALL (name, nr, args)
|
@ -66,8 +66,6 @@ sendfile64 - sendfile64 i:iipi sendfile64
|
||||
setfsgid EXTRA setfsgid i:i setfsgid
|
||||
setfsuid EXTRA setfsuid i:i setfsuid
|
||||
setpgid - setpgid i:ii __setpgid setpgid
|
||||
setresuid - setresuid i:iii __setresuid setresuid
|
||||
setresgid - setresgid i:iii __setresgid setresgid
|
||||
sigaltstack - sigaltstack i:PP __sigaltstack sigaltstack
|
||||
sysinfo EXTRA sysinfo i:p sysinfo
|
||||
swapon - swapon i:si __swapon swapon
|
||||
|
Loading…
Reference in New Issue
Block a user