]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Make obsolete syscall wrappers into compat symbols (bug 18472).
authorJoseph Myers <joseph@codesourcery.com>
Mon, 14 Dec 2015 22:52:15 +0000 (22:52 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Mon, 14 Dec 2015 22:52:15 +0000 (22:52 +0000)
Various Linux kernel syscalls have become obsolete over time.
Specifically, the following are obsolete in all kernel versions
supported by glibc, are not present for architectures more recently
added to the kernel, and as such, the wrapper functions for them
should be compat symbols, not in static libc and not available for new
links with shared libc.

* bdflush: in Linux 2.6, does nothing if present.

* create_module get_kernel_syms query_module: Linux 2.4 module
  interface, syscalls not present in Linux 2.6.

* uselib: part of the mechanism for loading a.out shared libraries,
  irrelevant with ELF.

This patch adds support for syscalls.list to list syscall aliases of
the form NAME@VERSION:OBSOLETED, with SHLIB_COMPAT conditionals being
generated for such aliases.  Those five syscalls are then made into
compat symbols (obsoleted in glibc 2.23, so future ports won't have
these symbols at all), with the header <sys/kdaemon.h> declaring
bdflush being removed.  When we move to 3.2 as minimum kernel version,
the same can be done for nfsservctl (removed in Linux 3.1) as well.

Tested for x86_64 and x86 (testsuite, as well as checking that the
symbols in question indeed become compat symbols, that they are indeed
omitted from static libc, and that the generated SHLIB_COMPAT
conditionals look right).

[BZ #18472]
* sysdeps/unix/Makefile ($(objpfx)stub-syscalls.c): Handle entries
for the form NAME@VERSION:OBSOLETED and generate SHLIB_COMPAT
conditionals for them.
* sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Likewise.
* sysdeps/unix/sysv/linux/sys/kdaemon.h: Remove file.
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Remove
sys/kdaemon.h.
* sysdeps/unix/sysv/linux/syscalls.list (bdflush): Make into
compat-only syscall, obsoleted in glibc 2.23.
(create_module): Likewise.
(get_kernel_syms): Likewise.
(query_module): Likewise.
(uselib): Likewise.
* manual/sysinfo.texi (System Parameters): Do not mention bdflush.

ChangeLog
NEWS
manual/sysinfo.texi
sysdeps/unix/Makefile
sysdeps/unix/make-syscalls.sh
sysdeps/unix/sysv/linux/Makefile
sysdeps/unix/sysv/linux/sys/kdaemon.h [deleted file]
sysdeps/unix/sysv/linux/syscalls.list

index 13be8a8115e3633a7e18eae4d94a5f82710ed007..aadde3fc342b9c8afbcf207e9a6a9736a75de022 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2015-12-14  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #18472]
+       * sysdeps/unix/Makefile ($(objpfx)stub-syscalls.c): Handle entries
+       for the form NAME@VERSION:OBSOLETED and generate SHLIB_COMPAT
+       conditionals for them.
+       * sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Likewise.
+       * sysdeps/unix/sysv/linux/sys/kdaemon.h: Remove file.
+       * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Remove
+       sys/kdaemon.h.
+       * sysdeps/unix/sysv/linux/syscalls.list (bdflush): Make into
+       compat-only syscall, obsoleted in glibc 2.23.
+       (create_module): Likewise.
+       (get_kernel_syms): Likewise.
+       (query_module): Likewise.
+       (uselib): Likewise.
+       * manual/sysinfo.texi (System Parameters): Do not mention bdflush.
+
 2015-12-11  Aurelien Jarno  <aurelien@aurel32.net>
 
        * sysdeps/unix/sysv/linux/arm/ioperm.c: Do not include
diff --git a/NEWS b/NEWS
index 86d8ab6d1075fadfefbc5214f5f2904940a97c4d..22806104ef32b101d4149e8f726f50042e46d26e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,13 @@ Version 2.23
 * The obsolete header <regexp.h> has been removed.  Programs that require
   this header must be updated to use <regex.h> instead.
 
+* The obsolete functions bdflush, create_module, get_kernel_syms,
+  query_module and uselib are no longer available to newly linked binaries;
+  the header <sys/kdaemon.h> has been removed.  These functions and header
+  were specific to systems using the Linux kernel and could not usefully be
+  used with the GNU C Library on systems with version 2.6 or later of the
+  Linux kernel.
+
 * Optimized string, wcsmbs and memory functions for IBM z13.
   Implemented by Stefan Liebler.
 
index e6c44d6366a591d2c3568793e2fec03e228ecd54..1fbfb95cb92f4da8092d690f7cf744c81f130edd 100644 (file)
@@ -1286,6 +1286,4 @@ parameters are:
 @code{gethostname}, @code{sethostname} (@xref{Host Identification}.)
 @item
 @code{uname} (@xref{Platform Type}.)
-@item
-@code{bdflush}
 @end itemize
index 1770d1df983448c4b2a070cebce26ab329e22e5a..48f5ec591f17bfabee7909a3a074a4607c729bcd 100644 (file)
@@ -59,8 +59,20 @@ $(objpfx)stub-syscalls.c: $(common-objpfx)sysd-syscalls \
           *@*) \
             ver=$${call##*@}; call=$${call%%@*}; \
             ver=`echo "$$ver" | sed 's/\./_/g'`; \
+            case $$ver in \
+            *:*) \
+              compat_ver=$${ver#*:}; \
+              ver=$${ver%%:*}; \
+              compat_cond="SHLIB_COMPAT (libc, $$ver, $$compat_ver)"; \
+              ;; \
+            *) \
+              compat_cond=""; \
+              ;; \
+            esac; \
+            if [ -n "$$compat_cond" ]; then echo "#if $$compat_cond"; fi; \
             echo "strong_alias (_no_syscall, __$${call}_$${ver})"; \
-            echo "compat_symbol (libc, __$${call}_$${ver}, $$call, $$ver);" \
+            echo "compat_symbol (libc, __$${call}_$${ver}, $$call, $$ver);"; \
+            if [ -n "$$compat_cond" ]; then echo "#endif"; fi; \
             ;; \
           *) echo "weak_alias (_no_syscall, $$call)"; \
              echo "stub_warning ($$call)"; \
