From patchwork Wed Sep 3 21:19:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 4838081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 87230C0338 for ; Wed, 3 Sep 2014 21:26:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9AC320219 for ; Wed, 3 Sep 2014 21:26:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D089C200C1 for ; Wed, 3 Sep 2014 21:26:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XPI26-0008A4-4X; Wed, 03 Sep 2014 21:24:02 +0000 Received: from mail-ie0-f173.google.com ([209.85.223.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XPI1b-000746-Hh for linux-arm-kernel@lists.infradead.org; Wed, 03 Sep 2014 21:23:31 +0000 Received: by mail-ie0-f173.google.com with SMTP id lx4so10536745iec.18 for ; Wed, 03 Sep 2014 14:23:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p3o72Y/BXRlaHA/TFseEHItmW1De2FZyKewPceBDvis=; b=XIWeftqeImAdfeUIgyf9L28HkY6+j4i12Z/Ibm6LV/9QUQBnoC0jkYI2Fg/DUp5Awg Pa1HmZ/QsKcm98aW5CWorixFX8aPOEAOVw44Yq2RTaoUZVJMHFuUiIDCZAilXSY5JeUM e5PlnSs2XgH8eXSRe7DJbPLR4eWBvIYeAHiES2VA4smcRmMQhJbYyagLlb0CMhdD88CS FOTira/Ja04hOF7zepUM9Yqba4GSHbAtkbkg9GqUF9dkRnBq8St8cfaG/+AX99FcezuC 7XK1MlzCkwOpKameSK/kKAG2HbbcEqWOVS+//3TPKvOlg+jYRcwvJ25BlPsrjrfngkrC 4YHw== X-Gm-Message-State: ALoCoQl4Z6nFq8RoUDSXdUr0KNh+hHGT2DM3ArF5ZicWcxYUwDwTWqtXdTTX/nBckA/4QfFOCA5d X-Received: by 10.42.62.6 with SMTP id w6mr199828ich.24.1409779390621; Wed, 03 Sep 2014 14:23:10 -0700 (PDT) Received: from localhost.localdomain (64.2.3.195.ptr.us.xo.net. [64.2.3.195]) by mx.google.com with ESMTPSA id ig9sm6515653igb.13.2014.09.03.14.23.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 14:23:10 -0700 (PDT) Received: from localhost.localdomain (apinskidesktop [127.0.0.1]) by localhost.localdomain (8.14.3/8.14.3/Debian-9.4) with ESMTP id s83LJQF6031099 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Wed, 3 Sep 2014 14:19:26 -0700 Received: (from apinski@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id s83LJQtw031098; Wed, 3 Sep 2014 14:19:26 -0700 From: Andrew Pinski To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pinskia@gmail.com Subject: [PATCH 22/24] ARM64:ILP32: Fix signal return for ILP32 when the user modified the signal stack Date: Wed, 3 Sep 2014 14:19:16 -0700 Message-Id: <1409779158-30963-23-git-send-email-apinski@cavium.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1409779158-30963-1-git-send-email-apinski@cavium.com> References: <1409779158-30963-1-git-send-email-apinski@cavium.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140903_142331_624977_E34225F7 X-CRM114-Status: GOOD ( 15.64 ) X-Spam-Score: -1.4 (-) Cc: Andrew Pinski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the user decided to change the stack_t that was on the stack when returning from the signal handler, the stack_t's padding for ILP32 might be not zero. So we need to use the syscall version of restore_altstack (ilp32_sys_sigaltstack). Signed-off-by: Andrew Pinski --- arch/arm64/kernel/signal.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index 5311147..6316d54 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -35,6 +35,7 @@ #include #include #include +#include /* * Do a signal return; undo the signal stack. These are aligned to 128-bit. @@ -149,6 +150,19 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) if (restore_sigframe(regs, frame)) goto badframe; +#ifdef CONFIG_ARM64_ILP32 + /* + * ILP32 has to be handled "special" due to maybe not zeroing out + * the upper 32bits of the pointer if the user changed the frame. + */ + if (is_ilp32_compat_task()) { + if (ilp32_sys_sigaltstack(&frame->uc.uc_stack, + NULL) == -EFAULT) + goto badframe; + return regs->regs[0]; + } +#endif + if (restore_altstack(&frame->uc.uc_stack)) goto badframe;