Commit Graph

3699 Commits

Author SHA1 Message Date
Stephen Webb
7bc6cecda1 Fix some QNX test failures due to syscall name
Two tests were failing on QNX because they hard-code the syscall
function name for raising a signal and the hard-coded function name is
wrong for QNX OS.

Ran the relevant test code through clang-format and fixed additional
issues with Aarch64 scalable vector extension (SVE) on QNX.
2025-08-11 11:38:10 -04:00
H.J. Lu
84607272d8 x86-64: Include <cet.h> for Intel CET
Include <cet.h> when Intel Control-flow Enforcement Technology (CET)
is enabled.  Both GCC and Clang provide <cet.h> which should be included
in assembly codes with .S suffix when -fcf-protection is used.  It will
define _CET_ENDBR (endbr64) and the .note.gnu.property note section.

Fixes #644.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-11 08:58:22 -04:00
kasperk81
2ad7f439d6 Update jmpbuf.h 2025-08-07 13:18:13 -04:00
kasperk81
66f9d10fc8 Implement Gresume for freebsd riscv64 2025-08-07 13:18:13 -04:00
dependabot[bot]
278033e91a Bump github/codeql-action in the github-actions group
Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.29.2 to 3.29.5
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](181d5eefc2...51f77329af)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.29.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-07 08:25:44 -04:00
Ross Burton
b2d2e81e5f mips/getcontext.S: use assembler-friendly byte order symbols
endian.h on musl/mips can't be included in __ASSEMBLER__ mode,
so use the __BYTE_ORDER__ symbol instead.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2025-07-29 08:06:57 -04:00
Stephen Webb
0fca68b9fb Use file offset when reading GNU hash table
All segemnets in an ELF file are not guaranteed to have the same base
virtual address.

Adjusted the GNU hash table address based on the actual file offset of
the segment containing ir rather than the offset of the program table
header itself.
2025-07-25 11:51:10 -04:00
Stephen Webb
637b9ebcde Add support for x86_64 Control-Flow Enforcement
The x86_64 assembly files need to add `enbr64` instructions and a
special ELF note for the GNU gnu.property extension.
2025-07-24 13:42:57 -04:00
dependabot[bot]
4c0446622d Bump github/codeql-action in the github-actions group
---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.29.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-04 09:01:02 -04:00
dependabot[bot]
2a15c30f7e Bump github/codeql-action in the github-actions group
Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.28.16 to 3.28.18
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](28deaeda66...ff0a06e83c)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.18
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-30 07:55:05 -04:00
Herman Semenov
eeeaa8a77a fix: fixes bit shifting 32bit (1u - unsigned int) with subsequent expansion to 64bit (1ULL - unsigned wide long64)
Type vulnerability:

 - CWE-190 Integer Overflow or Wraparound

References:

 - https://cwe.mitre.org/data/definitions/190.html
2025-06-20 15:01:19 -04:00
Herman Semenov
2c609f5855 mi: removed excess check before free() in label 'out'
C89: 4.10.3.2 The free function.

The free function causes the space pointed to by ptr to be deallocated, that is, made available for further allocation. If ptr is a null pointer, no action occurs.
2025-06-20 11:40:24 -04:00
Stephen Webb
caaa5d7248 Add HPPA as a cross-build CI target 2025-06-16 08:45:57 -04:00
Phong X. Nguyen
7886dbbcdd Remove __linux__ check per PR review 2025-06-13 07:38:29 -04:00
Phong X. Nguyen
230f20100e Avoid NT_ARM_PAC_MASK on older Linux kernels 2025-06-13 07:38:29 -04:00
danglin44
f7a07922b8 Improve hppa support
Various tweaks to the HPPA-specific code to improve the unit test pass
rate.
2025-06-09 13:34:11 -04:00
Stephen Webb
06dd379a7c Fix typo in README
CI clause under PA-RISC was referring to x86_64.

