[clang] [llvm] [RISCV] Add Zicfiss support to the shadow call stack implementation. (PR #68075)

2024-01-16 Thread Sami Tolvanen via cfe-commits
@@ -57,11 +57,16 @@ compiled application or the operating system. Integrating the runtime into the operating system should be preferred since otherwise all thread creation and destruction would need to be intercepted by the application. -The instrumentation makes use of the p

[clang] 1aad641 - [Clang][Sema] Add -Wcast-function-type-strict

2022-10-26 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2022-10-26T20:38:37Z New Revision: 1aad641c793090b4d036c03e737df2ebe2c32c57 URL: https://github.com/llvm/llvm-project/commit/1aad641c793090b4d036c03e737df2ebe2c32c57 DIFF: https://github.com/llvm/llvm-project/commit/1aad641c793090b4d036c03e737df2ebe2c32c57.diff LOG:

[clang] 41ce74e - [Clang][Sema] Add -Wincompatible-function-pointer-types-strict

2022-11-07 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2022-11-07T23:05:28Z New Revision: 41ce74e6e983f523d44d3a80be5ae778c35df85a URL: https://github.com/llvm/llvm-project/commit/41ce74e6e983f523d44d3a80be5ae778c35df85a DIFF: https://github.com/llvm/llvm-project/commit/41ce74e6e983f523d44d3a80be5ae778c35df85a.diff LOG:

[clang] eb2a57e - Add generic KCFI operand bundle lowering

2022-11-17 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2022-11-17T21:55:00Z New Revision: eb2a57ebc7aaad551af30462097a9e06c96db925 URL: https://github.com/llvm/llvm-project/commit/eb2a57ebc7aaad551af30462097a9e06c96db925 DIFF: https://github.com/llvm/llvm-project/commit/eb2a57ebc7aaad551af30462097a9e06c96db925.diff LOG:

[clang] b1e9ab7 - Add CFI integer types normalization

2023-02-01 Thread Sami Tolvanen via cfe-commits
Author: Ramon de C Valle Date: 2023-02-01T17:48:03Z New Revision: b1e9ab7438a098a18fecda88fc87ef4ccadfcf1e URL: https://github.com/llvm/llvm-project/commit/b1e9ab7438a098a18fecda88fc87ef4ccadfcf1e DIFF: https://github.com/llvm/llvm-project/commit/b1e9ab7438a098a18fecda88fc87ef4ccadfcf1e.diff L

[clang] fd5e262 - [ModuleUtils][KCFI] Set patchable-function-prefix for synthesized functions

2023-01-11 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2023-01-11T23:45:49Z New Revision: fd5e2627066075f3d15ef774ef368e08735a9ac9 URL: https://github.com/llvm/llvm-project/commit/fd5e2627066075f3d15ef774ef368e08735a9ac9 DIFF: https://github.com/llvm/llvm-project/commit/fd5e2627066075f3d15ef774ef368e08735a9ac9.diff LOG:

[clang] [RISCV] Implement shadow stack on shadow stack mode with Zicfiss. (PR #68075)

2023-10-12 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: The patch basically changes the ShadowCallStack back-end to emit an sspush/sspopchk instead of the usual SCS push/pop, which seems like a reasonable approach to me. However, it would be helpful to mention the dependency on `-fsanitize=shadow-call-stack` in the commit messag

[clang] [RISCV] Implement shadow stack on shadow stack mode with Zicfiss. (PR #68075)

2023-10-13 Thread Sami Tolvanen via cfe-commits
@@ -106,9 +111,14 @@ static void emitSCSEpilogue(MachineFunction &MF, MachineBasicBlock &MBB, CSI, [&](CalleeSavedInfo &CSR) { return CSR.getReg() == RAReg; })) return; + const RISCVInstrInfo *TII = STI.getInstrInfo(); + if (STI.hasFeature(RISCV::FeatureStdExt

[clang] [RISCV] Implement shadow stack on shadow stack mode with Zicfiss. (PR #68075)

2023-10-17 Thread Sami Tolvanen via cfe-commits
@@ -106,9 +111,14 @@ static void emitSCSEpilogue(MachineFunction &MF, MachineBasicBlock &MBB, CSI, [&](CalleeSavedInfo &CSR) { return CSR.getReg() == RAReg; })) return; + const RISCVInstrInfo *TII = STI.getInstrInfo(); + if (STI.hasFeature(RISCV::FeatureStdExt

[clang] 9306352 - [Clang] Emit KCFI type hashes for member functions

2023-07-07 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2023-07-07T16:50:30Z New Revision: 930635271f810316f48bd1aa78935acf36a08f8f URL: https://github.com/llvm/llvm-project/commit/930635271f810316f48bd1aa78935acf36a08f8f DIFF: https://github.com/llvm/llvm-project/commit/930635271f810316f48bd1aa78935acf36a08f8f.diff LOG:

[clang] 5a3d6ce - [Clang][Driver] Add KCFI to SupportsCoverage

2022-11-22 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2022-11-22T18:20:04Z New Revision: 5a3d6ce956c44384920557b455b4db2bb0ab2fad URL: https://github.com/llvm/llvm-project/commit/5a3d6ce956c44384920557b455b4db2bb0ab2fad DIFF: https://github.com/llvm/llvm-project/commit/5a3d6ce956c44384920557b455b4db2bb0ab2fad.diff LOG:

[clang] cacd3e7 - Add generic KCFI operand bundle lowering

2022-11-22 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2022-11-22T23:01:18Z New Revision: cacd3e73d7f87ef3593443271ab3f170d0360934 URL: https://github.com/llvm/llvm-project/commit/cacd3e73d7f87ef3593443271ab3f170d0360934 DIFF: https://github.com/llvm/llvm-project/commit/cacd3e73d7f87ef3593443271ab3f170d0360934.diff LOG:

[clang] 62fa708 - [RISCV] Implement KCFI operand bundle lowering

2023-06-23 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2023-06-23T18:25:24Z New Revision: 62fa708ceb027713b386c7e0efda994f8bdc27e2 URL: https://github.com/llvm/llvm-project/commit/62fa708ceb027713b386c7e0efda994f8bdc27e2 DIFF: https://github.com/llvm/llvm-project/commit/62fa708ceb027713b386c7e0efda994f8bdc27e2.diff LOG:

[clang] e809ebe - Revert "[RISCV] Implement KCFI operand bundle lowering"

2023-06-23 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2023-06-23T21:42:57Z New Revision: e809ebeb6c8b4986cc82542cffd07a453bfac66c URL: https://github.com/llvm/llvm-project/commit/e809ebeb6c8b4986cc82542cffd07a453bfac66c DIFF: https://github.com/llvm/llvm-project/commit/e809ebeb6c8b4986cc82542cffd07a453bfac66c.diff LOG:

[clang] 83835e2 - [RISCV] Implement KCFI operand bundle lowering

2023-06-23 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2023-06-23T22:57:56Z New Revision: 83835e22c7cd50c0e9b836cc359b6c59985b921f URL: https://github.com/llvm/llvm-project/commit/83835e22c7cd50c0e9b836cc359b6c59985b921f DIFF: https://github.com/llvm/llvm-project/commit/83835e22c7cd50c0e9b836cc359b6c59985b921f.diff LOG:

[clang] 71c7313 - Add CFI integer types normalization

2023-02-08 Thread Sami Tolvanen via cfe-commits
Author: Ramon de C Valle Date: 2023-02-08T22:24:19Z New Revision: 71c7313f42d2b6063fea09854cf4fc46fd0627e1 URL: https://github.com/llvm/llvm-project/commit/71c7313f42d2b6063fea09854cf4fc46fd0627e1 DIFF: https://github.com/llvm/llvm-project/commit/71c7313f42d2b6063fea09854cf4fc46fd0627e1.diff L

[clang] a851d46 - [Clang][Driver] Fix integer normalization with KCFI

2023-02-15 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2023-02-16T00:21:31Z New Revision: a851d46e07c1234a0763b4630c8475c73208e776 URL: https://github.com/llvm/llvm-project/commit/a851d46e07c1234a0763b4630c8475c73208e776 DIFF: https://github.com/llvm/llvm-project/commit/a851d46e07c1234a0763b4630c8475c73208e776.diff LOG:

[clang] 5a64a82 - [Driver] Allow -fsanitize=kcfi with -fsanitize-minimal-runtime

2023-06-05 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2023-06-05T20:39:45Z New Revision: 5a64a826b9f0efab4ba7a8cdab4857794bbf07f3 URL: https://github.com/llvm/llvm-project/commit/5a64a826b9f0efab4ba7a8cdab4857794bbf07f3 DIFF: https://github.com/llvm/llvm-project/commit/5a64a826b9f0efab4ba7a8cdab4857794bbf07f3.diff LOG:

[clang] fix kcfi doesn't take effect when callee function has no input parameter (PR #106677)

2024-08-30 Thread Sami Tolvanen via cfe-commits
@@ -2813,6 +2813,11 @@ void CodeGenFunction::EmitKCFIOperandBundle( Callee.getAbstractInfo().getCalleeFunctionProtoType(); if (FP) Bundles.emplace_back("kcfi", CGM.CreateKCFITypeId(FP->desugar())); + else { +ASTContext &context = this->getContext(); +QualTy

[clang] fix kcfi doesn't take effect when callee function has no input parameter (PR #106677)

2024-08-30 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: > If a function is declared without a prototype (pre-C23), it doesn't mean it > has a void argument list; it means the argument list is undeclared. So you > can't just assume the argument list is void; you have to compute the argument > types from the actual arguments passe

[clang] ec2e26e - [Clang] Add __builtin_function_start

2021-12-20 Thread Sami Tolvanen via cfe-commits
Author: Sami Tolvanen Date: 2021-12-20T12:55:33-08:00 New Revision: ec2e26eaf63558934f5b73a6e530edc453cf9508 URL: https://github.com/llvm/llvm-project/commit/ec2e26eaf63558934f5b73a6e530edc453cf9508 DIFF: https://github.com/llvm/llvm-project/commit/ec2e26eaf63558934f5b73a6e530edc453cf9508.diff

[clang] [llvm] Fix KCFI types for generated functions with integer normalization (PR #104826)

2024-08-19 Thread Sami Tolvanen via cfe-commits
https://github.com/samitolvanen created https://github.com/llvm/llvm-project/pull/104826 With -fsanitize-cfi-icall-experimental-normalize-integers, Clang appends ".normalized" to KCFI types in CodeGenModule::CreateKCFITypeId, which changes type hashes also for functions that don't have integer

[clang] [llvm] Fix KCFI types for generated functions with integer normalization (PR #104826)

2024-08-20 Thread Sami Tolvanen via cfe-commits
https://github.com/samitolvanen updated https://github.com/llvm/llvm-project/pull/104826 >From 0f7dfc3f908651a70602f4f64a0ae06616544eeb Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Fri, 16 Aug 2024 20:45:05 + Subject: [PATCH 1/3] Fix KCFI types for generated functions with integer no

[clang] [llvm] Fix KCFI types for generated functions with integer normalization (PR #104826)

2024-08-20 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: > How about changing the module flag name to "cfi-normalize-integers" to be > more consistent with the naming convention used Sure, renamed. https://github.com/llvm/llvm-project/pull/104826 ___ cfe-commits mailing list cfe-commit

[clang] [llvm] Fix KCFI types for generated functions with integer normalization (PR #104826)

2024-08-20 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: > LG. It's best to have a test for the LLVM generated function, not just reuse > kcfi-normalize.c whose module flags could be puzzling for readers. I think we still need to test that Clang adds the module flag, but I added another test for the GCOV functions to make sure th

[clang] [llvm] Fix KCFI types for generated functions with integer normalization (PR #104826)

2024-08-20 Thread Sami Tolvanen via cfe-commits
https://github.com/samitolvanen closed https://github.com/llvm/llvm-project/pull/104826 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Fix KCFI types for generated functions with integer normalization (PR #104826)

2024-10-28 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: /cherry-pick e1c36bde0551977d4b2efae032af6dfc4b2b3936 https://github.com/llvm/llvm-project/pull/104826 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Fix KCFI types for generated functions with integer normalization (PR #104826)

2024-10-28 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: It would be nice to get this cherry-picked to 19.x, so the Rust kernel folks don't have to wait for LLVM 20: https://lore.kernel.org/lkml/202410281414.c351044e-oliver.s...@intel.com/ https://github.com/llvm/llvm-project/pull/104826 __

[clang] [llvm] Fix KCFI types for generated functions with integer normalization (PR #104826)

2024-10-28 Thread Sami Tolvanen via cfe-commits
https://github.com/samitolvanen milestoned https://github.com/llvm/llvm-project/pull/104826 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Fix KCFI types for generated functions with integer normalization (PR #104826)

2024-10-28 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: /cherry-pick e1c36bde0551977d4b2efae032af6dfc4b2b3936 https://github.com/llvm/llvm-project/pull/104826 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [X86] Enhance kCFI type IDs with a 3-bit arity indicator. (PR #117121)

2024-11-25 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: While this overall looks like a nice improvement to me, changing the hashing scheme is going to break compatibility with Rust. I would suggest moving this change behind a command line flag, so the kernel can choose to enable it only if Rust support isn't enabled, or if we h

[clang] [llvm] [X86] Enhance kCFI type IDs with a 3-bit arity indicator. (PR #117121)

2024-11-25 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: > Actually, I think this code was introduced to address a compatibility issue > with KASAN, which apparently must generate KCFI-enabled code without clang. I > found this explanation at > [3b14862](https://github.com/llvm/llvm-project/commit/3b14862f0a968dc079530acbce4f2ca4

[clang] [llvm] [X86] Enhance kCFI type IDs with a 3-bit arity indicator. (PR #117121)

2024-11-26 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: > Sami, I'm guessing you're mainly talking about rustc and clang needing to use > llvm versions that agree on the kCFI implementation in use? Correct. Both compilers must use the same hashing scheme for cross-language indirect calls to work, so unconditionally changing how

[clang] [llvm] [X86] Enhance kCFI type IDs with a 3-bit arity indicator. (PR #117121)

2024-11-26 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: > > AFAIK the use case for KCFI is very narrow: the x86-64 Linux kernel. > > At the very least, it's also used in the arm64 Linux Kernel. Linux also supports KCFI on 32-bit ARM and RISC-V. However, this change seems to only affect X86. https://github.com/llvm/llvm-project/

[clang] [llvm] [X86] Extend kCFI with a 3-bit arity indicator (PR #121070)

2025-02-03 Thread Sami Tolvanen via cfe-commits
https://github.com/samitolvanen approved this pull request. Thank you for adding the command line flag. I agree that this should be sufficient to address compatibility concerns. https://github.com/llvm/llvm-project/pull/121070 ___ cfe-commits mailing

[clang] [llvm] [X86] Extend kCFI with a 3-bit arity indicator (PR #121070)

2025-01-10 Thread Sami Tolvanen via cfe-commits
@@ -254,6 +254,7 @@ FEATURE(is_trivially_constructible, LangOpts.CPlusPlus) FEATURE(is_trivially_copyable, LangOpts.CPlusPlus) FEATURE(is_union, LangOpts.CPlusPlus) FEATURE(kcfi, LangOpts.Sanitize.has(SanitizerKind::KCFI)) +FEATURE(kcfi_x86_arity, LangOpts.Sanitize.has(Sanitize

[clang] [llvm] [X86] Extend kCFI with a 3-bit arity indicator (PR #121070)

2025-01-22 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: > A gentle reminder to please review this PR. Overall this looks fine to me, but I was hoping to get an answer to my question about how the Kconfig detection is actually going to be implemented: https://github.com/llvm/llvm-project/pull/121070#discussion_r1911688455 https:

[clang] [llvm] [X86] Extend kCFI with a 3-bit arity indicator (PR #121070)

2025-01-22 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: > And AFAIK there's no other users of kCFI besides the Linux kernel (but please > correct me if I'm wrong). There are firmware projects that use KCFI, but AFAIK none of them run on x86. I'm also fairly certain that only Linux performs runtime patching based on the code seq

[clang] [llvm] Support alternative sections for patchable function entries (PR #131230)

2025-03-13 Thread Sami Tolvanen via cfe-commits
https://github.com/samitolvanen created https://github.com/llvm/llvm-project/pull/131230 With -fpatchable-function-entry (or the patchable_function_entry function attribute), we emit records of patchable entry locations to the __patchable_function_entries section. Add an additional parameter t

[clang] [llvm] Support alternative sections for patchable function entries (PR #131230)

2025-03-13 Thread Sami Tolvanen via cfe-commits
samitolvanen wrote: @MaskRay here's a draft implementation of the patchable function entry extension [discussed in LKML](https://lore.kernel.org/lkml/y1qezk%2fa41pkl...@hirez.programming.kicks-ass.net/) a couple of years ago. Could you please take a look and see if this seems reasonable? htt

[clang] [llvm] Support alternative sections for patchable function entries (PR #131230)

2025-04-05 Thread Sami Tolvanen via cfe-commits
https://github.com/samitolvanen closed https://github.com/llvm/llvm-project/pull/131230 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits