| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to shmat syscall if it is supported by
kernel features.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmat): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmat):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmat):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat):
Define to __NR_osf_shmat.
* sysdeps/unix/sysv/linux/shmat.c (shmat): Use shmat syscall if it is
defined.
|
|
|
|
|
|
|
|
|
| |
This patch adds a simple SYSV semaphore test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvsem.
* sysvipc/test-sysvsem.c: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch consolidates the semtimedop Linux implementation in only
one default file, sysdeps/unix/sysv/linux/semtimedop.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semtimedop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/m68k/semtimedop.S: Remove file.
* sysdeps/unix/sysv/linux/s390/semtimedop.c: Reorganize headers and
add a comment about s390 syscall difference from default one.
* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use semtimedop
syscall if it is defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to semop syscall if it is supported by
kernel headers.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semop):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semop):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/semop.c (semop): Use semop syscall if it is
defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to semget syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/semget.c (semget): Use semget syscall
if it is defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch consolidates the semctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/semctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldsemctl.
* sysdeps/unix/sysv/linux/alpha/semctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/semctl.c: Use defaulf
implementation.
* sysdeps/unix/sysv/linux/semctl.c (__new_semctl): Use semctl
syscall if it is defined.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semctl): Remove.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semctl): Likewise.
|
|
|
|
|
|
|
|
|
|
| |
This patch adds a simple SYSV message queue test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvmsg.
* sysvipc/test-sysvmsg.c: New file.
* test-skeleton.c (FAIL_UNSUPPORTED): New define.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to msgget syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/msgget.c (msgget): Use msgget syscall if
define.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to msgsnd syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgsnd): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgsnd):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgsnd):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Use msgsnd syscall
if defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch consolidates the msgrcv Linux implementation in only
one default file, sysdeps/unix/sysv/linux/msgrcv.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgctl): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise,
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Use msgrcv syscall
if defined.
* sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c: Remove file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch consolidates the msgctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/msgctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldmsgctl.
* sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (oldmsgctl): Remove.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/msgctl.c: Use default
implementation.
* sysdeps/unix/sysv/linux/msgctl.c (__new_msgctl): Use msgctl syscall
if defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some architectures support the old-style IPC and require IPC_64 equal to
0x100 to be passed along SysV IPC syscalls, while new architectures should
default to new IPC version (without the flags being set).
This patch refactor current ipc_priv.h Linux headers in two directions:
- Remove cross platform references (for instance alpha including powerpc
definition) and add required definition for each required port. The
idea is to avoid tie one architecture definition with another and make
platform change independent.
- Move all common definitions (the ipc syscall commands) on a common
header, ipc_ops.h.
* sysdeps/unix/sysv/linux/aarch64/ipc_priv.h: New file.
* sysdeps/unix/sysv/linux/alpha/ipc_priv.h: Avoid included other arch
definition and define its own.
* sysdeps/unix/sysv/linux/ipc_ops.h: New file.
* sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/mips/ipc_priv.h: Remove file.
* sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h: New file.
* sysdeps/unix/sysv/linux/ipc_priv.h: Move ipc syscall operation
definitions to common header.
* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h: Use common syscall
operation from ipc_ops.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On current minimum supported kernels, the SysV IPC on Linux is provided
by either the ipc syscalls or correspondent wire syscalls. Also, for
architectures that supports wire syscalls all syscalls are supported
in a set (msgct, msgrcv, msgsnd, msgget, semctl, semget, semop, semtimedop,
shmctl, shmat, shmget, shmdt).
The architectures that only supports ipc syscall are:
- i386, m68k, microblaze, mips32, powerpc (powerpc32, powerpc64, and
powerpc64le), s390 (32 and 64 bits), sh, sparc32, and sparc64.
And the architectures that only supports wired syscalls are:
- aarch64, alpha, hppa, ia64, mips64, mips64n32, nios2, tile
(tilepro, tilegx, and tilegx64), and x86_64
Also arm is the only one that supports both wire syscalls and the
ipc, although the ipc one is deprecated.
This patch adds a new define, __ASSUME_DIRECT_SYSVIPC_SYSCALL, that wired
syscalls are supported on the system and the general idea is to use
it where possible.
I also checked the syscall table for all architectures on Linux 4.9
and there is no change on described support for Linux 2.6.32/3.2.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): New define.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Undef.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
|
|
|
|
|
|
|
|
|
| |
The same error fixed in commit b224637928e9fc04e3cef3e10d02ccf042d01584
happens in the 32-bit implementation of memchr for power7.
This patch adopts the same solution, with a minimal change: it
implements a saturated addition where overflows sets the maximum pointer
size to UINTPTR_MAX.
|
|
|
|
|
|
|
| |
The P7 code is used for <=32B strings and for > 32B vectorized loops are used.
This shows as an average 25% improvement depending on the position of search
character. The performance is same for shorter strings.
Tested on ppc64 and ppc64le.
|
| |
|
| |
|
|
|
|
|
|
| |
The new functions support_record_failure records a test failure,
but does not terminate the process. The macros TEST_VERIFY
and TEST_VERIFY_EXIT check that a condition is true.
|
|
|
|
| |
* scripts/check-c++-types.sh: Add comments.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Apply the following spelling fix:
$ git grep -El 'implemetn?ation' |
xargs sed -ri 's/implemetn?ation/implementation/g'
[BZ #19514]
* resolv/res_send.c: Fix typo in comment.
* sysdeps/i386/i386-mcount.S: Likewise.
* sysdeps/s390/s390-32/s390-mcount.S: Likewise.
* sysdeps/s390/s390-64/s390x-mcount.S: Likewise.
* sysdeps/sparc/sparc-mcount.S: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch removes the powerpc assembly implementation of fmax/fmin.
Based on benchtests, the assembly ones shows:
$ ./testrun.sh benchtests/bench-fmax
"fmax": {
"": {
"duration": 5.07586e+09,
"iterations": 2.01676e+09,
"max": 1350.39,
"min": 2.073,
"mean": 2.51684
},
"qNaN": {
"duration": 5.09315e+09,
"iterations": 8.4568e+08,
"max": 2788,
"min": 5.806,
"mean": 6.02255
},
"sNaN": {
"duration": 5.09073e+09,
"iterations": 8.42316e+08,
"max": 4215.84,
"min": 5.737,
"mean": 6.04373
}
And
$ ./testrun.sh benchtests/bench-fmin
"fmin": {
"": {
"duration": 5.07711e+09,
"iterations": 2.02982e+09,
"max": 497.094,
"min": 2.073,
"mean": 2.50126
},
"qNaN": {
"duration": 5.09134e+09,
"iterations": 8.46968e+08,
"max": 2255.14,
"min": 5.807,
"mean": 6.01125
},
"sNaN": {
"duration": 5.09122e+09,
"iterations": 8.4746e+08,
"max": 1969.38,
"min": 5.729,
"mean": 6.00763
}
}
The default implementation (math/s_f{max.min}_template.c) shows slight better
latency for all cases:
$ ./testrun.sh benchtests/bench-fmax
"fmax": {
"": {
"duration": 5.07044e+09,
"iterations": 2.38695e+09,
"max": 2048.58,
"min": 2.073,
"mean": 2.12423
},
"qNaN": {
"duration": 5.09004e+09,
"iterations": 9.45428e+08,
"max": 3306.93,
"min": 5.138,
"mean": 5.38385
},
"sNaN": {
"duration": 5.08458e+09,
"iterations": 1.15959e+09,
"max": 972.008,
"min": 3.321,
"mean": 4.3848
}
}
And:
$ ./testrun.sh benchtests/bench-fmin
"fmin": {
"": {
"duration": 5.06817e+09,
"iterations": 2.3913e+09,
"max": 1177.9,
"min": 2.073,
"mean": 2.11942
},
"qNaN": {
"duration": 5.08857e+09,
"iterations": 9.45656e+08,
"max": 2658.83,
"min": 5.09,
"mean": 5.38099
},
"sNaN": {
"duration": 5.08093e+09,
"iterations": 1.16725e+09,
"max": 1030.74,
"min": 3.323,
"mean": 4.3529
}
}
Both were run with GCC 5.4 (ubuntu 16 default installation) using default
compiler flags on POWER8E 3.4GHz (powerpc64le-linux-gnu).
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new __libc_rpc_gethostbyname function calls gethostbyname2_r
with an AF_INET argument and is therefore not affected by the
RES_USE_INET6 flag.
Validated with the following test program, with and without
RES_OPTIONS=inet6, against a NFS server. (Link with -lrpcsvc.)
#include <rpc/clnt.h>
#include <rpcsvc/mount.h>
#include <stdio.h>
#include <string.h>
static void
usage (char **argv)
{
printf ("usage:\n"
" %1$s HOST getrpcport\n"
" %1$s HOST callrpc\n"
" %1$s HOST clnt_create\n",
argv[0]);
}
static void
dump_exports (struct exportnode *exports)
{
while (exports != NULL)
{
printf ("%s\n", exports->ex_dir);
exports = exports->ex_next;
}
}
int
main (int argc, char **argv)
{
if (argc != 3)
{
usage (argv);
return 1;
}
const char *host = argv[1];
const char *command = argv[2];
if (strcmp (command, "getrpcport") == 0)
{
int port = getrpcport (host, MOUNTPROG, MOUNTVERS, IPPROTO_UDP);
printf ("getrpcport: %d\n", port);
}
else if (strcmp (command, "callrpc") == 0)
{
struct exportnode *exports = NULL;
int ret = callrpc (host, MOUNTPROG, MOUNTVERS, MOUNTPROC_EXPORT,
(xdrproc_t) xdr_void, NULL,
(xdrproc_t) xdr_exports, (char *)&exports);
if (ret != 0)
{
clnt_perrno (ret);
puts ("");
return 1;
}
dump_exports (exports);
}
else if (strcmp (command, "clnt_create") == 0)
{
CLIENT *client = clnt_create
(host, MOUNTPROG, MOUNTVERS, "udp");
if (client == NULL)
{
printf ("error: clnt_create failed\n");
return 1;
}
struct exportnode *exports = NULL;
int ret = CLNT_CALL (client, MOUNTPROC_EXPORT,
(xdrproc_t) xdr_void, NULL,
(xdrproc_t) xdr_exports, (char *)&exports,
((struct timeval) {15, 0}));
if (ret != 0)
{
clnt_perrno (ret);
puts ("");
return 1;
}
dump_exports (exports);
}
else
{
usage (argv);
return 1;
}
return 0;
}
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Current optimized memchr for x86_64 does for input arguments pointers
module 64 in range of [49,63] if there is no searchr char in the rest
of 64-byte block a pointer addition which might overflow:
* sysdeps/x86_64/memchr.S
77 .p2align 4
78 L(unaligned_no_match):
79 add %rcx, %rdx
Add (uintptr_t)s % 16 to n in %rdx.
80 sub $16, %rdx
81 jbe L(return_null)
This patch fixes by adding a saturated math that sets a maximum pointer
value if it overflows (UINTPTR_MAX).
Checked on x86_64-linux-gnu and powerpc64-linux-gnu.
[BZ# 19387]
* sysdeps/x86_64/memchr.S (memchr): Avoid overflow in pointer
addition.
* string/test-memchr.c (do_test): Remove alignment limitation.
(test_main): Add test that trigger BZ# 19387.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are called from the kernel with the stack at a carefully-
chosen location so that the stack frame can be restored: they must not
move the stack pointer lest garbage be restored into the registers.
We explicitly inhibit protection for SPARC and for signal/sigreturn.c:
other arches either define their sigreturn stubs in .S files, or (i386,
x86_64, mips) use macros expanding to top-level asm blocks and explicit
labels in the text section to mock up a "function" without telling the
compiler that one is there at all.
|
| |
|
|
|
|
|
| |
This test cannot reference __stack_chk_fail because it is not linked
with libc at all.
|
|
|
|
|
|
| |
Add a hidden __stack_chk_fail_local alias to libc.so,
and make sure that on targets which use __stack_chk_fail,
this does not introduce a local PLT reference into libc.so.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With all the machinery we just added, we can easily arrange to work even
when the compiler passes in -fstack-protector automatically: all the
necessary bits of glibc are always compiled with -fno-stack-protector
now.
So tear out the check in configure, and add appropriate calls to
-fno-stack-protector in tests that need them (largely those that use
-nostdlib), since we don't yet have a __stack_chk_fail that those
tests can rely upon. (GCC often provides one, but we cannot rely on
this, especially not when bootstrapping.)
When stack protection is disabled, explicitly pass -fno-stack-protector
to everything, to stop a compiler hacked to enable it from inserting
calls to __stack_chk_fail via the PLT in every object file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous commit prevented rtld itself from being built with
-fstack-protector, but this is not quite enough. We identify which
objects belong in rtld via a test link and analysis of the resulting
mapfile. That link is necessarily done against objects that are
stack-protected, so drags in __stack_chk_fail_local, __stack_chk_fail,
and all the libc and libio code they use.
To stop this happening, use --defsym in the test librtld.map-production
link to force the linker to predefine these two symbols (to 0, but it
could be to anything). (In a real link, this would of course be
catastrophic, but these object files are never used for anything else.)
|
|
|
|
|
| |
Also compile corresponding routines in the static libc.a with the same
flag.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The startup code in csu/, and the brk and sbrk functions are
needed very early in initialization of a statically-linked program,
before the stack guard is initialized; TLS initialization also uses
memcpy, which cannot overrun its own stack. Mark all of these as
-fno-stack-protector.
We also finally introduce @libc_cv_ssp@ and @no_stack_protector@, both
substituted by the configury changes made earlier, to detect the case
when -fno-stack-protector is supported by the compiler, and
unconditionally pass it in when this is the case, whether or not
--enable-stack-protector is passed to configure. (This means that
it'll even work when the compiler's been hacked to pass
-fstack-protector by default, unless the hackage is so broken that
it does so in a way that is impossible to override.)
|
|
|
|
|
|
|
|
|
|
|
| |
When dynamically linking, ifunc resolvers are called before TLS is
initialized, so they cannot be safely stack-protected.
We avoid disabling stack-protection on large numbers of files by
using __attribute__ ((__optimize__ ("-fno-stack-protector")))
to turn it off just for the resolvers themselves. (We provide
the attribute even when statically linking, because we will later
use it elsewhere too.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The address of the stack canary is stored in a per-thread variable,
which means that we must ensure that the TLS area is intialized before
calling any -fstack-protector'ed functions. For dynamically linked
applications, we ensure this (in a later patch) by disabling
-fstack-protector for the whole dynamic linker, but for static
applications, the AT_ENTRY address is called directly by the kernel, so
we must deal with the problem differently.
In static appliations, __libc_setup_tls performs the TCB setup and TLS
initialization, so this commit arranges for it to be called early and
unconditionally. The call (and the stack guard initialization) is
before the DL_SYSDEP_OSCHECK hook, which if set will probably call
functions which are stack-protected (it does on Linux and NaCL too). We
also move apply_irel up, so that we can still safely call functions that
require ifuncs while in __libc_setup_tls (though if stack-protection is
enabled we still have to avoid calling functions that are not
stack-protected at this stage).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds =all and =strong, with obvious semantics, defaulting to off.
We don't validate the value of the option yet: that's in a later patch.
Nor do we use it for anything at this stage.
We differentiate between 'the compiler understands -fstack-protector'
and 'the user wanted -fstack-protector' so that we can pass
-fno-stack-protector in appropriate places even if the user didn't want
to turn on -fstack-protector for other parts. (This helps us overcome
another existing limitation, that glibc doesn't work with GCCs hacked
to pass in -fstack-protector by default.)
We also arrange to set the STACK_PROTECTOR_LEVEL #define to a value
appropriate for the stack-protection level in use for each file in
particular.
|
|
|
|
|
|
|
|
| |
The value of CPPFLAGS provided by the environment may have optimizations
that interfere with the pretty printer test requirements. To override
such optimizations the pretty printer tests must also specify CPPFLAGS.
The existing pretty printer tests are fixed and the
README.pretty-printers is updated with the new requirement.
|
|
|
|
|
|
|
|
| |
The fix in commit 312be3f9f5eab1643d7dcc7728c76d413d4f2640 resolved
several cancellation issues in several APIs. This regression test is
designed to double check that at least getpwuid_r remainds correctly
implemented and does not provide additional unintended cancellation
points that may leave locks in an inconsistent state.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is at least one use case where during exit a library destructor
might call dlclose() on a valid handle and have it fail with an
assertion. We must allow this case, it is a valid handle, and dlclose()
should not fail with an assert. In the future we might be able to return
an error that the dlclose() could not be completed because the opened
library has already been unloaded and destructors have run as part of
exit processing.
For more details see:
https://www.sourceware.org/ml/libc-alpha/2016-12/msg00859.html
|
|
|
|
|
|
| |
If GDB prints an error message for a "python" command, include
that error message in the test log output, to simplify diagnosing
GDB/Python detection issues.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a configure check that looks for python3 and python in that order
since we had agreed in the past to prefer python3 over python in all
our code. The patch also adjusts invocations through the various
Makefiles to use the set variable.
* configure.ac: Check for python3 or python.
* configure: Regenerated.
* config.make.in (PYTHON): New variable.
* benchtests/Makefile: Don't define PYTHON.
(bench): Define target only if PYTHON was defined.
* Rules: Don't define PYTHON.
Define pretty printer targets only if PYTHON was defined.
(tests-printers): Add to tests-unsupported if PYTHON is not
found.
(python-flags, python-invoke): Remove.
(tests-printers-out): Use PYTHON instead of python-invoke.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The NEWS entry for the feature test macro
__STDC_WANT_IEC_60559_BFP_EXT__ describes the state of support for
that TS as "most features from that TS are not supported by the GNU C
Library". This patch updates it to say "not all features from that TS
are supported by the GNU C Library".
(The functions not yet supported are the fromfp functions - I'm
working on them, but they may not be done before the freeze - and the
functions round result to narrower type - which definitely won't be
started for 2.25, since they require significant infrastructure work.
That's 30 functions, which is less than half the number of functions
in the TS, so saying "most" now seems inaccurate.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
glibc build with current mainline GCC fails because
nis/nss_nisplus/nisplus-alias.c contains code
if (name != NULL)
{
*errnop = EINVAL;
return NSS_STATUS_UNAVAIL;
}
char buf[strlen (name) + 9 + tablename_len];
producing an error about strlen being called on a pointer that is
always NULL (and a subsequent use of that pointer with a %s format in
snprintf).
As Andreas noted, the bogus conditional comes from a 1997 change:
- if (name == NULL || strlen(name) > 8)
- return NSS_STATUS_NOTFOUND;
- else
+ if (name != NULL || strlen(name) <= 8)
So the intention is clearly to return an error for NULL name.
This patch duly inverts the sense of the conditional. It fixes the
build with GCC mainline, and passes usual glibc testsuite testing for
x86_64. However, I have not tried any actual substantive nisplus
testing, do not have an environment for such testing, and do not know
whether it is possible that strlen (name) or tablename_len might be
large so that the VLA for buf is actually a security issue. However,
if it is a security issue, there are plenty of other similar instances
in the nisplus code (that haven't been hidden by a bogus comparison
with NULL) - and nis_table.c:__create_ib_request uses strdupa on the
string passed to nis_list, so a local fix in the caller wouldn't
suffice anyway (see bug 20987). (Calls to strdupa and other such
macros that use alloca must be considered equally questionable
regarding stack overflow issues as direct calls to alloca and VLA
declarations.)
[BZ #20978]
* nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r):
Compare name == NULL, not name != NULL.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch updates texinfo.tex and various miscellaneous scripts to
their latest upstream versions. (There may be another update in early
January to bring in 2017 copyright dates, if the upstream versions get
updated with such dates promptly.)
Tested for x86_64.
* manual/texinfo.tex: Update to version 2016-09-18.18 with
trailing whitespace removed.
* scripts/config.guess: Update to version 2016-10-02.
* scripts/config.sub: Update to version 2016-11-19.
* scripts/install-sh: Update to version 2016-01-11.22.
* scripts/mkinstalldirs: Update to version 2016-01-11.22.
* scripts/move-if-change: Update to version 2016-01-11 22:04.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently strsep calls strpbrk is is now a veneer to strcspn. Calling
strcspn directly is faster. Since it handles a delimiter string of size
1 as a special case, this is not needed in strsep itself. Although this
means there is a slightly higher overhead if the delimiter size is 1,
all other cases are slightly faster. The overall performance gain is 5-10%
on AArch64.
The string/bits/string2.h header contains optimizations for constant
delimiters of size 1-3. Benchmarking these showed similar performance for
size 1 (since in all cases strchr/strchrnul is used), while size 2 and 3
can give up to 2x speedup for small input strings. However if these cases
are common it seems much better to add this optimization to strcspn.
So move these header optimizations to string-inlines.c.
Improve the strsep benchmark so that it actually benchmarks something.
The current version contains a delimiter character at every position in the
input string, so there is very little work to do, and the extremely inefficent
simple_strsep implementation appears fastest in every case. The new version
has either no match in the input for the fail case and a match halfway in the
input for the success case. The input is then restored so that each iteration
does exactly the same amount of work. Reduce the number of testcases since
simple_strsep takes a lot of time now.
* benchtests/bench-strsep.c (oldstrsep): Add old implementation.
(do_one_test) Restore original string so iteration works.
* string/string-inlines.c (do_test): Create better input strings.
(test_main) Reduce number of testruns.
* string/string-inlines.c (__old_strsep_1c): New function.
(__old_strsep_2c): Likewise.
(__old_strsep_3c): Likewise.
* string/strsep.c (__strsep): Remove case of small delim string.
Call strcspn directly rather than strpbrk.
* string/bits/string2.h (__strsep): Remove define.
(__strsep_1c): Remove.
(__strsep_2c): Remove.
(__strsep_3c): Remove.
(strsep): Remove.
* sysdeps/unix/sysv/linux/internal_statvfs.c
(__statvfs_getflags): Rename to __strsep.
|
|
|
|
|
|
| |
Commit 7a5e3d9d633c828d84a9535f26b202a6179978e7 (elf: Assume TLS is
initialized in _dl_map_object_from_fd) removed the last call of
_dl_tls_setup, but did not remove the function itself.
|
|
|
|
|
|
| |
With stack protection enabled, these files have external symbol
references for the first time, so the fact that they are not compiled
with -fPIE and are then linked into a -pie binary starts to hurt.
|