Also added explicit info on PPC CI failures.
2025-06-06 12:24:57 -04:00
Mathieu Othacehe
09885eb855 Revert "Do not fallback to slow_backtrace when tdep_trace stops unwinding"
This reverts commit 5b195ffd50 because it breaks
both arm and armhf test suites.
2025-06-06 09:12:43 -04:00
Mathieu Othacehe
7718ecc1dd arm: Disable test-async-sig.
This test randomly fails on arm because depending on the place where the
signal is received, the backtrace can involve glibc functions such as
"__read", which do not have .EXIDX instructions.
2025-06-03 10:19:47 -04:00
Mathieu Othacehe
62dfb32339 Revert "Fix unwinding of pre-linked libraries"
This reverts commit a4014f3377. The
implementation of the pre-linking support is wrong. It assumes that only
pre-linked libraries will have the virtual address of the LOAD ELF section set
to non-zero.

On arm-linux-gnueabi, without pre-linking, we have:

  LOAD           0x000000 0x00010000 0x00010000 0x267fc 0x267fc R E 0x10000

Which means that load_offset is set to 0x10000 and incorrectly substracted
from ip - ip_base. It also seems that pre-linking support is vastly
deprecated.

Reverting that one fixes .debug_frame based unwinding of arm-linux-gnueabi.
2025-06-03 10:19:47 -04:00
Milian Wolff
5b195ffd50 Do not fallback to slow_backtrace when tdep_trace stops unwinding
On an aarch64 system tdep_trace was returning `-UNW_ESTOPUNWIND`
a lot while profiling a Qt 6 / QML application with heaptrack.
I have not understood why exactly, but note that QML injects
JIT frames and more, which potentially lead to such failures?

Without the patch here, unwinding became excessively slow because
the `slow_backtrace` fallback continuously called `tdep_get_elf_image`
which is extremely slow for applications with many entries in their
`/proc/<pid>/maps` file.

With the patch here applied, I could use heaptrack again with
the expected bearable overhead. The backtraces still look fine,
so for me this patch here looks like a good workaround.
2025-06-03 09:19:22 -04:00
Stephen Webb
f75061c3b6 Removed unused src/arm/getcontext.S
The function in this source file was never used anywhere
(`unw_tdep_getcontext()` is a macro generating inline asm for arm). It
also fails to build from source for any OS other than Linux and FreeBSD.

Removed the file and checks for the symbol.
2025-05-30 14:42:35 -04:00
Stephen Webb
197a8f6902 Fix register range check for armv7 QNX coredump 2025-05-28 15:45:04 -04:00
Mathieu Othacehe
e5f0500eb9 tests: Use sigaction in Gtest-concurrent.
Switch to sigaction instead of signal to setup the signal handler. The former
is deprecated and does not work fine on ARM.
2025-05-28 15:13:23 -04:00
Mathieu Othacehe
f221f09519 arm: Disable tests with UNW_INIT_SIGNAL_FRAME.
unw_init_local2 (&cursor, (unw_context_t*)context, UNW_INIT_SIGNAL_FRAME) with
a context that comes from the signal handler is not implemented on ARM.
2025-05-28 15:13:23 -04:00
Mathieu Othacehe
ee27425bbc arm: Deal with -UNW_ESTOPUNWIND in the tests.
When using .EXIDX based unwinding, some functions are flagged with the
.cantunwind directive. That causes unw_step to stop unwinding and to return
-UNW_ESTOPUNWIND.

Do not consider that as an error in the tests.
2025-05-28 15:13:23 -04:00
Mathieu Othacehe
34aa934fd1 arm: Fix resume.
We want to use the LR register, not the PC register to resume to the cursor.
2025-05-28 15:13:23 -04:00
Stephen Webb
55b3c7b81d Fix doc-building config
Change the autoconf rules so that
  - docs are always built and installed unless
    `--enable-documentation=no` is passed
  - the documentation-build tools latex2man and pdflatex are
    autodetected and, if not found, just issue a warning at configure
    time and doc builds do nothing. Since built man pages are under
    source control this should not have a dire effect.

Fixes #822
2025-05-26 15:17:36 -04:00
kasperk81
00b847fea2 add initial freebsd riscv support 2025-05-23 15:19:47 -04:00
Stephen M. Webb
b62977ab32 Read link register from context when unwinding on arm and aarch64
Prevent unw_bactrace family functions from unwinding using the slow path if the fast path had to stop (return -UNW_ESTOPUNWIND).
2025-05-22 10:47:50 -04:00
Gregory LEOCADIE
ecc7060923 Address PR comment 2025-05-22 13:32:26 +02:00
Gregory LEOCADIE
f9855cfd9a Fix crash on QNX 2025-05-22 13:32:26 +02:00
Gregory LEOCADIE
4c341da1d2 Rewrite how we read link register 2025-05-22 13:32:26 +02:00
Gregory LEOCADIE
6eb27584fd Read the R14 register (link register) on arm 2025-05-22 13:32:26 +02:00
Gregory LEOCADIE
3d882574dc Read link register from context on aarch64 2025-05-22 13:30:07 +02:00
Mathieu Othacehe
c3042adcea arm: Fix assembly warning.
Fix the following warning by making sure that r1 is the first register in the
register list. It means that r0 has to be saved beforehand outside of the
stmia instruction.