index fbf96605e016230e6f888bb5c145dbab5efc1ceb..bbef3eb360b51d9e7a877b9ce1b573afa33347d5 100644 (file)
@@ -81,12 +81,9 @@ emit_weak_aliases()
 
   # We use the <shlib-compat.h> macros to generate the versioned aliases
   # so that the version sets can be mapped to the configuration's
-  # minimum version set as per shlib-versions DEFAULT lines.  But note
-  # we don't generate any "#if SHLIB_COMPAT (...)" conditionals.  To do
-  # that we'd need to change the syscalls.list format so that it can
-  # list the "obsoleted" version set too.  If it ever arises that we
-  # have a syscall entry point that is obsoleted by a newer version set,
-  # we'll have to revamp all this.
+  # minimum version set as per shlib-versions DEFAULT lines.  If an
+  # entry point is specified in the form NAME@VERSION:OBSOLETED, a
+  # SHLIB_COMPAT conditional is generated.
   if [ $any_versioned = t ]; then
     echo "      echo '#include <shlib-compat.h>'; \\"
   fi
@@ -113,7 +110,17 @@ emit_weak_aliases()
       *@*)
        base=`echo $name | sed 's/@.*//'`
        ver=`echo $name | sed 's/.*@//;s/\./_/g'`
-       echo "   echo '#if defined SHARED && IS_IN (libc)'; \\"
+       case $ver in
+         *:*)
+           compat_ver=${ver#*:}
+           ver=${ver%%:*}
+           compat_cond=" && SHLIB_COMPAT (libc, $ver, $compat_ver)"
+           ;;
+         *)
+           compat_cond=
+           ;;
+       esac
+       echo "   echo '#if defined SHARED && IS_IN (libc)$compat_cond'; \\"
        if test -z "$vcount" ; then
          source=$strong
          vcount=1
index 3eb4a7d4f94ad083fe9990d18a7f8ff20795ba19..f6269ea3d8fdc92db7c1c61680609e0277d9a2a2 100644 (file)
@@ -29,7 +29,7 @@ CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=0x80000000-__getpagesize()"
 # here and in any non-Linux configuration that uses it; other
 # configurations will not install the file.
 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
