From patchwork Tue Apr 1 11:32:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 27530 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8958220341 for ; Tue, 1 Apr 2014 11:33:19 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id lh14sf22821990vcb.6 for ; Tue, 01 Apr 2014 04:33:19 -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=X+ZAcWayetkDz0kM+uNP+Z4PPECrMZ0UqdBd9knz+gY=; b=ZlpZ4nLuOkFcHQnJwLwvipkEiSvUZiJlAcyWnstctb0HVOmy6k1lVIgegXP1MARmNT bqW9shAmuE1ynyloDGH9fHpVID6fG3Ac+5zXel+rD2tJlYDWRpVGs3mKvApPcKRClHOA JV6hQjH3nUdpFdiyAWEOCvGRfPAfAzugey2ntS8dUAVBY7BWg7DWqdqBkfhbz2vMSFFe EaVBMLwc0oATTwsOnuZjrcY6ga1WNw6Ztn8rCWtr3+6o0tl6my/iR0x2PHXtlClA+X4/ Ow4sos4dsPAUsjBmfenGph0PsHuaea0BiCVJWUlNLb6xbO153kMQH8gw9RN/Jwt2FsIi kh2w== X-Gm-Message-State: ALoCoQn6SVJ8fETEYmqo1noZQI2CUEzaext8QgvMc7pEXw/QkOLep+jy/YPe5f9YtQ8hqWUUf3jq X-Received: by 10.52.165.179 with SMTP id yz19mr11114980vdb.1.1396351999013; Tue, 01 Apr 2014 04:33:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.163 with SMTP id a32ls2786570qgf.73.gmail; Tue, 01 Apr 2014 04:33:18 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr28039786vcb.2.1396351998926; Tue, 01 Apr 2014 04:33:18 -0700 (PDT) Received: from mail-vc0-x234.google.com (mail-vc0-x234.google.com [2607:f8b0:400c:c03::234]) by mx.google.com with ESMTPS id sh5si3545939vdc.32.2014.04.01.04.33.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Apr 2014 04:33:18 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c03::234 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::234; Received: by mail-vc0-f180.google.com with SMTP id lf12so9236416vcb.25 for ; Tue, 01 Apr 2014 04:33:18 -0700 (PDT) X-Received: by 10.221.34.7 with SMTP id sq7mr28245602vcb.5.1396351998820; Tue, 01 Apr 2014 04:33:18 -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.12.8 with SMTP id v8csp228302vcv; Tue, 1 Apr 2014 04:33:18 -0700 (PDT) X-Received: by 10.68.200.133 with SMTP id js5mr9422033pbc.138.1396351997741; Tue, 01 Apr 2014 04:33:17 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id og9si11047648pbb.327.2014.04.01.04.33.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Apr 2014 04:33:17 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-48770-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 4888 invoked by alias); 1 Apr 2014 11:32:59 -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 4863 invoked by uid 89); 1 Apr 2014 11:32:58 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f172.google.com X-Received: by 10.194.59.43 with SMTP id w11mr13247537wjq.65.1396351973933; Tue, 01 Apr 2014 04:32:53 -0700 (PDT) From: Will Newton To: libc-alpha@sourceware.org Subject: [PATCH v2 2/3] stdlib/tst-setcontext.c: Check for clobbering of signal stack Date: Tue, 1 Apr 2014 12:32:46 +0100 Message-Id: <1396351967-1952-2-git-send-email-will.newton@linaro.org> In-Reply-To: <1396351967-1952-1-git-send-email-will.newton@linaro.org> References: <1396351967-1952-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::234 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-04-01 Will Newton [BZ #16629] * stdlib/tst-setcontext.c: Include signal.h. (main): Check that the signal stack before and after swapcontext is the same. --- stdlib/tst-setcontext.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) Changes in v2: - Fixed changelog bug reference 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; }