From patchwork Thu Mar 13 10:45:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 26199 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EECCC206A0 for ; Thu, 13 Mar 2014 10:46:25 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf3235627oag.2 for ; Thu, 13 Mar 2014 03:46:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results; bh=ORd31wmEcs/C8387wMT1rOj3UlchpQGSuCObFfh/HMI=; b=BNvPJoZTVmaMnqCPz8oOGfflANRXTjMupydTAeAPiggstZN1ItgcHBnIo1aKAkVoqY ehqSDe3/ZOwDFSub/Amb0IlTyllJISTFl01CU9N0bZ5lkacAcT5Y/7EKjr9YspgdgK+i ZqQkzbzrwecASk0RjD/KdLiwu/dfq3vtHsEBJaFd27hXugIG5EPl8VRWi1783p/DzBLB jMCAawJwbijIN6oVGDFKTwHCkGcsRW64PNP3MaGFsWIcYGJ0GemRRa+kI1VP5v4AB8El SLgXGpjLpJiNwBWR4aMGP16nkSsDagrQ/e3nXY8d7Y75yZXR0rwtPqsLsmaYp4stTNIl 3ycw== X-Gm-Message-State: ALoCoQnvpemcxzLiKA8E7Q7SocN2lNoQWoqXbtAZTulhTOj+g1qqJd9vNUditfZSPIrNcrRwSp25 X-Received: by 10.182.29.196 with SMTP id m4mr484479obh.26.1394707585532; Thu, 13 Mar 2014 03:46:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.231 with SMTP id n94ls254812qgd.24.gmail; Thu, 13 Mar 2014 03:46:25 -0700 (PDT) X-Received: by 10.58.229.167 with SMTP id sr7mr803007vec.7.1394707585346; Thu, 13 Mar 2014 03:46:25 -0700 (PDT) Received: from mail-vc0-x233.google.com (mail-vc0-x233.google.com [2607:f8b0:400c:c03::233]) by mx.google.com with ESMTPS id ue9si654817veb.130.2014.03.13.03.46.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Mar 2014 03:46:25 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c03::233 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c03::233; Received: by mail-vc0-f179.google.com with SMTP id ij19so859926vcb.38 for ; Thu, 13 Mar 2014 03:46:25 -0700 (PDT) X-Received: by 10.58.161.205 with SMTP id xu13mr853054veb.4.1394707585212; Thu, 13 Mar 2014 03:46:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp357652vck; Thu, 13 Mar 2014 03:46:24 -0700 (PDT) X-Received: by 10.67.14.231 with SMTP id fj7mr1290994pad.115.1394707584405; Thu, 13 Mar 2014 03:46:24 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id si7si395402pbc.311.2014.03.13.03.46.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Mar 2014 03:46:24 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-48042-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 29164 invoked by alias); 13 Mar 2014 10:45:58 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 29100 invoked by uid 89); 13 Mar 2014 10:45:57 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f169.google.com X-Received: by 10.180.100.103 with SMTP id ex7mr1059587wib.24.1394707551749; Thu, 13 Mar 2014 03:45:51 -0700 (PDT) From: Will Newton To: libc-alpha@sourceware.org Subject: [PATCH 3/4] stdlib/tst-setcontext.c: Check for clobbering of signal stack Date: Thu, 13 Mar 2014 10:45:42 +0000 Message-Id: <1394707543-9690-3-git-send-email-will.newton@linaro.org> In-Reply-To: <1394707543-9690-1-git-send-email-will.newton@linaro.org> References: <1394707543-9690-1-git-send-email-will.newton@linaro.org> X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c03::233 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 On aarch64 calling swapcontext clobbers the state of the signal stack (BZ #16629). Check that the address and size of the signal stack before and after the call to swapcontext remains the same. ChangeLog: 2014-03-13 Will Newton * stdlib/tst-setcontext.c: Include signal.h. (main): Check that the signal stack before and after swapcontext is the same (BZ #16629). --- stdlib/tst-setcontext.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/stdlib/tst-setcontext.c b/stdlib/tst-setcontext.c index ac9deb1..55984a4 100644 --- a/stdlib/tst-setcontext.c +++ b/stdlib/tst-setcontext.c @@ -16,6 +16,7 @@ . */ #include +#include #include #include #include @@ -144,6 +145,9 @@ main (void) atexit (check_called); char st1[32768]; + stack_t stack_before, stack_after; + + sigaltstack(NULL, &stack_before); puts ("making contexts"); if (getcontext (&ctx[1]) != 0) @@ -207,6 +211,8 @@ main (void) puts ("back at main program"); back_in_main = 1; + sigaltstack(NULL, &stack_after); + if (was_in_f1 == 0) { puts ("didn't reach f1"); @@ -218,6 +224,21 @@ main (void) exit (1); } + /* Check sigaltstack state is not clobbered as in BZ #16629. */ + if (stack_before.ss_sp != stack_after.ss_sp) + { + printf ("stack ss_sp mismatch: %p %p\n", + stack_before.ss_sp, stack_after.ss_sp); + exit (1); + } + + if (stack_before.ss_size != stack_after.ss_size) + { + printf ("stack ss_size mismatch: %zd %zd\n", + stack_before.ss_size, stack_after.ss_size); + exit (1); + } + puts ("test succeeded"); return 0; }