From patchwork Sat May 24 07:02:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 30886 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 290F32066E for ; Sat, 24 May 2014 07:11:01 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id lc6sf20408721vcb.3 for ; Sat, 24 May 2014 00:11:00 -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:from:to:cc:subject :date:message-id:in-reply-to:references:to:to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=J+VYFNvDVBEpX4UN2XeqhW4+wighBW3GpMqfRq+oJqw=; b=VSnI/FYMbHKy0r0Zex+hXhuqSmzVPseKs8PnIEgx7v8b/VBwPjhJgP5G0UUMztHSeo tWRUQafMsJoq7yUpjwqBOPD7va0N+KoXqnJ7x3FlZTKfQfDgLwkn2F5NaOCUzXqpJG0a I6oYORu4DL9e41lSOK01v+DaHe/AVMdKi27nrlAyGDFJRAq7dk9LVuFcdMOvP9TIe8wP L+cFStnkWwDZrZrw1UcKAOfqoBnWkaOdPwwZTV79dkaeV3msieJvFqbTdAFdBd6mcnRs OHwQDiy8V+6FrzSMZ/nRhSF6DyuUMqoO0g5iHeVt7RBirQiVcEHpSpFKOcS0XofVkSq6 ilpw== X-Gm-Message-State: ALoCoQnlYc+DVF4jk8DN3P9KfJmOCq4RN327HPhY9Q9BvCjP4U30YTJU4s26uaGEpBMLDGeweP8t X-Received: by 10.236.199.108 with SMTP id w72mr3972726yhn.10.1400915460949; Sat, 24 May 2014 00:11:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.72 with SMTP id k66ls1823323qgd.96.gmail; Sat, 24 May 2014 00:11:00 -0700 (PDT) X-Received: by 10.52.241.98 with SMTP id wh2mr23848vdc.37.1400915460849; Sat, 24 May 2014 00:11:00 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id rs1si3079880vec.31.2014.05.24.00.11.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 May 2014 00:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id ik5so3930925vcb.17 for ; Sat, 24 May 2014 00:11:00 -0700 (PDT) X-Received: by 10.52.125.198 with SMTP id ms6mr7019581vdb.28.1400915460771; Sat, 24 May 2014 00:11:00 -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.221.72 with SMTP id ib8csp87777vcb; Sat, 24 May 2014 00:11:00 -0700 (PDT) X-Received: by 10.68.213.97 with SMTP id nr1mr11907562pbc.52.1400915460056; Sat, 24 May 2014 00:11:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gq7si6892609pac.237.2014.05.24.00.10.59 for ; Sat, 24 May 2014 00:10:59 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751882AbaEXHKw (ORCPT + 27 others); Sat, 24 May 2014 03:10:52 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:35443 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751433AbaEXHJ1 (ORCPT ); Sat, 24 May 2014 03:09:27 -0400 Received: by mail-ie0-f174.google.com with SMTP id lx4so5964239iec.19 for ; Sat, 24 May 2014 00:09:26 -0700 (PDT) X-Received: by 10.50.25.105 with SMTP id b9mr10102488igg.28.1400915366932; Sat, 24 May 2014 00:09:26 -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 qh3sm10016919igb.17.2014.05.24.00.09.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 24 May 2014 00:09:26 -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 s4O72NVg009836 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Sat, 24 May 2014 00:02:23 -0700 Received: (from apinski@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id s4O72NeG009835; Sat, 24 May 2014 00:02:23 -0700 From: Andrew Pinski To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Andrew Pinski Subject: [PATCH 23/24] ARM64:ILP32: Fix signal return for ILP32 when the user modified the signal stack. Date: Sat, 24 May 2014 00:02:18 -0700 Message-Id: <1400914939-9708-24-git-send-email-apinski@cavium.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1400914939-9708-1-git-send-email-apinski@cavium.com> References: <1400914939-9708-1-git-send-email-apinski@cavium.com> To: linux-arm-kernel@lists.infradead.org To: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: apinski@cavium.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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). Thanks, Andrew Pinski Signed-off-by: Andrew Pinski --- arch/arm64/kernel/signal.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index fd49b58..d5682b6 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -34,6 +34,7 @@ #include #include #include +#include /* * Do a signal return; undo the signal stack. These are aligned to 128-bit. @@ -149,6 +150,17 @@ 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;