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

Commit 006a1212 authored by Catalin Marinas's avatar Catalin Marinas Committed by Joonwoo Park
Browse files

arm64: Expose ESR_EL1 information to user when SIGSEGV/SIGBUS



This information is useful for instruction emulators to detect
read/write and access size without having to decode the faulting
instruction. The current patch exports it via sigcontext (struct
esr_context) and is only valid for SIGSEGV and SIGBUS.

Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Git-commit: 15af1942dd61ee236a48b3de14d6f31c0b9e8116
Signed-off-by: default avatarJoonwoo Park <joonwoop@codeaurora.org>
parent ddae87d7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -53,5 +53,12 @@ struct fpsimd_context {
	__uint128_t vregs[32];
};

/* ESR_EL1 context */
#define ESR_MAGIC	0x45535201

struct esr_context {
	struct _aarch64_ctx head;
	u64 esr;
};

#endif /* _UAPI__ASM_SIGCONTEXT_H */
+10 −0
Original line number Diff line number Diff line
@@ -191,6 +191,16 @@ static int setup_sigframe(struct rt_sigframe __user *sf,
		aux += sizeof(*fpsimd_ctx);
	}

	/* fault information, if valid */
	if (current->thread.fault_code) {
		struct esr_context *esr_ctx =
			container_of(aux, struct esr_context, head);
		__put_user_error(ESR_MAGIC, &esr_ctx->head.magic, err);
		__put_user_error(sizeof(*esr_ctx), &esr_ctx->head.size, err);
		__put_user_error(current->thread.fault_code, &esr_ctx->esr, err);
		aux += sizeof(*esr_ctx);
	}

	/* set the "end" magic */
	end = aux;
	__put_user_error(0, &end->magic, err);