Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp361315imm; Mon, 1 Oct 2018 11:04:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Zn3mwyGpRYhCWGlsU+4Z/77pvPCoU9A3pDB3Gn8tZf/DEuOY0Xhw4KYCwsmwqXWY8bj/C X-Received: by 2002:a63:b709:: with SMTP id t9-v6mr2937515pgf.366.1538417088910; Mon, 01 Oct 2018 11:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538417088; cv=none; d=google.com; s=arc-20160816; b=TseBCsYz45khrIQdjlzX1lwsBKEklAQ4v4VUJchB7cTcRVt9JhZq2cmYaHGLgKj5hA SU+zLQXNd7ZR3KALqFV7K7kKe9d31aaBIN1dWV6GKvDGsPmlmAt4fCBgK6UoexfAFnCv NWXcwN2S+x16lO/11tUlG1B+6bDOsofuR6kwY8Irf/bnRaziRczF9uL6SVDl/fcUePxV gpxvqXXZj8bhLgNTtzJKniFy9nae8EuKKHbwszG1vEDw9AT/hrgPZCXdDIEQWI2LyIGN DcWd0WvN/OjXVi5QxrcHQQoe0kEK+3NnLGrT8eGOBrYNUMlJrOCVs9M9Iq/stL9vtlYi +GjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1hKeDyS7++2kPLhT6ee9TedPtguPWVHoNSg0EUEDYTo=; b=IC02ngj26WWHrw0f3XGyJxMjNDnVK+kS/9dAKDXAG5zG3xDAHzZV/e8/k5vD4M9daT lI1/yFdW+SRASUq6I3zhDtbUx65qyJtBK5Y741zRvJdOqaYleLk6Owh1cqWVROjOIEu9 tig/KpsrAf3qqCqfoBNSeFfAXL2L8sAt8TByQCicEE6uYmZEvtLr8jC5NyTO29PNmLql ImzReWS1tz4PZ7i++wwJNdKNrQFRfxxtAc+gY3xQFoNqNlqYyjw/lVDcLNCJqPUsuP5E w/x7bBkO0KmX+X2k1KPfAfkvc4d2H2M9ymYgR/MeuwBZKfJUGq9UmCs8mW0teAKQPlVz N/eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b="bj/+0aZQ"; 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 f88-v6si14367561pfh.33.2018.10.01.11.04.27; Mon, 01 Oct 2018 11:04:48 -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="bj/+0aZQ"; 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 S1726763AbeJBAmv (ORCPT + 99 others); Mon, 1 Oct 2018 20:42:51 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39931 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbeJBAmv (ORCPT ); Mon, 1 Oct 2018 20:42:51 -0400 Received: by mail-pf1-f194.google.com with SMTP id j8-v6so9805329pff.6 for ; Mon, 01 Oct 2018 11:03:52 -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 :mime-version:content-transfer-encoding; bh=1hKeDyS7++2kPLhT6ee9TedPtguPWVHoNSg0EUEDYTo=; b=bj/+0aZQis38X7vMaKa1q1epw4H/mDhp+7DZ/2LLBaVPV7GMTS3288hT2MQafC3pFN FezI7BNXxmEGJshC99GRPvb65H6oIqcv0/ur/3Hx9rqfX01ogQlaiyKKNPr3rmfSybOv mW7oTId3mLTbQBTeG8N1ixPn6m5B6G2uC72/M4KHFqbBdjSrd8+Y7aIrbfXf9B/1kRN6 +RQewISC9nEJETMCmo7wCw07JaEWJDFK8U5jp17tERv5LtGkpENuDDA9qlomjT3D6rhN pHbQ8AN4ApJCEpPVh7lpsQ+bK/4dtdzy3XmfXoUMLhcMtAUfF69bSHXz0v5HfEMqNM+C 4EKQ== 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:mime-version:content-transfer-encoding; bh=1hKeDyS7++2kPLhT6ee9TedPtguPWVHoNSg0EUEDYTo=; b=j65UREF6KptMMrFV6irBoTSCQDUmhJ6ckgGN5NPYjZGEZPcAkxqitANzP5Z4M+bUqv DChpkPiv76KiyEg4XJCVxRM3xFFzSjS7niGS0oR543VPAoQvEcV5P9xwudRDQ4+xZ4NU ard+O9C7m4Cpipai/oyLY5kym19W98vdfDK1XdL+3F2YjMYTkEqJfM4M28qGhHf5j/uf ADbpKkwxWNm8A1wUDvum0oHkpgk9HIZUGnpOI5TSUxay7MNOSEC1BTYlo2VHjmV9C0wz FFZ9C7WnqJcNHux49hkHA2ftdBa+BA0rjhOuKGuCnn2D3j2WZ8AER0sP8aBL4gWRIFxL D9dA== X-Gm-Message-State: ABuFfoj5JcIfmWrTpa6nQCZsMR0yBwfeUfIfys6pGxaJYJ4qoB+sahVJ vBlBgh7WzoKUVJamgNjriY1bWV0RoPc= X-Received: by 2002:a63:1d62:: with SMTP id d34-v6mr1925726pgm.180.1538417032183; Mon, 01 Oct 2018 11:03:52 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1612:b4fb:6752:f21f:3502]) by smtp.gmail.com with ESMTPSA id d186-v6sm24469261pfg.173.2018.10.01.11.03.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Oct 2018 11:03:51 -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 , android-kernel@android.com, Marc Zyngier , Christoffer Dall Subject: RESEND [PATCH] arm64: compat: Expose offset to registers in sigframes Date: Mon, 1 Oct 2018 10:58:37 -0700 Message-Id: <20181001175845.168430-18-salyzyn@android.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181001175845.168430-1-salyzyn@android.com> References: <20181001175845.168430-1-salyzyn@android.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Tested-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 Cc: android-kernel@android.com NB: Basically unchanged as part of a vDSO32 effort through 4 revisions, Resubmitted as a standalone change for quicker 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 52f0d44417c8..6b421666b5b8 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.19.0.605.g01d371f741-goog