about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-06-05 10:17:46 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-06-05 10:17:46 +0000
commit7553131847151d04d58a02300673f13d73861cbb (patch)
tree59efadeab12ec41f6ee18a2858e63be9a45b4c22 /sysdeps/unix
parent8951dd0b148c260afde95ac7179e9067276ed6d7 (diff)
downloadglibc-7553131847151d04d58a02300673f13d73861cbb.tar.gz
glibc-7553131847151d04d58a02300673f13d73861cbb.tar.xz
glibc-7553131847151d04d58a02300673f13d73861cbb.zip
Fix struct sigaltstack namespace (bug 21517).
glibc defines the stack_t type with the tag struct sigaltstack.  This
is not permitted by POSIX; sigaltstack is only reserved with file
scope in the namespace of ordinary identifiers, not the tag namespace,
and in the case where stack_t is obtained from ucontext.h rather than
signal.h, it's not reserved with file scope at all.

This patch removes the tag accordingly and updates uses in glibc of
struct sigaltstack.  This is similar to the removal of the "struct
siginfo" tag a few years ago: C++ name mangling changes are an
unavoidable consequence.  A NEWS item is added to note the changed
mangling.  There is inevitably some risk of breaking builds of
anything that relies on the struct sigaltstack name (though the first
few hits I looked at from codesearch.debian.net generally seemed to
involve code that could use the stack_t name conditionally, so
depending on how they determine the conditionals they may work with
glibc not defining the struct tag anyway).

Tested for x86_64 and x86, and with build-many-glibcs.py.

	[BZ #21517]
	* bits/types/stack_t.h (stack_t): Remove struct tag.
	* sysdeps/unix/sysv/linux/bits/types/stack_t.h (stack_t):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h (stack_t):
	Likewise.
	* debug/segfault.c (install_handler): Use stack_t instead of
	struct sigaltstack.
	* hurd/hurd/signal.h (struct hurd_sigstate): Likewise.
	* hurd/trampoline.c (_hurd_setup_sighandler): Likewise.
	* include/signal.h (__sigaltstack): Likwise.
	* signal/sigaltstack.c (__sigaltstack): Likewise.
	* signal/signal.h (sigaltstack): Likewise.
	* sysdeps/mach/hurd/i386/signal-defines.sym
	(SIGALTSTACK__SS_SP__OFFSET): Likewise.
	(SIGALTSTACK__SS_SIZE__OFFSET): Likewise.
	(SIGALTSTACK__SS_FLAGS__OFFSET): Likewise.
	* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
	* sysdeps/mach/hurd/sigstack.c (sigstack): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h (struct
	elf_prstatus): Likewise.
	* sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c (CHECK_SP):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/procfs.h (struct elf_prstatus):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c (CHECK_SP):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h (struct
	elf_prstatus): Likewise.
	* sysdeps/unix/sysv/linux/sh/sys/procfs.h (struct elf_prstatus):
	Likewise.
	* sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prstatus):
	Likewise.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/procfs.h2
-rw-r--r--sysdeps/unix/sysv/linux/bits/types/stack_t.h2
-rw-r--r--sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sys/procfs.h2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c2
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/procfs.h2
-rw-r--r--sysdeps/unix/sysv/linux/sh/sys/procfs.h2
-rw-r--r--sysdeps/unix/sysv/linux/sys/procfs.h2
9 files changed, 9 insertions, 9 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
index 2cd69d442e..abc9fd8d6e 100644
--- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
@@ -71,7 +71,7 @@ struct elf_prstatus
     unsigned long int pr_sigpend;	/* Set of pending signals.  */
     unsigned long int pr_sighold;	/* Set of held signals.  */
 #if 0
-    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    stack_t pr_altstack;		/* Alternate stack info.  */
     struct sigaction pr_action;		/* Signal action for current sig.  */
 #endif
     __pid_t pr_pid;
diff --git a/sysdeps/unix/sysv/linux/bits/types/stack_t.h b/sysdeps/unix/sysv/linux/bits/types/stack_t.h
index 497e42b0ff..373c227930 100644
--- a/sysdeps/unix/sysv/linux/bits/types/stack_t.h
+++ b/sysdeps/unix/sysv/linux/bits/types/stack_t.h
@@ -23,7 +23,7 @@
 #include <stddef.h>
 
 /* Structure describing a signal stack.  */
