[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/8] linux-user/arm: Report SIGBUS and SIGSEGV correctly
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2 4/8] linux-user/arm: Report SIGBUS and SIGSEGV correctly |
Date: |
Thu, 26 Aug 2021 14:31:05 +0100 |
On Sat, 21 Aug 2021 at 21:03, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Pull the fault information from where we placed it, in
> arm_cpu_tlb_fill and arm_cpu_do_unaligned_access.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> Pulled out from the larger unaligned data patch set.
> For short-form FSC, pc misalignment is reported in the same way.
> ---
> linux-user/arm/cpu_loop.c | 39 ++++++++++++++++++++++++++++++++++-----
> 1 file changed, 34 insertions(+), 5 deletions(-)
>
> diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
> + case 0x3: /* Access flag fault, level 1 */
> + case 0x6: /* Access flag fault, level 2 */
> + case 0x9: /* Domain fault, level 1 */
> + case 0xb: /* Domain fault, level 2 */
> + case 0xd: /* Permision fault, level 1 */
> + case 0xf: /* Permision fault, level 2 */
"Permission"
> + si_signo = TARGET_SIGSEGV;
> + si_code = TARGET_SEGV_ACCERR;
> + break;
> + case 0x5: /* Translation fault, level 1 */
> + case 0x7: /* Translation fault, level 2 */
> + si_signo = TARGET_SIGSEGV;
> + si_code = TARGET_SEGV_MAPERR;
> + break;
Side note: for cases like this where we can tell MAPERR from
ACCERR based on info the exception handler passes to us, should
we prefer that or the "check the page flags" approach that
force_sigsegv_for_addr() takes ? I feel like the former is
nicer, because in a multithreaded program some other thread
might have changed whether the page is mapped between our taking
the fault and getting here. But maybe that's always racy...
Anyway, other than the typo,
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
- [PATCH v2 0/8] target/arm: Fix insn exception priorities, Richard Henderson, 2021/08/21
- [PATCH v2 1/8] target/arm: Take an exception if PSTATE.IL is set, Richard Henderson, 2021/08/21
- [PATCH v2 2/8] target/arm: Merge disas_a64_insn into aarch64_tr_translate_insn, Richard Henderson, 2021/08/21
- [PATCH v2 4/8] linux-user/arm: Report SIGBUS and SIGSEGV correctly, Richard Henderson, 2021/08/21
- Re: [PATCH v2 4/8] linux-user/arm: Report SIGBUS and SIGSEGV correctly,
Peter Maydell <=
- [PATCH v2 3/8] linux-user/aarch64: Handle EC_PCALIGNMENT, Richard Henderson, 2021/08/21
- [PATCH v2 5/8] target/arm: Take an exception if PC is misaligned, Richard Henderson, 2021/08/21
- [PATCH v2 7/8] target/arm: Suppress bp for exceptions with more priority, Richard Henderson, 2021/08/21
- [PATCH v2 6/8] target/arm: Assert thumb pc is aligned, Richard Henderson, 2021/08/21
- [PATCH v2 8/8] tests/tcg: Add arm and aarch64 pc alignment tests, Richard Henderson, 2021/08/21