summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-20 10:47:20 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-20 10:47:20 +0000
commit75c95410b7b80289663bf2ba828e84d2c7890369 (patch)
tree83f4b406b0d4d0a9bcf68f6c56feb00fc59406fa /sysdeps
parente9e4030ae5f685547a9f7ead1362c7526aa88b80 (diff)
Updated to fedora-glibc-20041018T0940
Diffstat (limited to 'sysdeps')
-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
9 files changed, 145 insertions, 13 deletions
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