From: Dave Martin <Dave.Martin@arm.com>
To: Amit Daniel Kachhap <amit.kachhap@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Kees Cook <keescook@chromium.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Mark Brown <broonie@kernel.org>,
James Morse <james.morse@arm.com>,
Vincenzo Frascino <Vincenzo.Frascino@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 2/6] arm64: traps: Allow force_signal_inject to pass esr error code
Date: Wed, 2 Sep 2020 16:39:13 +0100 [thread overview]
Message-ID: <20200902153912.GF6642@arm.com> (raw)
In-Reply-To: <1597734671-23407-3-git-send-email-amit.kachhap@arm.com>
On Tue, Aug 18, 2020 at 12:41:07PM +0530, Amit Daniel Kachhap wrote:
> Some error signal need to pass proper ARM esr error code to userspace to
> better identify the cause of the signal. So the function
> force_signal_inject is extended to pass this as a parameter. The
> existing code is not affected by this change.
>
> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Seems reasonable to me, thanks.
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
> ---
> Changes since v4:
> * New patch.
>
> arch/arm64/include/asm/traps.h | 2 +-
> arch/arm64/kernel/fpsimd.c | 4 ++--
> arch/arm64/kernel/traps.c | 14 +++++++-------
> 3 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm64/include/asm/traps.h b/arch/arm64/include/asm/traps.h
> index cee5928e1b7d..d96dc2c7c09d 100644
> --- a/arch/arm64/include/asm/traps.h
> +++ b/arch/arm64/include/asm/traps.h
> @@ -24,7 +24,7 @@ struct undef_hook {
>
> void register_undef_hook(struct undef_hook *hook);
> void unregister_undef_hook(struct undef_hook *hook);
> -void force_signal_inject(int signal, int code, unsigned long address);
> +void force_signal_inject(int signal, int code, unsigned long address, unsigned int err);
> void arm64_notify_segfault(unsigned long addr);
> void arm64_force_sig_fault(int signo, int code, void __user *addr, const char *str);
> void arm64_force_sig_mceerr(int code, void __user *addr, short lsb, const char *str);
> diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
> index 55c8f3ec6705..77484359d44a 100644
> --- a/arch/arm64/kernel/fpsimd.c
> +++ b/arch/arm64/kernel/fpsimd.c
> @@ -312,7 +312,7 @@ static void fpsimd_save(void)
> * re-enter user with corrupt state.
> * There's no way to recover, so kill it:
> */
> - force_signal_inject(SIGKILL, SI_KERNEL, 0);
> + force_signal_inject(SIGKILL, SI_KERNEL, 0, 0);
> return;
> }
>
> @@ -936,7 +936,7 @@ void do_sve_acc(unsigned int esr, struct pt_regs *regs)
> {
> /* Even if we chose not to use SVE, the hardware could still trap: */
> if (unlikely(!system_supports_sve()) || WARN_ON(is_compat_task())) {
> - force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc);
> + force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
> return;
> }
>
> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> index 47f651df781c..eb19f985f0bc 100644
> --- a/arch/arm64/kernel/traps.c
> +++ b/arch/arm64/kernel/traps.c
> @@ -412,7 +412,7 @@ static int call_undef_hook(struct pt_regs *regs)
> return fn ? fn(regs, instr) : 1;
> }
>
> -void force_signal_inject(int signal, int code, unsigned long address)
> +void force_signal_inject(int signal, int code, unsigned long address, unsigned int err)
> {
> const char *desc;
> struct pt_regs *regs = current_pt_regs();
> @@ -438,7 +438,7 @@ void force_signal_inject(int signal, int code, unsigned long address)
> signal = SIGKILL;
> }
>
> - arm64_notify_die(desc, regs, signal, code, (void __user *)address, 0);
> + arm64_notify_die(desc, regs, signal, code, (void __user *)address, err);
> }
>
> /*
> @@ -455,7 +455,7 @@ void arm64_notify_segfault(unsigned long addr)
> code = SEGV_ACCERR;
> mmap_read_unlock(current->mm);
>
> - force_signal_inject(SIGSEGV, code, addr);
> + force_signal_inject(SIGSEGV, code, addr, 0);
> }
>
> void do_undefinstr(struct pt_regs *regs)
> @@ -468,14 +468,14 @@ void do_undefinstr(struct pt_regs *regs)
> return;
>
> BUG_ON(!user_mode(regs));
> - force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc);
> + force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
> }
> NOKPROBE_SYMBOL(do_undefinstr);
>
> void do_bti(struct pt_regs *regs)
> {
> BUG_ON(!user_mode(regs));
> - force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc);
> + force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
> }
> NOKPROBE_SYMBOL(do_bti);
>
> @@ -528,7 +528,7 @@ static void user_cache_maint_handler(unsigned int esr, struct pt_regs *regs)
> __user_cache_maint("ic ivau", address, ret);
> break;
> default:
> - force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc);
> + force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
> return;
> }
>
> @@ -581,7 +581,7 @@ static void mrs_handler(unsigned int esr, struct pt_regs *regs)
> sysreg = esr_sys64_to_sysreg(esr);
>
> if (do_emulate_mrs(regs, sysreg, rt) != 0)
> - force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc);
> + force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
> }
>
> static void wfi_handler(unsigned int esr, struct pt_regs *regs)
> --
> 2.17.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-09-02 15:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-18 7:11 [PATCH v5 0/6] arm64: add Armv8.3 pointer authentication enhancements Amit Daniel Kachhap
2020-08-18 7:11 ` [PATCH v5 1/6] arm64: kprobe: add checks for ARMv8.3-PAuth combined instructions Amit Daniel Kachhap
2020-09-02 15:39 ` Dave Martin
2020-09-04 6:15 ` Amit Kachhap
2020-08-18 7:11 ` [PATCH v5 2/6] arm64: traps: Allow force_signal_inject to pass esr error code Amit Daniel Kachhap
2020-09-02 15:39 ` Dave Martin [this message]
2020-08-18 7:11 ` [PATCH v5 3/6] arm64: ptrauth: Introduce Armv8.3 pointer authentication enhancements Amit Daniel Kachhap
2020-09-02 15:39 ` Dave Martin
2020-08-18 7:11 ` [PATCH v5 4/6] arm64: cpufeature: Modify address authentication cpufeature to exact Amit Daniel Kachhap
2020-09-02 14:05 ` Suzuki K Poulose
2020-08-18 7:11 ` [PATCH v5 5/6] arm64: kprobe: disable probe of fault prone ptrauth instruction Amit Daniel Kachhap
2020-08-18 7:11 ` [PATCH v5 6/6] arm64: kprobe: clarify the comment of steppable hint instructions Amit Daniel Kachhap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200902153912.GF6642@arm.com \
--to=dave.martin@arm.com \
--cc=Vincenzo.Frascino@arm.com \
--cc=amit.kachhap@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).