This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch release/2.25/master updated. glibc-2.25-127-g71616d5


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, release/2.25/master has been updated
       via  71616d59ec97fe798b69f749e7fb424bd6d2432b (commit)
       via  e84db8f9eba9171fc04046014668cb66eba64d41 (commit)
      from  9331dbdcd7aa8e997eb4caa9b1b0cb6c804320c8 (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=71616d59ec97fe798b69f749e7fb424bd6d2432b

commit 71616d59ec97fe798b69f749e7fb424bd6d2432b
Author: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Date:   Fri Jan 12 18:50:33 2018 -0200

    powerpc: Fix syscalls during early process initialization [BZ #22685]
    
    The tunables framework needs to execute syscall early in process
    initialization, before the TCB is available for consumption.  This
    behavior conflicts with powerpc{|64|64le}'s lock elision code, that
    checks the TCB before trying to abort transactions immediately before
    executing a syscall.
    
    This patch adds a powerpc-specific implementation of __access_noerrno
    that does not abort transactions before the executing syscall.
    
    Tested on powerpc{|64|64le}.
    
    	[BZ #22685]
    	* sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION_IMPL): Renamed
    	from ABORT_TRANSACTION.
    	(ABORT_TRANSACTION): Redirect to ABORT_TRANSACTION_IMPL.
    	* sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION,
    	ABORT_TRANSACTION_IMPL): Likewise.
    	* sysdeps/unix/sysv/linux/powerpc/not-errno.h: New file.  Reuse
    	Linux code, but remove the code that aborts transactions.
    
    Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
    Tested-by: Aurelien Jarno <aurelien@aurel32.net>
    (cherry picked from commit 4612268a0ad8e3409d8ce2314dd2dd8ee0af5269)

diff --git a/ChangeLog b/ChangeLog
index 48249e3..6b5cfba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2018-01-19  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
+
+	[BZ #22685]
+	* sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION_IMPL): Renamed
+	from ABORT_TRANSACTION.
+	(ABORT_TRANSACTION): Redirect to ABORT_TRANSACTION_IMPL.
+	* sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION,
+	ABORT_TRANSACTION_IMPL): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/not-errno.h: New file.  Reuse
+	Linux code, but remove the code that aborts transactions.
+
 2017-07-24  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 	    H.J. Lu  <hongjiu.lu@intel.com>
 
diff --git a/NEWS b/NEWS
index f4335dd..dafec5d 100644
--- a/NEWS
+++ b/NEWS
@@ -81,6 +81,7 @@ The following bugs are resolved with this release:
   [22637] nptl: Fix stack guard size accounting
   [22679] getcwd(3) can succeed without returning an absolute path
     (CVE-2018-1000001)
+  [22685] powerpc: Fix syscalls during early process initialization
   [22715] x86-64: Properly align La_x86_64_retval to VEC_SIZE
   [22774] malloc: Integer overflow in malloc (CVE-2018-6551)
 
diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h
index f92ab2c..2ece0e0 100644
--- a/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/powerpc/powerpc32/sysdep.h
@@ -89,7 +89,7 @@ GOT_LABEL:			;					      \
   ASM_SIZE_DIRECTIVE(name)
 
 #if ! IS_IN(rtld) && defined (ENABLE_LOCK_ELISION)
-# define ABORT_TRANSACTION \
+# define ABORT_TRANSACTION_IMPL \
     cmpwi    2,0;		\
     beq      1f;		\
     lwz      0,TM_CAPABLE(2);	\
@@ -100,8 +100,9 @@ GOT_LABEL:			;					      \
     .align 4;			\
 1:
 #else
-# define ABORT_TRANSACTION
+# define ABORT_TRANSACTION_IMPL
 #endif
+#define ABORT_TRANSACTION ABORT_TRANSACTION_IMPL
 
 #define DO_CALL(syscall)						      \
     ABORT_TRANSACTION							      \
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
index db7c1d7..8133156 100644
--- a/sysdeps/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/powerpc/powerpc64/sysdep.h
@@ -273,7 +273,7 @@ LT_LABELSUFFIX(name,_name_end): ; \
   END_2(name)
 
 #if !IS_IN(rtld) && defined (ENABLE_LOCK_ELISION)
-# define ABORT_TRANSACTION \
+# define ABORT_TRANSACTION_IMPL \
     cmpdi    13,0;		\
     beq      1f;		\
     lwz      0,TM_CAPABLE(13);	\
@@ -284,8 +284,9 @@ LT_LABELSUFFIX(name,_name_end): ; \
     .align 4;                   \
 1:
 #else
