summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog63
-rw-r--r--NEWS18
-rw-r--r--debug/Makefile5
-rwxr-xr-xdebug/catchsegv.sh12
-rw-r--r--elf/Versions2
-rw-r--r--elf/dl-addr.c7
-rw-r--r--elf/dl-debug.c1
-rw-r--r--linuxthreads/ChangeLog9
-rw-r--r--linuxthreads/Makefile2
-rw-r--r--linuxthreads/sysdeps/i386/i686/pt-machine.h2
-rw-r--r--linuxthreads/sysdeps/i386/tls.h2
-rw-r--r--manual/errno.texi24
-rw-r--r--nss/getent.c17
-rw-r--r--sysdeps/generic/ldsodefs.h3
-rw-r--r--sysdeps/generic/readonly-area.c15
-rw-r--r--sysdeps/gnu/Makefile8
-rw-r--r--sysdeps/gnu/errlist-compat.awk10
-rw-r--r--sysdeps/gnu/errlist.awk13
-rw-r--r--sysdeps/gnu/errlist.c42
-rw-r--r--sysdeps/mach/readonly-area.c57
-rw-r--r--sysdeps/unix/sysv/linux/Versions6
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list4
22 files changed, 281 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 5d8010ef22..35e9f5b805 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,66 @@
+2004-10-20 Roland McGrath <roland@redhat.com>
+
+ * manual/errno.texi (Error Codes): Add ENOKEY, EKEYEXPIRED,
+ EKEYREVOKED, EKEYREJECTED.
+ * sysdeps/unix/sysv/linux/Versions (libc: GLIBC_2.3.4): New errlist.
+ * sysdeps/gnu/errlist.c: Regenerated
+
+ * sysdeps/gnu/errlist-compat.awk: Don't bail if Versions gives a count
+ higher than ERR_MAX reports. Instead, emit a #define ERR_MAX.
+ * sysdeps/gnu/Makefile ($(objpfx)errlist-compat.h): New target.
+ (generated): Add errlist-compat.h.
+ * sysdeps/gnu/errlist.awk: Make output #include <errlist-compat.h> to
+ define ERR_MAX and use that for table size.
+
+2004-10-20 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/syscalls.list: Add entries for setaltroot,
+ key_add, key_request, and keyctl syscalls.
+ * sysdeps/unix/sysv/linux/Versions: Export them.
+
+2004-10-19 Roland McGrath <roland@frob.com>
+
+ * sysdeps/mach/readonly-area.c: New file.
+
+2004-10-19 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/Versions [ld, GLIBC_PRIVATE]: Add _dl_debug_state.
+ * elf/dl-debug.c (_dl_debug_state): Add rtld_hidden_def.
+ * sysdeps/generic/ldsodefs.h (_dl_debug_state): Don't mark as
+ hidden but use rtld_hidden_proto.
+
+2004-10-19 Alfred M. Szmidt <ams@gnu.org>
+
+ * sysdeps/generic/readonly-area.c (__readonly_str): Renamed to ...
+ (__readonly_area): ... this.
+
+2004-10-18 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/generic/strcpy_chk.c (__strcpy_chk): Speed up by checking
+ destlen only every 4 bytes.
+
+2004-10-19 Ulrich Drepper <drepper@redhat.com>
+
+ * nss/getent.c (hosts_keys): Let inet_pton decide whether the
+ string is an address or not.
+
+2004-10-19 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/dl-addr.c (_dl_addr): Don't look at STT_TLS symbols.
+ Use DL_SYMBOL_ADDRESS to set dli_saddr.
+
+ * debug/Makefile (catchsegv): Prefix $LIB with a backslash.
+
+2004-10-19 Ulrich Drepper <drepper@redhat.com>
+
+ * debug/Makefile ($(objpfx)catchsegv): To support multilib
+ platforms, use $LIB in path to slibdir.
+
+2004-10-19 Jakub Jelinek <jakub@redhat.com>
+
+ * debug/catchsegv.sh: Update copyright year.
+ Use mktemp to create segv_output file.
+
2004-10-19 Jakub Jelinek <jakub@redhat.com>
* include/features.h (__USE_FORTIFY_LEVEL): Enable even with
diff --git a/NEWS b/NEWS
index 126107f57a..236c4378f8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2004-8-5
+GNU C Library NEWS -- history of user-visible changes. 2004-10-19
Copyright (C) 1992-2002,2003,2004 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -17,7 +17,7 @@ Version 2.3.4
* nscd can now perform SELinux checks.
Implemented by Matthew Rickard <mjricka@epoch.ncsc.mil>.
-* getaddrinfo queries are not cached. Canonical name lookup is performed
+* getaddrinfo queries are now cached. Canonical name lookup is performed
efficiently.
Implemented by Ulrich Drepper.
@@ -27,10 +27,20 @@ Version 2.3.4
* The malloc functions perform more error checking and are stricter when
it comes to reacting on errors. The default action is to terminate
- the process after showing an error message.
+ the process after showing an error message. Implemented by Ulrich Drepper.
* Reverse lookups of IPv6 addresses does not use bit string or .ip6.int
- lookups anymore unless explicitly requested.
+ lookups anymore unless explicitly requested. Implemented by Ulrich Drepper.
+
+* Namespaces in ld.so are implemented. DSOs can be loaded in separate
+ namespaces using the new function dlmopen(). This feature is of course,
+ like most other dynamic loading functionality, not available in statically
+ linked applications. Implemented by Ulrich Drepper.
+
+* Low-overhead boundary checking variants of string and some stdio functions
+ were added. These are to be used in conjunction with a gcc patch by
+ Jakub Jelinek which adds calls to these functions if possible.
+ Patch by Jakub Jelinek and Ulrich Drepper.
Version 2.3.3
diff --git a/debug/Makefile b/debug/Makefile
index fed60d78b5..6df06116b7 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -38,7 +38,7 @@ CFLAGS-vsprintf_chk.c = -D_IO_MTSAFE_IO
CFLAGS-vsnprintf_chk.c = -D_IO_MTSAFE_IO
CFLAGS-printf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
CFLAGS-fprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-vprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
+CFLAGS-vprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
CFLAGS-vfprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
CFLAGS-gets_chk.c = -D_IO_MTSAFE_IO $(exceptions)
@@ -72,7 +72,8 @@ include ../Rules
$(objpfx)catchsegv: catchsegv.sh $(common-objpfx)soversions.mk \
$(common-objpfx)config.make
- sed -e 's|@VERSION@|$(version)|' -e 's|@SLIB@|$(slibdir)|' $< > $@.new
+ slibpfx=`echo $(slibdir)|sed 's/lib\(64\|\)$$/\\\\\\\\$$LIB/'`; \
+ sed -e 's|@VERSION@|$(version)|' -e "s|@SLIB@|$$slibpfx|" $< > $@.new
chmod 555 $@.new
mv -f $@.new $@
diff --git a/debug/catchsegv.sh b/debug/catchsegv.sh
index 853b108609..14556f712a 100755
--- a/debug/catchsegv.sh
+++ b/debug/catchsegv.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -39,7 +39,7 @@ if test $# -eq 0; then
;;
--v | --ve | --ver | --vers | --versi | --versio | --version)
echo 'catchsegv (GNU libc) @VERSION@'
- echo 'Copyright (C) 2003 Free Software Foundation, Inc.
+ echo 'Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Ulrich Drepper.'
@@ -50,9 +50,7 @@ Written by Ulrich Drepper.'
esac
fi
-segv_output=`basename "$prog"`.segv.$$
-# Make sure this output file does not exist.
-rm -f "$segv_output"
+segv_output=`mktemp ${TMPDIR:-/tmp}/segv_output.XXXXXX` || exit
# Redirect stderr to avoid termination message from shell.
(exec 3>&2 2>/dev/null
@@ -65,7 +63,7 @@ exval=$?
# Check for output. Even if the program terminated correctly it might
# be that a minor process (clone) failed. Therefore we do not check the
# exit code.
-if test -f "$segv_output"; then
+if test -s "$segv_output"; then
# The program caught a signal. The output is in the file with the
# name we have in SEGFAULT_OUTPUT_NAME. In the output the names of
# functions in shared objects are available, but names in the static
@@ -102,7 +100,7 @@ if test -f "$segv_output"; then
;;
esac
done)
- rm -f "$segv_output"
fi
+rm -f "$segv_output"
exit $exval
diff --git a/elf/Versions b/elf/Versions
index 3797cc4eee..e24b2de04c 100644
--- a/elf/Versions
+++ b/elf/Versions
@@ -54,5 +54,7 @@ ld {
_dl_get_tls_static_info; _dl_allocate_tls_init;
_dl_tls_setup; _dl_rtld_di_serinfo;
_dl_make_stack_executable;
+ # Only here for gdb while a better method is developed.
+ _dl_debug_state;
}
}
diff --git a/elf/dl-addr.c b/elf/dl-addr.c
index c418784b4f..685cab9be8 100644
--- a/elf/dl-addr.c
+++ b/elf/dl-addr.c
@@ -92,6 +92,9 @@ _dl_addr (const void *address, Dl_info *info,
dynamic symbol table!! */
for (matchsym = NULL; (void *) symtab < (void *) symtabend; ++symtab)
if (addr >= match->l_addr + symtab->st_value
+#if defined USE_TLS
+ && ELFW(ST_TYPE) (symtab->st_info) != STT_TLS
+#endif
&& ((symtab->st_size == 0
&& addr == match->l_addr + symtab->st_value)
|| addr < match->l_addr + symtab->st_value + symtab->st_size)
@@ -110,8 +113,10 @@ _dl_addr (const void *address, Dl_info *info,
{
/* We found a symbol close by. Fill in its name and exact
address. */
+ lookup_t matchl = LOOKUP_VALUE (match);
+
info->dli_sname = strtab + matchsym->st_name;
- info->dli_saddr = (void *) (match->l_addr + matchsym->st_value);
+ info->dli_saddr = DL_SYMBOL_ADDRESS (matchl, matchsym);
}
else
{
diff --git a/elf/dl-debug.c b/elf/dl-debug.c
index 2e7b9e84b9..bd6ee69189 100644
--- a/elf/dl-debug.c
+++ b/elf/dl-debug.c
@@ -57,3 +57,4 @@ void
_dl_debug_state (void)
{
}
+rtld_hidden_def (_dl_debug_state)
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index bfccc57eb7..e15dc08a10 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,12 @@
+2004-10-18 Roland McGrath <roland@redhat.com>
+
+ [BZ #406]
+ * Makefile (linuxthreads-CPPFLAGS): New variable;
+ adds -DIS_IN_linuxthreads=1.
+ * sysdeps/i386/tls.h: Protect "useldt.h" with
+ [!IS_IN_linuxthreads && !DO_MODIFY_LDT].
+ * sysdeps/i386/i686/pt-machine.h: Revert last change.
+
2004-10-14 Jakub Jelinek <jakub@redhat.com>
* sysdeps/pthread/errno-loc.c: Don't undef #errno
diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile
index 5bf558334d..75e6852733 100644
--- a/linuxthreads/Makefile
+++ b/linuxthreads/Makefile
@@ -65,6 +65,8 @@ libpthread-static-only-routines = pthread_atfork
libpthread-nonshared = pthread_atfork
+linuxthreads-CPPFLAGS = -DIS_IN_linuxthreads=1
+
CFLAGS-pthread_atfork.c = -DNOT_IN_libc
nodelete-yes = -Wl,--enable-new-dtags,-z,nodelete
diff --git a/linuxthreads/sysdeps/i386/i686/pt-machine.h b/linuxthreads/sysdeps/i386/i686/pt-machine.h
index 6048bc448f..1c75bf9807 100644
--- a/linuxthreads/sysdeps/i386/i686/pt-machine.h
+++ b/linuxthreads/sysdeps/i386/i686/pt-machine.h
@@ -1,6 +1,6 @@
/* Machine-dependent pthreads configuration and inline functions.
i686 version.
- Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
diff --git a/linuxthreads/sysdeps/i386/tls.h b/linuxthreads/sysdeps/i386/tls.h
index c1f47ca864..d296340ad8 100644
--- a/linuxthreads/sysdeps/i386/tls.h
+++ b/linuxthreads/sysdeps/i386/tls.h
@@ -120,7 +120,7 @@ typedef struct
# define TLS_LOAD_EBX
# endif
-# ifndef THREAD_SELF
+# if !defined IS_IN_linuxthreads && !defined DO_MODIFY_LDT
# include "useldt.h" /* For the structure. */
# endif
# if __ASSUME_LDT_WORKS > 0
diff --git a/manual/errno.texi b/manual/errno.texi
index c799d268f8..7872452df3 100644
--- a/manual/errno.texi
+++ b/manual/errno.texi
@@ -1229,6 +1229,30 @@ They are not yet documented.}
@comment errno ???/???
@end deftypevr
+@comment errno.h
+@comment Linux???: Required key not available
+@deftypevr Macro int ENOKEY
+@comment errno ???/???
+@end deftypevr
+
+@comment errno.h
+@comment Linux???: Key has expired
+@deftypevr Macro int EKEYEXPIRED
+@comment errno ???/???
+@end deftypevr
+
+@comment errno.h
+@comment Linux???: Key has been revoked
+@deftypevr Macro int EKEYREVOKED
+@comment errno ???/???
+@end deftypevr
+
+@comment errno.h
+@comment Linux???: Key was rejected by service
+@deftypevr Macro int EKEYREJECTED
+@comment errno ???/???
+@end deftypevr
+
@node Error Messages, , Error Codes, Error Reporting
@section Error Messages
diff --git a/nss/getent.c b/nss/getent.c
index f9f0a6e22a..c0a273241f 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -276,19 +276,12 @@ hosts_keys (int number, char *key[])
for (i = 0; i < number; ++i)
{
struct hostent *host = NULL;
+ char addr[IN6ADDRSZ];
- if (strchr (key[i], ':') != NULL)
- {
- char addr[IN6ADDRSZ];
- if (inet_pton (AF_INET6, key[i], &addr))
- host = gethostbyaddr (addr, sizeof (addr), AF_INET6);
- }
- else if (isdigit (key[i][0]))
- {
- char addr[INADDRSZ];
- if (inet_pton (AF_INET, key[i], &addr))
- host = gethostbyaddr (addr, sizeof (addr), AF_INET);
- }
+ if (inet_pton (AF_INET6, key[i], &addr) > 0)
+ host = gethostbyaddr (addr, sizeof (addr), AF_INET6);
+ else if (inet_pton (AF_INET, key[i], &addr) > 0)
+ host = gethostbyaddr (addr, sizeof (addr), AF_INET);
else if ((host = gethostbyname2 (key[i], AF_INET6)) == NULL)
host = gethostbyname2 (key[i], AF_INET);
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index f1062e7fa6..fd45bdc87f 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -785,7 +785,8 @@ extern void _dl_fini (void) internal_function;
any shared object mappings. The `r_state' member of `struct r_debug'
says what change is taking place. This function's address is
the value of the `r_brk' member. */
-extern void _dl_debug_state (void) attribute_hidden;
+extern void _dl_debug_state (void);
+rtld_hidden_proto (_dl_debug_state)
/* Initialize `struct r_debug' if it has not already been done. The
argument is the run-time load address of the dynamic linker, to be put
diff --git a/sysdeps/generic/readonly-area.c b/sysdeps/generic/readonly-area.c
index df5b96015c..4b8172f193 100644
--- a/sysdeps/generic/readonly-area.c
+++ b/sysdeps/generic/readonly-area.c
@@ -16,14 +16,19 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <stdlib.h>
+
/* Return 1 if the whole area PTR .. PTR+SIZE is not writable.
Return -1 if it is writable. */
-#include <stdlib.h>
-
int
-__readonly_str (const void *ptr, size_t size)
+__readonly_area (const void *ptr, size_t size)
{
- /* The conservative answer is that all strings are writable. */
- return -1;
+ /* We cannot determine in general whether memory is writable or not.
+ This must be handled in a system-dependent manner. to not
+ unconditionally break code we need to return here a positive
+ answer. This disables this security measure but that is the
+ price people have to pay for using systems without a real
+ implementation of this interface. */
+ return 1;
}
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index dee0c67bcf..0fc33213ae 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -49,10 +49,14 @@ endif
# Make it unwritable so noone will edit it by mistake.
-chmod a-w $@T
mv -f $@T $@
-generated += errlist-compat.c
+$(objpfx)errlist-compat.h: $(objpfx)errlist-compat.c
+ sed -n '1p;/ERR_MAX/p' $< > $@T
+ -chmod a-w $@T
+ mv -f $@T $@
+generated += errlist-compat.c errlist-compat.h
# This will force the generation above to happy if need be.
-$(foreach o,.d $(object-suffixes),$(objpfx)errlist$o):$(objpfx)errlist-compat.c
+$(foreach o,.d $(object-suffixes),$(objpfx)errlist$o):$(objpfx)errlist-compat.h
endif
ifeq ($(subdir),login)
diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk
index b243a96bc4..db827f3f70 100644
--- a/sysdeps/gnu/errlist-compat.awk
+++ b/sysdeps/gnu/errlist-compat.awk
@@ -1,5 +1,5 @@
# awk script to generate errlist-compat.c
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -59,7 +59,7 @@ END {
count = maxerr + 1;
- if (highest != count) {
+ if (highest < count) {
printf "*** errlist.c count %d vs Versions sys_errlist@%s count %d\n", \
count, highest_version, highest > "/dev/stderr";
exit 1;
@@ -79,6 +79,12 @@ END {
print "/* This file was generated by errlist-compat.awk; DO NOT EDIT! */\n";
print "#include <shlib-compat.h>\n";
+ if (highest > count) {
+ printf "*** errlist.c count %d inflated to %s count %d (old errno.h?)\n", \
+ count, highest_version, highest > "/dev/stderr";
+ printf "#define ERR_MAX %d\n\n", highest;
+ }
+
for (old in compat) {
new = compat[old];
n = vcount[old];
diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk
index 952cb8073c..3f074ed482 100644
--- a/sysdeps/gnu/errlist.awk
+++ b/sysdeps/gnu/errlist.awk
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999,2002,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
@@ -47,7 +47,16 @@ BEGIN {
print "#endif";
print "";
- print "const char *const _sys_errlist_internal[] =";
+ print "#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT";
+ print "# include <errlist-compat.h>";
+ print "#endif";
+ print "#ifdef ERR_MAX";
+ print "# define ERRLIST_SIZE ERR_MAX + 1";
+ print "#else"
+ print "# define ERRLIST_SIZE";
+ print "#endif";
+
+ print "const char *const _sys_errlist_internal[ERRLIST_SIZE] =";
print " {";
print " [0] = N_(\"Success\"),"
}
diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c
index 8131038047..3098fc34c5 100644
--- a/sysdeps/gnu/errlist.c
+++ b/sysdeps/gnu/errlist.c
@@ -7,7 +7,15 @@
# define ERR_REMAP(n) n
#endif
-const char *const _sys_errlist_internal[] =
+#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT
+# include <errlist-compat.h>
+#endif
+#ifdef ERR_MAX
+# define ERRLIST_SIZE ERR_MAX + 1
+#else
+# define ERRLIST_SIZE
+#endif
+const char *const _sys_errlist_internal[ERRLIST_SIZE] =
{
[0] = N_("Success"),
#ifdef EPERM
@@ -1400,6 +1408,38 @@ TRANS error; @pxref{Cancel AIO Operations}. */
# define ERR_MAX EMEDIUMTYPE
# endif
#endif
+#ifdef ENOKEY
+/* */
+ [ERR_REMAP (ENOKEY)] = N_("Required key not available"),
+# if ENOKEY > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX ENOKEY
+# endif
+#endif
+#ifdef EKEYEXPIRED
+/* */
+ [ERR_REMAP (EKEYEXPIRED)] = N_("Key has expired"),
+# if EKEYEXPIRED > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX EKEYEXPIRED
+# endif
+#endif
+#ifdef EKEYREVOKED
+/* */
+ [ERR_REMAP (EKEYREVOKED)] = N_("Key has been revoked"),
+# if EKEYREVOKED > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX EKEYREVOKED
+# endif
+#endif
+#ifdef EKEYREJECTED
+/* */
+ [ERR_REMAP (EKEYREJECTED)] = N_("Key was rejected by service"),
+# if EKEYREJECTED > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX EKEYREJECTED
+# endif
+#endif
};
const int _sys_nerr_internal
diff --git a/sysdeps/mach/readonly-area.c b/sysdeps/mach/readonly-area.c
new file mode 100644
index 0000000000..afee7a4bde
--- /dev/null
+++ b/sysdeps/mach/readonly-area.c
@@ -0,0 +1,57 @@
+/* Test if a memory region is wholly unwritable. Mach version.
+ 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 <stdlib.h>
+#include <stdint.h>
+#include <mach.h>
+
+/* Return 1 if the whole area PTR .. PTR+SIZE is not writable.
+ Return -1 if it is writable. */
+
+int
+__readonly_area (const char *ptr, size_t size)
+{
+ vm_address_t region_address = (uintptr_t) ptr;
+ vm_size_t region_length = size;
+ vm_prot_t protection;
+ vm_prot_t max_protection;
+ vm_inherit_t inheritance;
+ boolean_t is_shared;
+ mach_port_t object_name;
+ vm_offset_t offset;
+
+ while (__vm_region (__mach_task_self (),
+ &region_address, &region_length,
+ &protection, &max_protection, &inheritance, &is_shared,
+ &object_name, &offset) == KERN_SUCCESS
+ && region_address <= (uintptr_t) ptr)
+ {
+ region_address += region_length;
+ if (region_address < (uintptr_t) ptr)
+ continue;
+
+ if (protection & VM_PROT_WRITE)
+ return -1;
+
+ if (region_address - (uintptr_t) ptr >= size)
+ break;
+ }
+
+ return 1;
+}
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 980724e519..2d38ed6247 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -114,6 +114,12 @@ libc {
}
GLIBC_2.3.4 {
sched_getaffinity; sched_setaffinity;
+
+ # new syscalls
+ setaltroot; add_key; request_key; keyctl;
+
+ #errlist-compat 129
+ _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
}
GLIBC_PRIVATE {
# functions used in other libraries
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 860094be50..dd229238c1 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -1,5 +1,6 @@
# File name Caller Syscall name Args Strong name Weak names
+add_key EXTRA add_key i:pppii add_key
adjtimex adjtime adjtimex i:p __adjtimex adjtimex ntp_adjtime __adjtimex_internal
bdflush EXTRA bdflush i:ii bdflush
capget EXTRA capget i:pp capget
@@ -26,6 +27,7 @@ getsid - getsid i:i getsid
init_module EXTRA init_module 5 init_module
ioperm - ioperm i:iii ioperm
iopl - iopl i:i iopl
+keyctl EXTRA keyctl i:iiiii keyctl
klogctl EXTRA syslog i:isi klogctl
lchown - lchown i:sii __lchown lchown
posix_madvise - madvise Vi:pii posix_madvise
@@ -49,6 +51,8 @@ putpmsg - putpmsg i:ippii putpmsg
query_module EXTRA query_module i:sipip query_module
quotactl EXTRA quotactl i:isip quotactl
remap_file_pages - remap_file_pages i:piiii __remap_file_pages remap_file_pages
+request_key EXTRA request_key i:pppi request_key
+setaltroot EXTRA setaltroot i:p setaltroot
sched_getp - sched_getparam i:ip __sched_getparam sched_getparam
sched_gets - sched_getscheduler i:i __sched_getscheduler sched_getscheduler
sched_primax - sched_get_priority_max i:i __sched_get_priority_max sched_get_priority_max