-typedef struct sigaltstack
+typedef struct
   {
     void *ss_sp;
     int ss_flags;
diff --git a/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c b/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c
index 3a04250add..48aaeb36c9 100644
--- a/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c
+++ b/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c
@@ -27,7 +27,7 @@
        destroyed must all have stack values higher than ours.  */	\
     if ((unsigned long) (sp) > this_sp)					\
       {									\
-        struct sigaltstack oss;						\
+        stack_t oss;							\
         INTERNAL_SYSCALL_DECL (err);					\
         int result = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss);\
 	/* If we aren't using an alternate stack then we have already	\
diff --git a/sysdeps/unix/sysv/linux/ia64/sys/procfs.h b/sysdeps/unix/sysv/linux/ia64/sys/procfs.h
index 93e569b2cc..afe54fbd53 100644
--- a/sysdeps/unix/sysv/linux/ia64/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/ia64/sys/procfs.h
@@ -73,7 +73,7 @@ struct elf_prstatus
     unsigned long int pr_sigpend;	/* Set of pending signals.  */
     unsigned long int pr_sighold;	/* Set of held signals.  */
 #if 0
-    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    stack_t pr_altstack;		/* Alternate stack info.  */
     struct sigaction pr_action;		/* Signal action for current sig.  */
 #endif
     __pid_t pr_pid;
diff --git a/sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c b/sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c
index 3539b54d7a..030e46389e 100644
--- a/sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c
+++ b/sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c
@@ -24,7 +24,7 @@
     register unsigned long this_sp asm ("sp");				      \
     if ((unsigned long) (sp) < this_sp)					      \
       {									      \
-	struct sigaltstack oss;						      \
+	stack_t oss;							      \
 	INTERNAL_SYSCALL_DECL (err);					      \
 	int result = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss);      \
 	if (!INTERNAL_SYSCALL_ERROR_P (result, err)			      \
diff --git a/sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h b/sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h
index ef06072e94..b9635ad18a 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h
@@ -23,7 +23,7 @@
 #include <stddef.h>
 
 /* Structure describing a signal stack.  */
-typedef struct sigaltstack
+typedef struct
   {
     void *ss_sp;
     size_t ss_size;
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
index b7b7b0b904..61ded22955 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
@@ -83,7 +83,7 @@ struct elf_prstatus
     unsigned long int pr_sigpend;	/* Set of pending signals.  */
     unsigned long int pr_sighold;	/* Set of held signals.  */
 #if 0
-    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    stack_t pr_altstack;		/* Alternate stack info.  */
     struct sigaction pr_action;		/* Signal action for current sig.  */
 #endif
     __pid_t pr_pid;
diff --git a/sysdeps/unix/sysv/linux/sh/sys/procfs.h b/sysdeps/unix/sysv/linux/sh/sys/procfs.h
index c41c87788b..414911a661 100644
--- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h
@@ -55,7 +55,7 @@ struct elf_prstatus
     unsigned long int pr_sigpend;	/* Set of pending signals.  */
     unsigned long int pr_sighold;	/* Set of held signals.  */
 #if 0
-    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    stack_t pr_altstack;		/* Alternate stack info.  */
     struct sigaction pr_action;		/* Signal action for current sig.  */
 #endif
     __pid_t pr_pid;
diff --git a/sysdeps/unix/sysv/linux/sys/procfs.h b/sysdeps/unix/sysv/linux/sys/procfs.h
index 8dfa0c08d5..b3b2cf3e12 100644
--- a/sysdeps/unix/sysv/linux/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/sys/procfs.h
@@ -58,7 +58,7 @@ struct elf_prstatus
     unsigned long int pr_sigpend;	/* Set of pending signals.  */
     unsigned long int pr_sighold;	/* Set of held signals.  */
 #if 0
-    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    stack_t pr_altstack;		/* Alternate stack info.  */
     struct sigaction pr_action;		/* Signal action for current sig.  */
 #endif
     __pid_t pr_pid;