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: 36661 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EEA93202E4 for ; Wed, 3 Sep 2014 21:24:06 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf54078985pdb.5 for ; Wed, 03 Sep 2014 14:24:06 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=KLsM1JHPeUseYY3ao2hyvQZxOYoBv4qICbF2VCOB2xU=; b=AdxSUoqcecWlN6dNkEc56gtSN62lnXqXZiwnhN2wX3u3dr6LhfcXBEMuXze+2FSVWf 0gccaMWTAYpYej1B8bGfdVaAZrBPv+LwfBwDhyx1bf9sPFIAhuvWDHnrSeNFSozqNRXz ApEouL8uRPo6dejFf4gCWPLZN9kBQ4QWO9sQfOkBPi2V/jETESxMhV1X5e9nWbjTBzQR SlmdT0/7StOYZIlILK7c34CmvLpOgX3/e0Tb+xjfQlFvKUzoBQNvyhQq3GPn+Yu5716a 9joNHqmPVet4crak/3pOOAw1y28ZUW6ch6yT5B5FoXwwbz/gq5w7MGUNh/eNurgvhqYN rEOg== X-Gm-Message-State: ALoCoQmLYKI2ys4sjRq08RihdBXaO+ZfOZYVJDk7mRqErogPnn/9xTlSg8P1+d7yYdnaaY3Gqxm9 X-Received: by 10.66.147.227 with SMTP id tn3mr130381pab.4.1409779445238; Wed, 03 Sep 2014 14:24:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.98.212 with SMTP id o78ls20030qge.55.gmail; Wed, 03 Sep 2014 14:24:05 -0700 (PDT) X-Received: by 10.220.74.10 with SMTP id s10mr144477vcj.61.1409779445135; Wed, 03 Sep 2014 14:24:05 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id p4si4454616vcn.54.2014.09.03.14.24.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 14:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hq11so9604631vcb.36 for ; Wed, 03 Sep 2014 14:24:05 -0700 (PDT) X-Received: by 10.52.119.229 with SMTP id kx5mr72027vdb.40.1409779445063; Wed, 03 Sep 2014 14:24:05 -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.221.45.67 with SMTP id uj3csp740482vcb; Wed, 3 Sep 2014 14:24:04 -0700 (PDT) X-Received: by 10.70.15.161 with SMTP id y1mr8332pdc.61.1409779443305; Wed, 03 Sep 2014 14:24:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qj8si13239336pac.189.2014.09.03.14.24.02 for ; Wed, 03 Sep 2014 14:24:03 -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 S932932AbaICVX7 (ORCPT + 26 others); Wed, 3 Sep 2014 17:23:59 -0400 Received: from mail-ig0-f179.google.com ([209.85.213.179]:58404 "EHLO mail-ig0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932684AbaICVXL (ORCPT ); Wed, 3 Sep 2014 17:23:11 -0400 Received: by mail-ig0-f179.google.com with SMTP id r2so9892214igi.12 for ; Wed, 03 Sep 2014 14:23:10 -0700 (PDT) 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 Cc: Andrew Pinski 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> 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.177 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). 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;