-                 sys/klog.h sys/kdaemon.h \
+                 sys/klog.h \
                  sys/user.h sys/prctl.h \
                  sys/kd.h sys/soundcard.h sys/vt.h \
                  sys/quota.h sys/fsuid.h \
diff --git a/sysdeps/unix/sysv/linux/sys/kdaemon.h b/sysdeps/unix/sysv/linux/sys/kdaemon.h
deleted file mode 100644 (file)
index 67ab6d3..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1996-2015 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/>.  */
-
-/* Interfaces to control the various kernel daemons.  */
-
-#ifndef _SYS_KDAEMON_H
-
-#define _SYS_KDAEMON_H 1
-#include <features.h>
-
-__BEGIN_DECLS
-
-/* Start, flush, or tune the kernel's buffer flushing daemon.  */
-extern int bdflush (int __func, long int __data) __THROW;
-
-__END_DECLS
-
-#endif /* _SYS_KDAEMON_H */
index 62bb3cc36df5f6e8dec52dd961043fcd25ba67f1..caa6ccfbb16f75fc1199264a24651fa648619e1e 100644 (file)
@@ -2,12 +2,12 @@
 
 adjtimex       adjtime adjtimex        i:p     __adjtimex      adjtimex ntp_adjtime
 alarm          -       alarm           i:i     alarm
-bdflush                EXTRA   bdflush         i:ii    bdflush
+bdflush                EXTRA   bdflush         i:ii    __compat_bdflush        bdflush@GLIBC_2.0:GLIBC_2.23
 capget         EXTRA   capget          i:pp    capget
 capset         EXTRA   capset          i:pp    capset
 clock_adjtime  EXTRA   clock_adjtime   i:ip    clock_adjtime
 creat          -       creat           Ci:si   creat
-create_module  EXTRA   create_module   3       create_module
+create_module  EXTRA   create_module   3       __compat_create_module  create_module@GLIBC_2.0:GLIBC_2.23
 delete_module  EXTRA   delete_module   3       delete_module
 epoll_create   EXTRA   epoll_create    i:i     epoll_create
 epoll_create1  EXTRA   epoll_create1   i:i     epoll_create1
@@ -16,7 +16,7 @@ epoll_wait    EXTRA   epoll_wait      Ci:ipii epoll_wait
 execve         -       execve          i:spp   __execve        execve
 fdatasync      -       fdatasync       Ci:i    fdatasync
 flock          -       flock           i:ii    __flock         flock
-get_kernel_syms        EXTRA   get_kernel_syms i:p     get_kernel_syms
+get_kernel_syms        EXTRA   get_kernel_syms i:p     __compat_get_kernel_syms        get_kernel_syms@GLIBC_2.0:GLIBC_2.23
 getegid                -       getegid         Ei:     __getegid       getegid
 geteuid                -       geteuid         Ei:     __geteuid       geteuid
 getpgid                -       getpgid         i:i     __getpgid       getpgid
@@ -53,7 +53,7 @@ pivot_root    EXTRA   pivot_root      i:ss    pivot_root
 poll           -       poll            Ci:pii  __libc_poll     __poll poll
 prctl          EXTRA   prctl           i:iiiii __prctl         prctl
 putpmsg                -       putpmsg         i:ippii putpmsg
-query_module   EXTRA   query_module    i:sipip query_module
+query_module   EXTRA   query_module    i:sipip __compat_query_module   query_module@GLIBC_2.0:GLIBC_2.23
 quotactl       EXTRA   quotactl        i:isip  quotactl
 remap_file_pages -     remap_file_pages i:piiii        __remap_file_pages remap_file_pages
 sched_getp     -       sched_getparam  i:ip    __sched_getparam        sched_getparam
@@ -78,7 +78,7 @@ swapon                -       swapon          i:si    __swapon        swapon
 swapoff                -       swapoff         i:s     __swapoff       swapoff
 tee            EXTRA   tee             Ci:iiii tee
 unshare                EXTRA   unshare         i:i     unshare
-uselib         EXTRA   uselib          i:s     uselib
+uselib         EXTRA   uselib          i:s     __compat_uselib uselib@GLIBC_2.0:GLIBC_2.23
 utime          -       utime           i:sP    utime
 vmsplice       EXTRA   vmsplice        Ci:iPii vmsplice
 wait4          -       wait4           i:iWiP  __wait4         wait4