-# define ABORT_TRANSACTION
+# define ABORT_TRANSACTION_IMPL
 #endif
+#define ABORT_TRANSACTION ABORT_TRANSACTION_IMPL
 
 #define DO_CALL(syscall) \
     ABORT_TRANSACTION \
diff --git a/sysdeps/unix/sysv/linux/powerpc/not-errno.h b/sysdeps/unix/sysv/linux/powerpc/not-errno.h
new file mode 100644
index 0000000..27da21b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/not-errno.h
@@ -0,0 +1,30 @@
+/* Syscall wrapper that do not set errno.  Linux powerpc version.
+   Copyright (C) 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/>.  */
+
+/* __access_noerrno is used during process initialization in elf/dl-tunables.c
+   before the TCB is initialized, prohibiting the usage of
+   ABORT_TRANSACTION.  */
+#undef ABORT_TRANSACTION
+#define ABORT_TRANSACTION
+
+#include "sysdeps/unix/sysv/linux/not-errno.h"
+
+/* Recover ABORT_TRANSACTION's previous value, in order to not affect
+   other syscalls.  */
+#undef ABORT_TRANSACTION
+#define ABORT_TRANSACTION ABORT_TRANSACTION_IMPL

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e84db8f9eba9171fc04046014668cb66eba64d41

