This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.27.9000-223-g72e7ffc
- From: sthibaul at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 18 Mar 2018 19:46:01 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.27.9000-223-g72e7ffc
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 72e7ffc37fd59e093eb6352c9e0abde2112a9346 (commit)
via 20bc801b3d4ba1eb1c9704a529b6720f096a14e5 (commit)
via aa2189295e4e531d05733d60bfd697c7a962b100 (commit)
via 72103e73c9a76784b9e8b27a7d5b802178d6755b (commit)
via 489999cc9cb1fab40c308b2e5ede3207e0f7a5be (commit)
from 55325314bf29d6f2430a2ce83368da8281b12f85 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=72e7ffc37fd59e093eb6352c9e0abde2112a9346
commit 72e7ffc37fd59e093eb6352c9e0abde2112a9346
Author: Richard Braun <rbraun@sceen.net>
Date: Sun Mar 18 20:27:16 2018 +0100
Hurd: fix port leak in TLS
* sysdeps/mach/hurd/i386/tls.h (_hurd_tls_init): Use a temporary
thread reference.
diff --git a/ChangeLog b/ChangeLog
index 1a34efc..ddf8c9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-03-18 Richard Braun <rbraun@sceen.net>
+
+ * sysdeps/mach/hurd/i386/tls.h (_hurd_tls_init): Use a temporary
+ thread reference.
+
2018-03-18 Agustina Arzille <avarzille@riseup.net>
* sysdeps/mach/libc-lock.h (__libc_cleanup_frame): Define structure.
diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h
index c443552..771c94f 100644
--- a/sysdeps/mach/hurd/i386/tls.h
+++ b/sysdeps/mach/hurd/i386/tls.h
@@ -111,36 +111,41 @@ static inline const char * __attribute__ ((unused))
_hurd_tls_init (tcbhead_t *tcb)
{
HURD_TLS_DESC_DECL (desc, tcb);
+ thread_t self = __mach_thread_self ();
+ const char *msg = NULL;
/* This field is used by TLS accesses to get our "thread pointer"
from the TLS point of view. */
tcb->tcb = tcb;
- /* Cache our thread port. */
- tcb->self = __mach_thread_self ();
-
/* Get the first available selector. */
int sel = -1;
- error_t err = __i386_set_gdt (tcb->self, &sel, desc);
+ error_t err = __i386_set_gdt (self, &sel, desc);
if (err == MIG_BAD_ID)
{
/* Old kernel, use a per-thread LDT. */
sel = 0x27;
- err = __i386_set_ldt (tcb->self, sel, &desc, 1);
+ err = __i386_set_ldt (self, sel, &desc, 1);
assert_perror (err);
if (err)
- return "i386_set_ldt failed";
+ {
+ msg = "i386_set_ldt failed";
+ goto out;
+ }
}
else if (err)
{
assert_perror (err); /* Separate from above with different line #. */
- return "i386_set_gdt failed";
+ msg = "i386_set_gdt failed";
+ goto out;
}
/* Now install the new selector. */
asm volatile ("mov %w0, %%gs" :: "q" (sel));
- return 0;
+out:
+ __mach_port_deallocate (__mach_task_self (), self);
+ return msg;
}
/* Code to initially initialize the thread pointer. This might need
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=20bc801b3d4ba1eb1c9704a529b6720f096a14e5
commit 20bc801b3d4ba1eb1c9704a529b6720f096a14e5
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sun Mar 18 20:14:12 2018 +0100
hurd: Add mlockall support
* sysdeps/mach/hurd/mlockall.c: New file.
* sysdeps/mach/hurd/munlockall.c: New file.
diff --git a/ChangeLog b/ChangeLog
index e090c75..1a34efc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -70,6 +70,8 @@
if flags contains O_DIRECTORY and the result is a directory.
* sysdeps/mach/hurd/i386/init-first.c (init): Also find ELF headers by
oneself when the pointer given in D is nul (as set by ext2fs).
+ * sysdeps/mach/hurd/mlockall.c: New file.
+ * sysdeps/mach/hurd/munlockall.c: New file.
2018-03-17 Samuel Thibault <samuel.thibault@ens-lyon.org>
diff --git a/sysdeps/mach/hurd/mlockall.c b/sysdeps/mach/hurd/mlockall.c
new file mode 100644
index 0000000..6fa944b
--- /dev/null
+++ b/sysdeps/mach/hurd/mlockall.c
@@ -0,0 +1,42 @@
+/* mlockall -- lock in core all the pages in this process. Hurd version.
+ Copyright (C) 2001-2018 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 <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <hurd.h>
+#include <mach/mach_host.h>
+
+/* Cause all currently mapped pages of the process to be memory resident
+ until unlocked by a call to the `munlockall', until the process exits,
+ or until the process calls `execve'. */
+
+int
+mlockall (int flags)
+{
+ mach_port_t host;
+ error_t err;
+
+ err = __get_privileged_ports (&host, NULL);
+ if (err)
+ return __hurd_fail (err);
+
+ err = __vm_wire_all (host, __mach_task_self (), flags);
+ __mach_port_deallocate (__mach_task_self (), host);
+ return err ? __hurd_fail (err) : 0;
+}
diff --git a/sysdeps/mach/hurd/munlockall.c b/sysdeps/mach/hurd/munlockall.c
new file mode 100644
index 0000000..615b77f
--- /dev/null
+++ b/sysdeps/mach/hurd/munlockall.c
@@ -0,0 +1,40 @@
+/* munlockall -- undo the effects of all prior mlock calls. Hurd version.
+ Copyright (C) 2001-2018 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 <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <hurd.h>
+#include <mach/mach_host.h>
+
+/* Undo the effects of all prior mlock calls in this process. */
+
+int
+munlockall (void)
+{
+ mach_port_t host;
+ error_t err;
+
+ err = __get_privileged_ports (&host, NULL);
+ if (err)
+ return __hurd_fail (err);
+
+ err = __vm_wire_all (host, __mach_task_self (), VM_WIRE_NONE);
+ __mach_port_deallocate (__mach_task_self (), host);
+ return err ? __hurd_fail (err) : 0;
+}
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=aa2189295e4e531d05733d60bfd697c7a962b100
commit aa2189295e4e531d05733d60bfd697c7a962b100
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sun Mar 18 19:52:39 2018 +0100
hurd: Fix boot with statically-linked exec server
* sysdeps/mach/hurd/i386/init-first.c (init): Also find ELF headers by
oneself when the pointer given in D is nul (as set by ext2fs).
diff --git a/ChangeLog b/ChangeLog
index a02f901..e090c75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -68,6 +68,8 @@
path when flags contains O_NOFOLLOW.
* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ENOTDIR
if flags contains O_DIRECTORY and the result is a directory.
+ * sysdeps/mach/hurd/i386/init-first.c (init): Also find ELF headers by
+ oneself when the pointer given in D is nul (as set by ext2fs).
2018-03-17 Samuel Thibault <samuel.thibault@ens-lyon.org>
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index f4a4df3..226de02 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -107,7 +107,7 @@ init1 (int argc, char *arg0, ...)
/* If we are the bootstrap task started by the kernel,
then after the environment pointers there is no Hurd
data block; the argument strings start there. */
- if ((void *) d == argv[0])
+ if ((void *) d == argv[0] || d->phdr == NULL)
{
#ifndef SHARED
/* With a new enough linker (binutils-2.23 or better),
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=72103e73c9a76784b9e8b27a7d5b802178d6755b
commit 72103e73c9a76784b9e8b27a7d5b802178d6755b
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sun Mar 18 19:43:04 2018 +0100
hurd: Fix O_DIRECTORY | O_NOFOLLOW
Appending / to the path to be looked up would make us always follow a final
symlink, even with O_NOTRANS (since the final resolution is after the
'/'). In the O_DIRECTORY | O_NOFOLLOW case, we thus have to really open
the node and stat it, which we already do anyway, and check for
directory type.
* hurd/hurdlookup.c (__hurd_file_name_lookup): Do not append '/' to
path when flags contains O_NOFOLLOW.
* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ENOTDIR
if flags contains O_DIRECTORY and the result is a directory.
diff --git a/ChangeLog b/ChangeLog
index 82ddda5..a02f901 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -64,6 +64,10 @@
* sysdeps/mach/hurd/cthreads.c: Include <cthreads.h>.
* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ELOOP
when opening a symlink with O_NOFOLLOW.
+ * hurd/hurdlookup.c (__hurd_file_name_lookup): Do not append '/' to
+ path when flags contains O_NOFOLLOW.
+ * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ENOTDIR
+ if flags contains O_DIRECTORY and the result is a directory.
2018-03-17 Samuel Thibault <samuel.thibault@ens-lyon.org>
diff --git a/hurd/hurdlookup.c b/hurd/hurdlookup.c
index 1861d58..a642c49 100644
--- a/hurd/hurdlookup.c
+++ b/hurd/hurdlookup.c
@@ -72,7 +72,7 @@ __hurd_file_name_lookup (error_t (*use_init_port)
if (flags & O_NOFOLLOW) /* See lookup-retry.c about O_NOFOLLOW. */
flags |= O_NOTRANS;
- if (flags & O_DIRECTORY)
+ if (flags & O_DIRECTORY && (flags & O_NOFOLLOW) == 0)
{
/* The caller wants to require that the file we look up is a directory.
We can do this without an extra RPC by appending a trailing slash
diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
index 12b5c30..b596848 100644
--- a/hurd/lookup-retry.c
+++ b/hurd/lookup-retry.c
@@ -147,6 +147,8 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
err = __io_stat (*result, &st);
if (!err)
{
+ if (flags & O_DIRECTORY && !S_ISDIR (st.st_mode))
+ err = ENOTDIR;
if (S_ISLNK (st.st_mode))
err = ELOOP;
else if (st.st_mode & (S_IPTRANS|S_IATRANS))
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=489999cc9cb1fab40c308b2e5ede3207e0f7a5be
commit 489999cc9cb1fab40c308b2e5ede3207e0f7a5be
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sun Mar 18 19:39:29 2018 +0100
hurd: Fix O_NOFOLLOW
The error code documented by POSIX for opening a symlink with O_NOFOLLOW
is ELOOP.
Also, if the translator does not expose symlink as a symlink translator but
as a S_IFLNK file, O_NOFOLLOW needs to return ELOOP too.
* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ELOOP
when opening a symlink with O_NOFOLLOW.
diff --git a/ChangeLog b/ChangeLog
index af84374..82ddda5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -62,6 +62,8 @@
2018-03-18 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/mach/hurd/cthreads.c: Include <cthreads.h>.
+ * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ELOOP
+ when opening a symlink with O_NOFOLLOW.
2018-03-17 Samuel Thibault <samuel.thibault@ens-lyon.org>
diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
index 319e9c0..12b5c30 100644
--- a/hurd/lookup-retry.c
+++ b/hurd/lookup-retry.c
@@ -127,7 +127,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
{
/* In Linux, O_NOFOLLOW means to reject symlinks. If we
did an O_NOLINK lookup above and io_stat here to check
- for S_IFLNK, a translator like firmlink could easily
+ for S_IFLNK only, a translator like firmlink could easily
spoof this check by not showing S_IFLNK, but in fact
redirecting the lookup to some other name
(i.e. opening the very same holes a symlink would).
@@ -145,23 +145,27 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
one exception to our general translator-based rule. */
struct stat64 st;
err = __io_stat (*result, &st);
- if (!err
- && (st.st_mode & (S_IPTRANS|S_IATRANS)))
+ if (!err)
{
- if (st.st_uid != 0)
- err = ENOENT;
- else if (st.st_mode & S_IPTRANS)
+ if (S_ISLNK (st.st_mode))
+ err = ELOOP;
+ else if (st.st_mode & (S_IPTRANS|S_IATRANS))
{
- char buf[1024];
- char *trans = buf;
- size_t translen = sizeof buf;
- err = __file_get_translator (*result,
- &trans, &translen);
- if (!err
- && translen > sizeof _HURD_SYMLINK
- && !memcmp (trans,
- _HURD_SYMLINK, sizeof _HURD_SYMLINK))
- err = ENOENT;
+ if (st.st_uid != 0)
+ err = ELOOP;
+ else if (st.st_mode & S_IPTRANS)
+ {
+ char buf[1024];
+ char *trans = buf;
+ size_t translen = sizeof buf;
+ err = __file_get_translator (*result,
+ &trans, &translen);
+ if (!err
+ && translen > sizeof _HURD_SYMLINK
+ && !memcmp (trans,
+ _HURD_SYMLINK, sizeof _HURD_SYMLINK))
+ err = ELOOP;
+ }
}
}
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 15 +++++++++++
hurd/hurdlookup.c | 2 +-
hurd/lookup-retry.c | 38 +++++++++++++++++------------
sysdeps/mach/hurd/i386/init-first.c | 2 +-
sysdeps/mach/hurd/i386/tls.h | 21 ++++++++++------
{misc => sysdeps/mach/hurd}/mlockall.c | 18 ++++++++++----
{misc => sysdeps/mach/hurd}/munlockall.c | 18 ++++++++++----
7 files changed, 78 insertions(+), 36 deletions(-)
copy {misc => sysdeps/mach/hurd}/mlockall.c (73%)
copy {misc => sysdeps/mach/hurd}/munlockall.c (70%)
hooks/post-receive
--
GNU C Library master sources