[AArch64][PAC] Handle signing of init/fini pointers in AsmPrinter (#193087)
Move signing of the contents of `@llvm.global_(ctors|dtors)` from Clang
frontend to the AsmPrinter at the end of the backend pipeline.
Signing of the pointers to init/fini functions in the backend fixes
registration of the constructors and destructors performed by the
optimizer or the backend.
This commit introduces two new module flags, `ptrauth-init-fini` and
`ptrauth-init-fini-address-discrimination`, mirroring corresponding
Clang options. The flags are semantically boolean, an absent flag is
treated as having the `false` value and the latter flag requires the
former one. The particular constant discriminator to use is not
configurable via module flags and is hardcoded to the value 0xD9D4 in
the `llvm/lib/Target/AArch64/AArch64PointerAuth.h` file.
[compiler-rt] [sanitizer_common] Fix SIGSEGV in ForEachMappedRegion for DSOs with custom image base (#206299)
`ForEachMappedRegion` processes dynamic linker map entries to track
loaded segments. However, it assumes map->l_addr is the address of the
ELF header. For DSOs linked with a custom preferred image base offset
(e.g. -Wl,--image-base=0x4000000), `map->l_addr` contains the relocation
bias: `map->l_addr = actual_load_address - preferred_base`
In this case, map->l_addr points below the first loaded segment in
unmapped or PROT_NONE memory. Doing a read dereference at this address
triggers a SIGSEGV. Add a call to dladdr() on the dynamic section
pointer map->l_ld to obtain the true ELF header base address.
Likely fixes #84482 - which looks like the exact same stacktrace I was
debugging that led me to this fix
Also looks it may have shown up in #21068 - my case was also flaky, and
it only shows up if you build the so with custom base address
Assisted-by: Gemini
[clang] Trivial: fix test followup to #208586
Removes the spell-check disable from `clang/test/CXX/drs/cwg5xx.cpp`,
works around spell check noise by renaming a declaration instead.
[OpenMP][AMDGPU][CI] Fix libc build (#209336)
This PR attempts to fix the error:
```
llvm-lit: /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/utils/lit/lit/discovery.py:273: warning: input '/home/botworker/builds/openmp-offload-amdgpu-runtime-2/build/llvm.build/runtimes/runtimes-amdgpu-amd-amdhsa-bins/libc/test' contained no tests
error: did not discover any tests for provided path(s)
```
According to lib/test/CMakeList.txt, we need to set
`CMAKE_CROSSCOMPILING_EMULATOR` to avoid early return in the cmake. It
only changes the build script instead of the parent cmake cache file.
Not sure if this is the optimal solution, but it works for us.
[mlir][acc] Add utilities for acc to gpu lowering (#209313)
In preparation for the pass that converts `acc.compute_region` to GPU
dialect, this PR adds several utilities which are used in that pass.
Doing so to simplify review and to ensure that unit testing is added for
each of the utilities.
[lldb/Host] Add `foreground` argument to `Host::OpenFileInExternalEditor` (#209331)
Add an optional `bool foreground` parameter to
`Host::OpenFileInExternalEditor` so callers can choose whether opening
the file should bring the editor to the foreground.
The macOS implementation maps `foreground=true` to omitting
`kLSLaunchDontSwitch` in the Launch Services flags, so the editor is
brought forward on launch. On non-Apple platforms the stub still returns
`ENOTSUP`; the new parameter is added to its signature so it matches the
declaration.
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[ProfileData] Remove clear() from SampleProfileFuncOffsetTable (NFC) (#209301)
This patch deletes the default constructor of
SampleProfileFuncOffsetTable and removes its clear() method.
SampleProfileFuncOffsetTable is designed to lock its operational mode
(in-memory or on-disk) strictly at construction time and remain valid
throughout its lifetime. By deleting the default constructor and
removing clear(), we ensure that an instance never enters an
uninitialized or cleared state while kept alive.
When SampleProfileReader needs to discard or reload the table, it
resets and replaces the wrapping std::optional directly instead of
clearing the table in-place.
Assisted-by: Antigravity
Merge tag 'cgroup-for-7.2-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup fixes from Tejun Heo:
- A cpuset that never set its memory nodes could divide by zero when a
task's mempolicy rebinds on CPU hotplug. Rebind against the effective
nodes, which are always populated
- Documentation fixes for memory.stat, io.stat, and the misc and v1
RDMA controllers
* tag 'cgroup-for-7.2-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
Docs/admin-guide/cgroup-v2: note blkcg_debug_stats gates io.latency stats
Docs/admin-guide/cgroup-v1: document rdma.peak, rdma.events and rdma.events.local
Docs/admin-guide/cgroup-v2: drop stale misc interface file count
cgroup/cpuset: rebind mm mempolicy to effective_mems, not mems_allowed
Docs/admin-guide/cgroup-v2: fix memory.stat doc details
Merge tag 'sched_ext-for-7.2-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext
Pull sched_ext fixes from Tejun Heo:
- Lifecycle fixes for the new sub-scheduler support: two
use-after-frees and an enable-failure path that left a
half-initialized sub-scheduler linked.
- Two dispatch-path locking bugs: a spurious scheduler abort from a
migration race, and a lockdep splat from stale runqueue-lock
tracking.
- Callback and task-state fixes: stale scheduler-owned state on a task
leaving SCX, a weight callback running after disable, and a bogus
warning on core-scheduling forced idle.
- On nohz_full, finite-slice tasks could miss the tick that expires
their slice. Enable it when such a task is picked, with a selftest.
[18 lines not shown]
routing: Include <sys/eventhandler.h> in nhop_ctl.h
Fix missing Include which is currently leaked through vnet code.
Reported by: bz
Fixes: d05d1f256082 ("routing: Subscribe nhops to ifnet link events")
Differential Revision: https://reviews.freebsd.org/D57375
[MC][CodeGen] Add --large-eh-encoding flag for x86_64 & Aarch64 ELF (#174508)
Add a --large-eh-encoding option that forces 8-byte (DW_EH_PE_sdata8)
pointer encodings for all x86_64 & aarch64 ELF EH sections: FDE CFI
encoding, personality, LSDA, and TType encodings.
This is useful for large binaries where .text may exceed 2GB, causing
relocation overflows in .eh_frame and .gcc_except_table even under the
small or medium code model. The cost is purely in section size (a few
extra bytes per FDE/LSDA entry) with no runtime performance impact.
zfs_sync: remove support for impossible scenarios
The superblock pointer will always be set, as will z_log, so remove code
supporting cases that can't occur (on Linux at least).
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #17420
(cherry picked from commit 52352dd74869d64070e784573d4a01bb55924017)
Signed-off-by: Andriy Tkachuk <atkachuk at wasabi.com>
zfs_sync: return error when pool suspends
If the pool is suspended, we'll just block in zil_commit(). If the
system is shutting down, blocking wouldn't help anyone. So, we should
keep this test for now, but at least return an error for anyone who is
actually interested.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #17420
(cherry picked from commit e3f5e317e0ed4da44a10fe202ec80abed1c8cc87)
Signed-off-by: Andriy Tkachuk <atkachuk at wasabi.com>
zts: test syncfs() behaviour when pool suspends
Fairly coarse, but if it returns while the pool suspends, it must be
with an error.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #17420
(cherry picked from commit c1b7bc52fe264bf8b96dd667ef55db3bd478c00a)
Signed-off-by: Andriy Tkachuk <atkachuk at wasabi.com>
zpl_sync_fs: work around kernels that ignore sync_fs errors
If the kernel will honour our error returns, use them. If not, fool it
by setting a writeback error on the superblock, if available.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #17420
(cherry picked from commit d1c88cbd4cc2ebe5b97fa5b39e7fd83294583ed8)
Signed-off-by: Andriy Tkachuk <atkachuk at wasabi.com>
zts: test syncfs() behaviour when pool suspends
Fairly coarse, but if it returns while the pool suspends, it must be
with an error.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #17420
(cherry picked from commit c1b7bc52fe264bf8b96dd667ef55db3bd478c00a)
Signed-off-by: Andriy Tkachuk <atkachuk at wasabi.com>
zfs_sync: remove support for impossible scenarios
The superblock pointer will always be set, as will z_log, so remove code
supporting cases that can't occur (on Linux at least).
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #17420
(cherry picked from commit 52352dd74869d64070e784573d4a01bb55924017)
Signed-off-by: Andriy Tkachuk <atkachuk at wasabi.com>
zpl_sync_fs: work around kernels that ignore sync_fs errors
If the kernel will honour our error returns, use them. If not, fool it
by setting a writeback error on the superblock, if available.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #17420
(cherry picked from commit d1c88cbd4cc2ebe5b97fa5b39e7fd83294583ed8)
Signed-off-by: Andriy Tkachuk <atkachuk at wasabi.com>
zfs_sync: return error when pool suspends
If the pool is suspended, we'll just block in zil_commit(). If the
system is shutting down, blocking wouldn't help anyone. So, we should
keep this test for now, but at least return an error for anyone who is
actually interested.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #17420
(cherry picked from commit e3f5e317e0ed4da44a10fe202ec80abed1c8cc87)
Signed-off-by: Andriy Tkachuk <atkachuk at wasabi.com>