commit e84db8f9eba9171fc04046014668cb66eba64d41
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon Jul 17 18:11:12 2017 -0300

    tunables: Use direct syscall for access (BZ#21744)
    
    The function maybe_enable_malloc_check, which is called by
    __tunables_init, calls __access_noerrno.  It isn't problem when
    symbol is is in ld.so, which has a special version of __access_noerrno
    without stack protector.  But when glibc is built with stack protector,
    maybe_enable_malloc_check in libc.a can't call the regular version of
    __access_noerrno with stack protector.
    
    This patch changes how Linux defines the __access_noerrno to be an
    inline call instead and thus preventing defining different build
    rules for ld/static and shared.
    
    	H.J. Lu  <hongjiu.lu@intel.com>
    	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
    
    	[BZ #21744]
    	* elf/dl-tunables.c: Include not-errno.h header.
    	* include/unistd.h (__access_noerrno): Remove definition.
    	* sysdeps/unix/sysv/linux/access.c (__access_noerrno): Likewise.
    	* sysdeps/generic/not-errno.h: New file.
    	* sysdeps/unix/sysv/linux/not-errno.h: Likewise.
    
    (cherry picked from commit 95a73392580761abc62fc9b1386d232cd55878e9)

diff --git a/ChangeLog b/ChangeLog
index f08f7f5..48249e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-07-24  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+	    H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #21744]
+	* elf/dl-tunables.c: Include not-errno.h header.
+	* include/unistd.h (__access_noerrno): Remove definition.
+	* sysdeps/unix/sysv/linux/access.c (__access_noerrno): Likewise.
+	* sysdeps/generic/not-errno.h: New file.
+	* sysdeps/unix/sysv/linux/not-errno.h: Likewise.
+
 2018-01-18  Arjun Shankar  <arjun@redhat.com>
 
 	[BZ #22343]
diff --git a/NEWS b/NEWS
index f1aa7aa..f4335dd 100644
--- a/NEWS
+++ b/NEWS
@@ -68,6 +68,7 @@ The following bugs are resolved with this release:
   [21386] Assertion in fork for distinct parent PID is incorrect
   [21624] Unsafe alloca allows local attackers to alias stack and heap (CVE-2017-1000366)
   [21654] nss: Fix invalid cast in group merging
+  [21744] tunables: Use direct syscall for access
   [21778] Robust mutex may deadlock
   [21915] getaddrinfo: incorrect result handling for NSS service modules
   [21922] getaddrinfo with AF_INET(6) returns EAI_NONAME, not EAI_NODATA
diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
index e42aa67..7ee3f98 100644
--- a/elf/dl-tunables.c
+++ b/elf/dl-tunables.c
@@ -30,6 +30,8 @@
 #define TUNABLES_INTERNAL 1
 #include "dl-tunables.h"
 
+#include <not-errno.h>
+
 #if TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring
 # define GLIBC_TUNABLES "GLIBC_TUNABLES"
 #endif
diff --git a/include/unistd.h b/include/unistd.h
index 16d68a1..d2802b2 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -181,13 +181,6 @@ extern int __getlogin_r_loginuid (char *name, size_t namesize)
 #   include <dl-unistd.h>
 #  endif
 
-#  if IS_IN (rtld) || !defined SHARED
-/* __access variant that does not set errno.  Used in very early initialization
-   code in libc.a and ld.so.  It follows access return semantics (zero for
-   sucess otherwise a value different than 0).  */
-extern __typeof (__access) __access_noerrno attribute_hidden;
-#  endif
-
 __END_DECLS
 # endif
 
diff --git a/sysdeps/generic/not-errno.h b/sysdeps/generic/not-errno.h
new file mode 100644
index 0000000..2aac095
--- /dev/null
+++ b/sysdeps/generic/not-errno.h
@@ -0,0 +1,19 @@
+/* Syscall wrapper that do not set errno.  Generic version.
+   Copyright (C) 2017 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/>.  */
+
+extern __typeof (__access) __access_noerrno attribute_hidden;
diff --git a/sysdeps/unix/sysv/linux/access.c b/sysdeps/unix/sysv/linux/access.c
index 67e69bd..366b6b6 100644
--- a/sysdeps/unix/sysv/linux/access.c
+++ b/sysdeps/unix/sysv/linux/access.c
@@ -21,21 +21,6 @@
 #include <sysdep-cancel.h>
 
 int
-__access_noerrno (const char *file, int type)
-{
-  int res;
-  INTERNAL_SYSCALL_DECL (err);
-#ifdef __NR_access
-  res = INTERNAL_SYSCALL_CALL (access, err, file, type);
-#else
-  res = INTERNAL_SYSCALL_CALL (faccessat, err, AT_FDCWD, file, type);
-#endif
-  if (INTERNAL_SYSCALL_ERROR_P (res, err))
-    return INTERNAL_SYSCALL_ERRNO (res, err);
-  return 0;
-}
-
-int
 __access (const char *file, int type)
 {
 #ifdef __NR_access
diff --git a/sysdeps/unix/sysv/linux/access.c b/sysdeps/unix/sysv/linux/not-errno.h
similarity index 57%
copy from sysdeps/unix/sysv/linux/access.c
copy to sysdeps/unix/sysv/linux/not-errno.h
index 67e69bd..65f93f3 100644
--- a/sysdeps/unix/sysv/linux/access.c
+++ b/sysdeps/unix/sysv/linux/not-errno.h
@@ -1,5 +1,5 @@
-/* Linux implementation for access function.
-   Copyright (C) 2016-2017 Free Software Foundation, Inc.
+/* Syscall wrapper that do not set errno.  Linux version.
+   Copyright (C) 2017 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
@@ -13,35 +13,23 @@
    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
+   License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <fcntl.h>
-#include <unistd.h>
-#include <sysdep-cancel.h>
-
-int
-__access_noerrno (const char *file, int type)
+/* This function is used on maybe_enable_malloc_check (elf/dl-tunables.c)
+   and to avoid having to build/use multiple versions if stack protection
+   in enabled it is defined as inline.  */
+static inline int
+__access_noerrno (const char *pathname, int mode)
 {
   int res;
   INTERNAL_SYSCALL_DECL (err);
 #ifdef __NR_access
-  res = INTERNAL_SYSCALL_CALL (access, err, file, type);
+  res = INTERNAL_SYSCALL_CALL (access, err, pathname, mode);
 #else
-  res = INTERNAL_SYSCALL_CALL (faccessat, err, AT_FDCWD, file, type);
+  res = INTERNAL_SYSCALL_CALL (faccessat, err, AT_FDCWD, pathname, mode);
 #endif
   if (INTERNAL_SYSCALL_ERROR_P (res, err))
     return INTERNAL_SYSCALL_ERRNO (res, err);
   return 0;
 }
-
-int
-__access (const char *file, int type)
-{
-#ifdef __NR_access
-  return INLINE_SYSCALL_CALL (access, file, type);
-#else
-  return INLINE_SYSCALL_CALL (faccessat, AT_FDCWD, file, type);
-#endif
-}
-weak_alias (__access, access)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                   |   21 ++++++++++++++++
 NEWS                                        |    2 +
 elf/dl-tunables.c                           |    2 +
 include/unistd.h                            |    7 -----
 sysdeps/generic/not-errno.h                 |   19 ++++++++++++++
 sysdeps/powerpc/powerpc32/sysdep.h          |    5 ++-
 sysdeps/powerpc/powerpc64/sysdep.h          |    5 ++-
 sysdeps/unix/sysv/linux/access.c            |   15 -----------
 sysdeps/unix/sysv/linux/not-errno.h         |   35 +++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/powerpc/not-errno.h |   30 +++++++++++++++++++++++
 10 files changed, 115 insertions(+), 26 deletions(-)
 create mode 100644 sysdeps/generic/not-errno.h
 create mode 100644 sysdeps/unix/sysv/linux/not-errno.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/not-errno.h


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]