From patchwork Mon Jun 18 15:06:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salyzyn X-Patchwork-Id: 10472063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8A39D6032A for ; Mon, 18 Jun 2018 15:22:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 768AC28B13 for ; Mon, 18 Jun 2018 15:22:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6873928B25; Mon, 18 Jun 2018 15:22:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D5C8628B13 for ; Mon, 18 Jun 2018 15:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PnQ/eYP24mdZYhnmp2wWWTqT7cem0Ao1SByXRknzs6U=; b=oTM9t8freqBJgsmDIBMD2gNpEw eC25/3T+MvywT1Ok0E3JOlvmLvKyS0jUlagFOvKcfsBELQtiA/XCR/GdNXUSEKMhfKI+qsvlz1+qA XWcHo8NBGQmMIzK6bQ9RpxIGriWhEPJqDCM/1NX+S1sotLFAljej1n+l4+G8EZQzc5Wz0GjLtCLUT c0fSVVzDQUHHwqKCtDgYMzZKba6QN0Z5CMCHbBxCBIYsY0Ei3o7duYync0URJwPR4Vhkiy//jsgCq pnYC2lUW26wk9GCClRzZLnfdWADoFHjvR0Izn8rHiU7Vxcr9LXcbUkmb6iUPNeuM30Rr3sF2wHhB0 NaqmYQ4A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUvyt-0003SX-Hf; Mon, 18 Jun 2018 15:22:11 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUvvp-0000OV-Ml for linux-arm-kernel@bombadil.infradead.org; Mon, 18 Jun 2018 15:19:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YE/jYytYSn2pNCWpT5sfab90T2GfMqcfvGW9tA9CHqQ=; b=F9C7u5SlCGVkWQ3fkCgxd1M5n Ra3Ngl6TCaHrZmhbFm/37s4Od6b/OXSOBmuA8FnHGuMvjXqHlpW6dYGMbViA1TmlSZmgEM9L8jLBe CY9VKG8reooWZkCsr1hx1eSL9tLuVt+pcICPFxhoaafADjxI5WrnUb8v8lH9ubSvmxNkShrdC0Qbg kUacrld3rFgHZQh65ZSywbditW7oXm3fUJfJP/xa+eMbnK8v2EQtQ9ntEB5w6X6P5nsGbyo1MY49x mUYIZCDKb8FU51AsBq3fXUk87hWqJuIYZE4qQH6XlURiH0LcrtCVeoQGvU9xhQu+QoAeStm+Kos6I 0LQ31clxg==; Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUvmt-0000JF-FZ for linux-arm-kernel@lists.infradead.org; Mon, 18 Jun 2018 15:09:48 +0000 Received: by mail-pg0-x242.google.com with SMTP id p21-v6so7658717pgd.11 for ; Mon, 18 Jun 2018 08:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YE/jYytYSn2pNCWpT5sfab90T2GfMqcfvGW9tA9CHqQ=; b=J5TALy07TugtJU2uwHPqDZXcyPMmH30arYlCEzbQaLkx7A183Z6wWC93qpMJkNjpGE m896OL+TPnKLNfzDFvKCVXIygzt/t3f9++G6yzgLul8JHzp0UbhmcNtDYRgplYuShk4V WSzI7Nj3rTrhBJac0d4FP6hh9is2jxt0B37Hlt0FsL3AqYZf758nWEyU8n9Oe3cVsnOP 0KTmvoIRPSe7F3aw0DbYQLYlk1o7xNeW5JftcyQbqKdDczVbt1Bk5MWl3pS77CmJPsqk VYpiJZ1T6noiWqH+TZLnww2oGdy5IFPL+LXa0EV03HjT6g3LlSbuZWaHnuC6gFfz4G8c R//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YE/jYytYSn2pNCWpT5sfab90T2GfMqcfvGW9tA9CHqQ=; b=i+dxE5JSrWEiVRsuR79LYBW+LOzajRCDNbE9Frb6q/mQydlgp/quoJiXCvnwZqaWpX EJl91SF+y8K6qug/Pr5mAw9uaopot8axOqlApZc8vUNK0V6qz9omh+03c6aC3cGwes62 xXK5JmDMKG0V7zof9ILEfRSXXN7nH8hhauYu5AyXji1xzPbgKr8siKz0Ih9y8q7D0DXj 7AfY8tGtoHNRUx76p4WVPtRCopfTi3W4kmc9e/d9pmAQiNTT/iSG+xao7ubsA9PLjNta tSHC3OUkCq63o1wv1cw7mOx3vo4ArV1SA6VZchUy4lw0zmqAOVfXZY35dR5Z8RuGlpa9 N7Ig== X-Gm-Message-State: APt69E28cxGxCdhgtWdqfJdLDuMSbmNI+Q3zIl11DgbHhZtvkviDk7Eb sD0IfMRPo5Y+vCVcCakenQkkhg== X-Google-Smtp-Source: ADUXVKKb1QsMLUqlPIpGPKPK9LkNVzH0M+v4xSlVoHfVjFTeLU7nH3gHc9Rhr0CNNhnW4eIV2WnQpg== X-Received: by 2002:a62:aa18:: with SMTP id e24-v6mr13893392pff.72.1529334575044; Mon, 18 Jun 2018 08:09:35 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1611:6077:8eec:bc7e:d0f4]) by smtp.gmail.com with ESMTPSA id i7-v6sm54830660pfa.34.2018.06.18.08.09.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 08:09:34 -0700 (PDT) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Subject: RESEND [PATCH] arm64: compat: Expose offset to registers in sigframes Date: Mon, 18 Jun 2018 08:06:03 -0700 Message-Id: <20180618150613.10322-18-salyzyn@android.com> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180618150613.10322-1-salyzyn@android.com> References: <20180618150613.10322-1-salyzyn@android.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180618_110947_546779_DDCFE80B X-CRM114-Status: GOOD ( 18.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Laura Abbott , Kees Cook , Ard Biesheuvel , Marc Zyngier , Catalin Marinas , Kevin Brodsky , Will Deacon , Russell King , Jeremy Linton , Mark Salyzyn , James Morse , Andrew Pinski , Dmitry Safonov , Andy Gross , John Stultz , Thomas Gleixner , Andy Lutomirski , Dave Martin , linux-arm-kernel@lists.infradead.org, "Eric W . Biederman" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kevin Brodsky This will be needed to provide unwinding information in compat sigreturn trampolines, part of the future compat vDSO. There is no obvious header the compat_sig* struct's should be moved to, so let's put them in signal32.h. Also fix minor style issues reported by checkpatch. Signed-off-by: Kevin Brodsky Signed-off-by: Mark Salyzyn Cc: James Morse Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Andy Lutomirski Cc: Dmitry Safonov Cc: John Stultz Cc: Mark Rutland Cc: Laura Abbott Cc: Kees Cook Cc: Ard Biesheuvel Cc: Andy Gross Cc: Kevin Brodsky Cc: Andrew Pinski Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Dave Martin Cc: Eric W. Biederman Cc: Jeremy Linton NB: Basically unchanged as part of a vDSO32 effort through 4 revisions, Resubmitted as a standalone change for quciker approval. --- arch/arm64/include/asm/signal32.h | 46 +++++++++++++++++++++++++++++++ arch/arm64/kernel/asm-offsets.c | 13 +++++++++ arch/arm64/kernel/signal32.c | 46 ------------------------------- 3 files changed, 59 insertions(+), 46 deletions(-) diff --git a/arch/arm64/include/asm/signal32.h b/arch/arm64/include/asm/signal32.h index 58e288aaf0ba..bcd0e139ee4a 100644 --- a/arch/arm64/include/asm/signal32.h +++ b/arch/arm64/include/asm/signal32.h @@ -20,6 +20,52 @@ #ifdef CONFIG_COMPAT #include +struct compat_sigcontext { + /* We always set these two fields to 0 */ + compat_ulong_t trap_no; + compat_ulong_t error_code; + + compat_ulong_t oldmask; + compat_ulong_t arm_r0; + compat_ulong_t arm_r1; + compat_ulong_t arm_r2; + compat_ulong_t arm_r3; + compat_ulong_t arm_r4; + compat_ulong_t arm_r5; + compat_ulong_t arm_r6; + compat_ulong_t arm_r7; + compat_ulong_t arm_r8; + compat_ulong_t arm_r9; + compat_ulong_t arm_r10; + compat_ulong_t arm_fp; + compat_ulong_t arm_ip; + compat_ulong_t arm_sp; + compat_ulong_t arm_lr; + compat_ulong_t arm_pc; + compat_ulong_t arm_cpsr; + compat_ulong_t fault_address; +}; + +struct compat_ucontext { + compat_ulong_t uc_flags; + compat_uptr_t uc_link; + compat_stack_t uc_stack; + struct compat_sigcontext uc_mcontext; + compat_sigset_t uc_sigmask; + int __unused[32 - (sizeof(compat_sigset_t) / sizeof(int))]; + compat_ulong_t uc_regspace[128] __aligned(8); +}; + +struct compat_sigframe { + struct compat_ucontext uc; + compat_ulong_t retcode[2]; +}; + +struct compat_rt_sigframe { + struct compat_siginfo info; + struct compat_sigframe sig; +}; + int compat_setup_frame(int usig, struct ksignal *ksig, sigset_t *set, struct pt_regs *regs); int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set, diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 8938a4223690..a79507c5d845 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -81,6 +82,18 @@ int main(void) DEFINE(S_STACKFRAME, offsetof(struct pt_regs, stackframe)); DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs)); BLANK(); +#ifdef CONFIG_COMPAT + DEFINE(COMPAT_SIGFRAME_REGS_OFFSET, + offsetof(struct compat_sigframe, uc) + + offsetof(struct compat_ucontext, uc_mcontext) + + offsetof(struct compat_sigcontext, arm_r0)); + DEFINE(COMPAT_RT_SIGFRAME_REGS_OFFSET, + offsetof(struct compat_rt_sigframe, sig) + + offsetof(struct compat_sigframe, uc) + + offsetof(struct compat_ucontext, uc_mcontext) + + offsetof(struct compat_sigcontext, arm_r0)); + BLANK(); +#endif DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id.counter)); BLANK(); DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm)); diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index 9c018878056b..096c88731c56 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c @@ -30,42 +30,6 @@ #include #include -struct compat_sigcontext { - /* We always set these two fields to 0 */ - compat_ulong_t trap_no; - compat_ulong_t error_code; - - compat_ulong_t oldmask; - compat_ulong_t arm_r0; - compat_ulong_t arm_r1; - compat_ulong_t arm_r2; - compat_ulong_t arm_r3; - compat_ulong_t arm_r4; - compat_ulong_t arm_r5; - compat_ulong_t arm_r6; - compat_ulong_t arm_r7; - compat_ulong_t arm_r8; - compat_ulong_t arm_r9; - compat_ulong_t arm_r10; - compat_ulong_t arm_fp; - compat_ulong_t arm_ip; - compat_ulong_t arm_sp; - compat_ulong_t arm_lr; - compat_ulong_t arm_pc; - compat_ulong_t arm_cpsr; - compat_ulong_t fault_address; -}; - -struct compat_ucontext { - compat_ulong_t uc_flags; - compat_uptr_t uc_link; - compat_stack_t uc_stack; - struct compat_sigcontext uc_mcontext; - compat_sigset_t uc_sigmask; - int __unused[32 - (sizeof (compat_sigset_t) / sizeof (int))]; - compat_ulong_t uc_regspace[128] __attribute__((__aligned__(8))); -}; - struct compat_vfp_sigframe { compat_ulong_t magic; compat_ulong_t size; @@ -92,16 +56,6 @@ struct compat_aux_sigframe { unsigned long end_magic; } __attribute__((__aligned__(8))); -struct compat_sigframe { - struct compat_ucontext uc; - compat_ulong_t retcode[2]; -}; - -struct compat_rt_sigframe { - struct compat_siginfo info; - struct compat_sigframe sig; -}; - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set)