Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 85ba8598 authored by Kevin Brodsky's avatar Kevin Brodsky Committed by derfelot
Browse files

FROMLIST: [PATCH] arm64: compat: Expose offset to registers in sigframes

(cherry picked from url https://patchwork.kernel.org/patch/10006025/

)

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: default avatarKevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: default avatarMark Salyzyn <salyzyn@android.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Andy Gross <andy.gross@linaro.org>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Bug: 63737556
Bug: 20045882
Change-Id: I9c23dd6b56ca48c0953cbf78ccb7b49ded906052
parent 62d0217e
Loading
Loading
Loading
Loading
+46 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,52 @@
#ifdef CONFIG_COMPAT
#ifdef CONFIG_COMPAT
#include <linux/compat.h>
#include <linux/compat.h>


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,
int compat_setup_frame(int usig, struct ksignal *ksig, sigset_t *set,
		       struct pt_regs *regs);
		       struct pt_regs *regs);
int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
+13 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@
#include <asm/fixmap.h>
#include <asm/fixmap.h>
#include <asm/thread_info.h>
#include <asm/thread_info.h>
#include <asm/memory.h>
#include <asm/memory.h>
#include <asm/signal32.h>
#include <asm/smp_plat.h>
#include <asm/smp_plat.h>
#include <asm/suspend.h>
#include <asm/suspend.h>
#include <asm/vdso_datapage.h>
#include <asm/vdso_datapage.h>
@@ -83,6 +84,18 @@ int main(void)
  DEFINE(S_ORIG_ADDR_LIMIT,	offsetof(struct pt_regs, orig_addr_limit));
  DEFINE(S_ORIG_ADDR_LIMIT,	offsetof(struct pt_regs, orig_addr_limit));
  DEFINE(S_FRAME_SIZE,		sizeof(struct pt_regs));
  DEFINE(S_FRAME_SIZE,		sizeof(struct pt_regs));
  BLANK();
  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));
  DEFINE(MM_CONTEXT_ID,		offsetof(struct mm_struct, context.id.counter));
  BLANK();
  BLANK();
  DEFINE(VMA_VM_MM,		offsetof(struct vm_area_struct, vm_mm));
  DEFINE(VMA_VM_MM,		offsetof(struct vm_area_struct, vm_mm));
+0 −46
Original line number Original line Diff line number Diff line
@@ -29,42 +29,6 @@
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <asm/unistd.h>


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 {
struct compat_vfp_sigframe {
	compat_ulong_t	magic;
	compat_ulong_t	magic;
	compat_ulong_t	size;
	compat_ulong_t	size;
@@ -91,16 +55,6 @@ struct compat_aux_sigframe {
	unsigned long			end_magic;
	unsigned long			end_magic;
} __attribute__((__aligned__(8)));
} __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)))
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))


static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set)
static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set)