{standard input}:333: Warning: if writeback register is in list, it must be
the lowest reg in the list
2025-05-14 05:52:15 -04:00
Adam Lackorzynski
b31806304b riscv: Add dwarf_{put,get}fp for double-size words
On riscv32, xlen is 32, while flen can be 64 depending on the model
used.
2025-05-02 12:02:05 -04:00
dependabot[bot]
7bdd513ecf Bump github/codeql-action in the github-actions group
Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.28.13 to 3.28.16
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](1b549b9259...28deaeda66)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-02 08:03:35 -04:00
Stephen Webb
3415127dba Fix FTBFS in src/ptrace/_UPT_ptrauth_insn_mask.c
Added missing parameter names to make C code comply to ISO/IEC 9899.
2025-04-15 11:28:49 -04:00
Wouter Deconinck
998b2cf3da Disable Ltest-mem-validate test when CONSERVATIVE_CHECKS and x86_64 or s390x 2025-04-15 09:33:09 -04:00
Stephen Webb
1c862c3aae Build libunwind using convenience libs
A (new) unit test was failing at -O0 because it referenced functions
private to the implementation and not exposed through the shared library
ABI. To fix this, the shared library(ies) are now built using a
convenience library, which can also be directly linked to unit tests so
the private functions can be exposed.

This is the first step to greatly expanded unit testing (ie. testing at
unit seams instead of integration testing only at the public API level).

Only one single unit test for the AARCH64 architecture is fully enabled
at this point.

Fixes #841
2025-04-15 09:00:19 -04:00
Stijn Lemm
d2c07d099d indenting... 2025-04-11 15:21:22 -04:00
Stijn Lemm
2e49d11044 fix reading coredump mapinfo skipping paths smaller than 10 chars and a working check on (deleted) paths. 2025-04-11 15:21:22 -04:00
Stijn Lemm
fa421e4fc4 Remove undefined functions from public coredump header. Removed in #363 2025-04-10 13:16:47 -04:00
dependabot[bot]
405b13b364 Bump github/codeql-action in the github-actions group
Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.28.10 to 3.28.13
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b56ba49b26...1b549b9259)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-03 07:58:47 -04:00
dependabot[bot]
f27f6a8603 Bump github/codeql-action in the github-actions group
Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.28.8 to 3.28.10
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](dd746615b3...b56ba49b26)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-03 08:23:40 -05:00
Lexi Kane
177deb5f89 Support -mbranch-protection=pac-ret on aarch64
- Support for pac-ret on aarch64 existed partially before inside the
DWARF parser but this needed applying elsewhere in the code
- Move PAC mask stripping functions to be accessible from more places
and rename to `tdep_ptrauth_insn_mask` for consistency with the
corresponding accessor function
- Apply PAC stripping in appropriate places
- Add ptrace accessor function implementation for `ptrauth_insn_mask`
- make check is now passing on aarch64 when compiled with
`CFLAGS="-mbranch-protection=standard"`
- There is an extra function in the ptrace library ABI now
(`_UPT_ptrauth_insn_mask`) but there are also some other ABI changes
reported by libabigail / `make abi-check` that are unrelated to this
change, so I am not sure whether to proceed with updating the .abi
files or not

Closes #647

Signed-off-by: Lexi Kane <lexi.kane@arm.com>
2025-02-28 12:40:13 -05:00
Gregory LEOCADIE
10a456fd08 Remove last unused warnings 2025-02-25 15:55:23 -05:00
Gregory LEOCADIE
a6882ca87f Try fixing musl tests 2025-02-25 15:55:23 -05:00
Gregory LEOCADIE
3e72728f4f fix musl build 2025-02-25 15:55:23 -05:00