From patchwork Mon Mar 3 06:58:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 25584 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CE0D420540 for ; Mon, 3 Mar 2014 06:58:21 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf4471654obc.9 for ; Sun, 02 Mar 2014 22:58:21 -0800 (PST) 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:x-original-sender:x-original-authentication-results; bh=XEG4WLT7MWM0E2crhKHDMwwzzHNwtyhU2HIkFOXXImw=; b=FZ3jeyn0GqZGl9hJH1NAObAB5DFoAJcmZaljl5/vhCe3fDxQCNUx2k6LG4nX1VrUBQ O5DS1Be0OTAN8MgNHfdUyNDImlhGKKoIhCA0RtzlMpBawOAxnAo0/orxwLFkXid5/2Fg RK9hl7it3wIbJvD635C7d/Lne7i4QoY+oTkH3aC0xGioxzImaUDTgnZbM8oL5IB6n4GF W6t2KTJeUBPPHaahz1fJBWz9MhkiSykMcsRRGExHf6274ASZm4QNgt2VHtvJtg0psSQx BgD2lOoT8ZLpGOdsG2OmLYDTwFamSR4LA4kejmhtT+mkc/XvGjPnPSkM18rjb6+XT0zl k0tA== X-Gm-Message-State: ALoCoQnL4C+FbRbwygVwXMVTMEOuULdr0UmGCGDW3Ae7qEXzISzJ2G5Y9SMD4VIaeIEHWTg74ZCh X-Received: by 10.50.115.4 with SMTP id jk4mr4723102igb.1.1393829901338; Sun, 02 Mar 2014 22:58:21 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.70 with SMTP id u64ls2060374qgd.86.gmail; Sun, 02 Mar 2014 22:58:21 -0800 (PST) X-Received: by 10.221.20.199 with SMTP id qp7mr15992034vcb.24.1393829901229; Sun, 02 Mar 2014 22:58:21 -0800 (PST) Received: from mail-ve0-x22f.google.com (mail-ve0-x22f.google.com [2607:f8b0:400c:c01::22f]) by mx.google.com with ESMTPS id uw4si3206888vdc.131.2014.03.02.22.58.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Mar 2014 22:58:21 -0800 (PST) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22f 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:c01::22f; Received: by mail-ve0-f175.google.com with SMTP id oz11so2323959veb.20 for ; Sun, 02 Mar 2014 22:58:21 -0800 (PST) X-Received: by 10.221.29.137 with SMTP id ry9mr15996205vcb.6.1393829901139; Sun, 02 Mar 2014 22:58:21 -0800 (PST) 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.130.193 with SMTP id u1csp33902vcs; Sun, 2 Mar 2014 22:58:20 -0800 (PST) X-Received: by 10.66.164.104 with SMTP id yp8mr17642102pab.25.1393829900273; Sun, 02 Mar 2014 22:58:20 -0800 (PST) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id zj6si9514772pac.291.2014.03.02.22.58.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Mar 2014 22:58:20 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-47764-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 23930 invoked by alias); 3 Mar 2014 06:58:11 -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 23918 invoked by uid 89); 3 Mar 2014 06:58:10 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f172.google.com X-Received: by 10.68.162.1 with SMTP id xw1mr4482341pbb.128.1393829887744; Sun, 02 Mar 2014 22:58:07 -0800 (PST) From: Will Newton To: libc-alpha@sourceware.org Subject: [PATCH 1/2] stdlib/tst-setcontext.c: Check for clobbering of signal stack. Date: Mon, 3 Mar 2014 14:58:00 +0800 Message-Id: <1393829881-22691-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:c01::22f 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-02-25 Will Newton * 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(+) 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; }