binutils-gdb/gdb/arch
Luis Machado d88cb738e6 [aarch64] Fix removal of non-address bits for PAuth
PR gdb/28947

The address_significant gdbarch setting was introduced as a way to remove
non-address bits from pointers, and it is specified by a constant.  This
constant represents the number of address bits in a pointer.

Right now AArch64 is the only architecture that uses it, and 56 was a
correct option so far.

But if we are using Pointer Authentication (PAuth), we might use up to 2 bytes
from the address space to store the required information.  We could also have
cases where we're using both PAuth and MTE.

We could adjust the constant to 48 to cover those cases, but this doesn't
cover the case where GDB needs to sign-extend kernel addresses after removal
of the non-address bits.

This has worked so far because bit 55 is used to select between kernel-space
and user-space addresses.  But trying to clear a range of bits crossing the
bit 55 boundary requires the hook to be smarter.

The following patch renames the gdbarch hook from significant_addr_bit to
remove_non_address_bits and passes a pointer as opposed to the number of
bits.  The hook is now responsible for removing the required non-address bits
and sign-extending the address if needed.

While at it, make GDB and GDBServer share some more code for aarch64 and add a
new arch-specific testcase gdb.arch/aarch64-non-address-bits.exp.

Bug-url: https://sourceware.org/bugzilla/show_bug.cgi?id=28947

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2022-12-16 11:18:32 +00:00
..
aarch32.c Add an arm-tls feature which includes the tpidruro register from CP15. 2022-05-03 16:05:10 -07:00
aarch32.h
aarch64-insn.c
aarch64-insn.h
aarch64-mte-linux.c [AArch64] MTE corefile support 2022-07-19 15:24:31 +01:00
aarch64-mte-linux.h [AArch64] MTE corefile support 2022-07-19 15:24:31 +01:00
aarch64.c [aarch64] Fix removal of non-address bits for PAuth 2022-12-16 11:18:32 +00:00
aarch64.h [aarch64] Fix removal of non-address bits for PAuth 2022-12-16 11:18:32 +00:00
amd64.c gdb: Consolidate 32bit-pkeys.xml and 64bit-pkeys.xml 2022-03-31 10:25:26 -07:00
amd64.h
arc.c
arc.h
arm-get-next-pcs.c
arm-get-next-pcs.h
arm-linux.c
arm-linux.h
arm.c internal_error: remove need to pass __FILE__/__LINE__ 2022-10-19 15:32:36 +01:00
arm.h gdb/arm: Handle lazy FPU state preservation 2022-10-06 16:01:10 +02:00
csky.c gdb/csky add cskyv2-linux.xml for cskyv2-linux.c 2022-09-23 10:46:44 +08:00
csky.h gdbserver/csky add csky gdbserver support 2022-09-13 11:20:54 +08:00
i386.c gdb: Consolidate 32bit-pkeys.xml and 64bit-pkeys.xml 2022-03-31 10:25:26 -07:00
i386.h
loongarch.c gdb: LoongArch: Add floating-point support 2022-07-12 20:14:48 +08:00
loongarch.h gdb/gdbserver: LoongArch: Improve implementation of fcc registers 2022-08-09 22:22:23 +08:00
ppc-linux-common.c Constify target_desc declarations 2022-09-29 10:00:13 -07:00
ppc-linux-common.h
ppc-linux-tdesc.h Constify target_desc declarations 2022-09-29 10:00:13 -07:00
riscv.c
riscv.h gdb/riscv: better support for fflags and frm registers 2022-08-31 16:07:05 +01:00
tic6x.c
tic6x.h
xtensa.h