From patchwork Tue Jun 13 21:09:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 21001 Received: (qmail 7421 invoked by alias); 13 Jun 2017 21:09:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 7409 invoked by uid 89); 13 Jun 2017 21:09:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Tue, 13 Jun 2017 21:09:47 +0000 From: Joseph Myers To: Subject: Fix signal stack namespace (bug 21584) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) In POSIX.1:2008, various signal stack symbols - sigaltstack, SS_*, SIGSTKSZ, MINSIGSTKSZ - are all XSI-shaded. glibc wrongly makes them visible for non-XSI POSIX. This patch fixes the conditionals, leaving the symbols available for __USE_MISC as it seems likely some of them are widely used and should be visible by default. (Note that stack_t is *not* XSI-shaded and so the conditionals on that are correctly unchanged.) Tested for x86_64. 2017-06-13 Joseph Myers [BZ #21584] * signal/signal.h: Make includes of and conditional on [__USE_XOPEN_EXTENDED || __USE_MISC]. (sigaltstack): Make declaration conditional on [__USE_XOPEN_EXTENDED || __USE_MISC]. diff --git a/signal/signal.h b/signal/signal.h index 23cd8ef..8dfe849 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -301,20 +301,22 @@ extern int sigreturn (struct sigcontext *__scp) __THROW; calls be restarted after signal SIG. */ extern int siginterrupt (int __sig, int __interrupt) __THROW; -# include # include -# include # if defined __USE_XOPEN || defined __USE_XOPEN2K8 /* This will define `ucontext_t' and `mcontext_t'. */ # include # endif +#endif /* Use POSIX.1-2008 or X/Open Unix. */ + +#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC +# include +# include /* Alternate signal handler stack interface. This interface should always be preferred over `sigstack'. */ extern int sigaltstack (const stack_t *__restrict __ss, stack_t *__restrict __oss) __THROW; - -#endif /* Use POSIX.1-2008 or X/Open Unix. */ +#endif /* __USE_XOPEN_EXTENDED || __USE_MISC */ #if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ || defined __USE_MISC)