Matthias Krüger
accf61dd42
Rollup merge of #143293 - folkertdev:naked-function-kcfi, r=compiler-errors
...
fix `-Zsanitizer=kcfi` on `#[naked]` functions
fixes https://github.com/rust-lang/rust/issues/143266
With `-Zsanitizer=kcfi`, indirect calls happen via generated intermediate shim that forwards the call. The generated shim preserves the attributes of the original, including `#[unsafe(naked)]`. The shim is not a naked function though, and violates its invariants (like having a body that consists of a single `naked_asm!` call).
My fix here is to match on the `InstanceKind`, and only use `codegen_naked_asm` when the instance is not a `ReifyShim`. That does beg the question whether there are other `InstanceKind`s that could come up. As far as I can tell the answer is no: calling via `dyn` seems to work find, and `#[track_caller]` is disallowed in combination with `#[naked]`.
r? codegen
````@rustbot```` label +A-naked
cc ````@maurer```` ````@rcvalle````
2025-07-18 04:27:51 +02:00
..
2025-05-19 11:11:55 +02:00
2025-05-01 08:50:14 +08:00
2024-12-17 01:12:36 +09:00
2025-04-05 11:44:38 -07:00
2024-12-17 01:12:36 +09:00
2024-12-17 01:12:36 +09:00
2025-06-03 21:34:59 +05:30
2024-12-17 01:12:36 +09:00
2025-02-22 00:12:07 +00:00
2024-12-17 01:12:36 +09:00
2024-12-17 01:12:36 +09:00
2024-12-17 01:12:36 +09:00
2024-07-18 15:00:56 -05:00
2024-07-09 01:23:49 +00:00
2024-07-18 17:00:43 -04:00
2025-05-27 09:44:10 +02:00
2025-05-27 09:44:10 +02:00
2025-05-27 09:44:04 +02:00
2025-02-24 16:20:50 +00:00
2025-02-24 16:20:50 +00:00
2025-02-24 16:20:35 +00:00
2024-09-29 08:49:37 +02:00
2024-09-26 13:21:15 +02:00
2024-09-26 13:21:15 +02:00
2025-02-26 19:27:19 +00:00
2025-02-26 19:27:19 +00:00
2024-05-20 19:55:59 -07:00
2025-02-26 19:27:19 +00:00
2025-06-02 15:37:15 +00:00
2024-12-11 20:17:37 +00:00
2024-12-11 20:17:37 +00:00
2024-08-13 23:18:31 +02:00
2025-03-06 17:34:17 +00:00
2025-05-05 13:17:35 +00:00
2025-03-06 17:34:17 +00:00
2025-03-06 17:34:17 +00:00
2025-02-22 00:12:07 +00:00
2024-09-27 09:49:15 +05:30
2025-03-14 19:50:03 +00:00
2025-02-22 00:12:07 +00:00
2025-02-22 00:12:07 +00:00
2025-04-05 11:44:38 -07:00
2025-04-05 11:44:38 -07:00
2025-04-05 11:44:38 -07:00
2025-03-10 14:28:09 +00:00
2025-03-10 14:28:09 +00:00
2024-08-02 19:59:34 +01:00
2024-08-02 19:59:34 +01:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2025-04-08 23:06:31 +03:00
2024-12-17 01:12:36 +09:00
2024-03-11 09:36:35 -07:00
2024-03-11 09:36:35 -07:00
2024-02-16 20:02:50 +00:00
2024-12-17 01:12:36 +09:00
2024-02-16 20:02:50 +00:00
2025-04-08 23:06:31 +03:00
2024-12-17 01:12:36 +09:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-03-25 14:19:07 +00:00
2025-05-05 13:17:35 +00:00
2025-04-20 11:18:38 +02:00
2025-04-20 11:18:38 +02:00
2025-07-16 21:38:48 +02:00
2025-05-29 12:55:26 +00:00
2025-05-29 12:55:26 +00:00
2025-04-20 11:18:38 +02:00
2025-06-23 12:22:57 +02:00
2025-04-20 11:18:38 +02:00
2025-04-20 11:18:38 +02:00
2025-04-20 11:18:38 +02:00
2025-04-20 11:18:38 +02:00
2025-04-20 11:18:38 +02:00
2025-04-20 11:18:38 +02:00
2025-04-20 11:18:38 +02:00
2025-04-20 11:18:38 +02:00
2025-05-03 19:15:19 +02:00
2025-04-20 11:18:38 +02:00
2025-04-23 11:08:14 +02:00
2025-07-17 08:37:19 +10:00
2025-06-18 12:37:08 +02:00
2025-06-18 12:37:08 +02:00
2025-04-27 22:05:07 +00:00
2025-04-20 11:18:38 +02:00
2025-04-20 11:18:38 +02:00
2024-12-23 22:15:32 +00:00
2024-12-23 22:15:32 +00:00
2024-02-16 20:02:50 +00:00
2025-04-27 22:05:07 +00:00
2025-05-18 11:28:31 +02:00
2025-05-27 09:44:10 +02:00
2024-12-17 01:12:36 +09:00
2024-12-17 01:12:36 +09:00
2025-04-20 11:18:38 +02:00
2025-03-10 14:28:09 +00:00
2025-03-10 14:28:09 +00:00
2024-08-13 23:18:31 +02:00
2024-08-13 23:18:31 +02:00
2025-04-08 23:06:31 +03:00
2024-03-11 09:36:35 -07:00
2025-04-16 11:10:10 +02:00
2025-04-16 11:10:10 +02:00
2024-07-27 19:27:20 +02:00
2024-07-27 19:27:20 +02:00
2024-07-27 19:27:20 +02:00