Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4038336imm; Mon, 18 Jun 2018 08:10:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK7BiySbxO98a85MQ8WJe+7SVxGqm15v7oEwbzhcC19O8GKsbtMCOTdiaTlwAK2hyS4krvm X-Received: by 2002:a65:5884:: with SMTP id d4-v6mr11154553pgu.292.1529334643582; Mon, 18 Jun 2018 08:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529334643; cv=none; d=google.com; s=arc-20160816; b=yD2utE3hey8dEs7zEQAFKgv83nnLIb5ET0M7gV++gyiO1QFhvJO3MKl7yezydL0/nf WslLOKaLH7cT25OQtzTihM5uB5NLz05xqEmvqlPmXboNK3+ws71sBD9dAFDTlf+EGihw w1RpfBkgrZs1XmKxEoU8Q+6anC/LzssL+VAlZuFH0fGRzWAsukJLwJ571YD6Zv4DVuSC PS/DWcOdjzwq5HVnFl5cIj/MhjYkgVvTFMtZD8Ti0ladDPx/1CnOtjZy0TdABendB35j QaA6t39Xd/ezY7M9B9hhXDLBSK3hlR7wqFNN314kupSAAXHIyCIgjKXO6qBIz4cuDUq4 Neow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=YE/jYytYSn2pNCWpT5sfab90T2GfMqcfvGW9tA9CHqQ=; b=te97Z0NEefPK81bSpdeJlR0FFlBYmO7MA15oTS3BYHJDOssj3xZ/wA3DLEul1TJR3t ZoMyrz4LS7FyfJ91yGUtPhWm6QAwafyvbgbbcugrAqfVp3tWGIWgSbuD0Z/MLjp/G8JP ov8atXMMvVR9pehi1ygjGnR+WHKJf17X+2LsOPKwp16e4oJ1Gs9cICvZ45pe2sFEuRng FlDC2PHhC7R5gq6Y+QNvU0xe+GaEMAJ/ftxkbhVnUdlX9HxWLHQVP3hTLyyjFbFJutyj m/YjhngBVYcCqem7Hs3VfeV14/J8HZCRyDfojNjB/vjb2o5JfbWQvMkMNKYJ7iVNSn0l jX0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=J5TALy07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12-v6si12371817pgt.384.2018.06.18.08.10.29; Mon, 18 Jun 2018 08:10:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=J5TALy07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935768AbeFRPJj (ORCPT + 99 others); Mon, 18 Jun 2018 11:09:39 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:40400 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935310AbeFRPJf (ORCPT ); Mon, 18 Jun 2018 11:09:35 -0400 Received: by mail-pg0-f65.google.com with SMTP id w8-v6so4638290pgp.7 for ; Mon, 18 Jun 2018 08:09:35 -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=VmqoQ2u1srN2lWs4OkU+/uQqU3PUmoQos52srcv+c8AuWLJhhqXdBf3R+ATRBEDZDU EZssHHGv41sZZzT3kmPabB65heBwZGrO6IaEqEHD72NRKxpVwo5ZI5CmsR8xdRgqSlz/ Ix350tb1uzhD3SoiBcqnYBzfYm2kSXIUcOeqSVdGmG7rRSIGfVgeEw96C3CinuE8oAyw HCKBT87ov+Rw2p+PtucxTaWBpmH7CL5K/h5X+8lH0TsT53LfX1iloScm1M5INPFqXsU2 byvjB1+/Ph+xTXNBDkLGqoLJ4YTPg2weM1v+NkR4O3syfz6E10nTGB2fIlf1+pqfXDkC RxjA== X-Gm-Message-State: APt69E2Kz8piAw7eRYUVvBxAP9w0E95V2zydt1KM/jalBiesZ3VSSvG7 N9qR4TZDNqKxzTLfw8kt3hMgPvUoHCw= 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 Cc: Kevin Brodsky , Mark Salyzyn , James Morse , Russell King , Catalin Marinas , Will Deacon , Andy Lutomirski , Dmitry Safonov , John Stultz , Mark Rutland , Laura Abbott , Kees Cook , Ard Biesheuvel , Andy Gross , Andrew Pinski , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Dave Martin , "Eric W . Biederman" , Jeremy Linton , Marc Zyngier 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.18.0.rc1.244.gcf134e6275-goog