Rust KCFI support
Alice Ryhl
reviewercover Rust KCFI support
The control flow integrity (kCFI) sanitizer is an important sanitizer that is often used in production. This patch series makes it possible to use kCFI and Rust together.
The second patch in this series depends on the next version of [1], which Miguel will send soon. It also depends on [2].
---
Alice Ryhl (1):
cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
Matthew Maurer (1):
rust: cfi: add support for CFI_CLANG with Rust
Makefile | 10 ++++++++++ arch/Kconfig | 11 +++++++++++ init/Kconfig | 2 +- rust/Makefile | 2 +- scripts/generate_rust_target.rs | 1 + 5 files changed, 24 insertions(+), 2 deletions(-)
---
base-commit: 8718bc07faa6ddf4f7335a12e4cdd4ffc796bbd8
change-id: 20240725-kcfi-c592898e2bfb
Best regards,
Signature · 1 line
Alice Ryhl <[email protected]>
Alice Ryhl
reviewerPATCH 1/2 cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
Introduce a Kconfig option for enabling the experimental option to normalize integer types. This ensures that integer types of the same size and signedness are considered compatible by the Control Flow Integrity sanitizer.
This option exists for compatibility with Rust, as C and Rust do not have the same set of integer types. There are cases where C has two different integer types of the same size and alignment, but Rust only has one integer type of that size and alignment. When Rust calls into C functions using such types in their signature, this results in CFI failures.
This patch introduces a dedicated option for this because it is undesirable to have CONFIG_RUST affect CC_FLAGS in this way.
--- Makefile | 3 +++ arch/Kconfig | 11 +++++++++++ 2 files changed, 14 insertions(+)
Makefile +3 -0
@@ -952,6 +952,9 @@ endif ifdef CONFIG_CFI_CLANG CC_FLAGS_CFI := -fsanitize=kcfi +ifdef CONFIG_CFI_ICALL_NORMALIZE_INTEGERS + CC_FLAGS_CFI += -fsanitize-cfi-icall-experimental-normalize-integers +endif KBUILD_CFLAGS += $(CC_FLAGS_CFI) export CC_FLAGS_CFI endif
arch/Kconfig +11 -0
@@ -826,6 +826,17 @@ config CFI_CLANG https://clang.llvm.org/docs/ControlFlowIntegrity.html +config CFI_ICALL_NORMALIZE_INTEGERS + bool "Normalize CFI tags for integers" + depends on CFI_CLANG + depends on $(cc-option,-fsanitize=kcfi -fsanitize-cfi-icall-experimental-normalize-integers) + help + This option normalizes the CFI tags for integer types so that all + integer types of the same size and signedness receive the same CFI + tag. + + This option is necessary for using CFI with Rust. If unsure, say N. + config CFI_PERMISSIVE bool "Use CFI in permissive mode" depends on CFI_CLANG
Signature · 1 line
2.46.0.rc1.232.g9752f9e123-goog
Alice Ryhl
reviewerRe: [PATCH 1/2] cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
Quoted 6 lines · Alice Ryhl
Introduce a
Kconfigoption for enabling the experimental option to normalize integer types. This ensures that integer types of the same size and signedness are considered compatible by the Control Flow Integrity sanitizer.
Quoted 6 lines
This option exists for compatibility with Rust, as C and Rust do not have the same set of integer types. There are cases where C has two different integer types of the same size and alignment, but Rust only has one integer type of that size and alignment. When Rust calls into C functions using such types in their signature, this results in CFI failures.
This should say signedness where it says alignment.
Alice
Re: [PATCH 1/2] cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
In reply to Alice RyhlQuoted 12 lines · Alice Ryhl
Introduce a
Kconfigoption for enabling the experimental option to normalize integer types. This ensures that integer types of the same size and signedness are considered compatible by the Control Flow Integrity sanitizer.This option exists for compatibility with Rust, as C and Rust do not have the same set of integer types. There are cases where C has two different integer types of the same size and alignment, but Rust only has one integer type of that size and alignment. When Rust calls into C functions using such types in their signature, this results in CFI failures.
Quoted 2 lines
This patch introduces a dedicated option for this because it is undesirable to have
CONFIG_RUSTaffectCC_FLAGSin this way.
To be clear, any code compiled with this is incompatible with code compiled without this, as the function signatures will differ, right?
Specifically, it will map things like 'unsigned long long' and 'unsigned long' -- which are both u64 on LP64 targets to the same 'type', right?
I suppose it has been decided the security impact of this change is minimal?
All in all, there is very little actual information provided here.
Quoted 46 lines
Signed-off-by Alice Ryhl <[email protected]>--- Makefile | 3 +++ arch/Kconfig | 11 +++++++++++ 2 files changed, 14 insertions(+)Makefile +3
-0@@ -952,6 +952,9 @@ endif ifdef CONFIG_CFI_CLANG CC_FLAGS_CFI := -fsanitize=kcfi +ifdef CONFIG_CFI_ICALL_NORMALIZE_INTEGERS + CC_FLAGS_CFI += -fsanitize-cfi-icall-experimental-normalize-integers +endif KBUILD_CFLAGS += $(CC_FLAGS_CFI) export CC_FLAGS_CFI endifarch/Kconfig +11
-0@@ -826,6 +826,17 @@ config CFI_CLANG https://clang.llvm.org/docs/ControlFlowIntegrity.html +config CFI_ICALL_NORMALIZE_INTEGERS + bool "Normalize CFI tags for integers" + depends on CFI_CLANG + depends on $(cc-option,-fsanitize=kcfi -fsanitize-cfi-icall-experimental-normalize-integers) + help + This option normalizes the CFI tags for integer types so that all + integer types of the same size and signedness receive the same CFI + tag. + + This option is necessary for using CFI with Rust. If unsure, say N. + config CFI_PERMISSIVE bool "Use CFI in permissive mode" depends on CFI_CLANGSignature · 2 lines
-- 2.46.0.rc1.232.g9752f9e123-goog
Re: [PATCH 1/2] cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
Quoted 17 lines · Peter Zijlstra
Quoted 12 lines · Alice Ryhl
Introduce a
Kconfigoption for enabling the experimental option to normalize integer types. This ensures that integer types of the same size and signedness are considered compatible by the Control Flow Integrity sanitizer.This option exists for compatibility with Rust, as C and Rust do not have the same set of integer types. There are cases where C has two different integer types of the same size and alignment, but Rust only has one integer type of that size and alignment. When Rust calls into C functions using such types in their signature, this results in CFI failures.
Quoted 2 lines
This patch introduces a dedicated option for this because it is undesirable to have
CONFIG_RUSTaffectCC_FLAGSin this way.
Quoted 8 lines
To be clear, any code compiled with this is incompatible with code compiled without this, as the function signatures will differ, right?
Specifically, it will map things like 'unsigned long long' and 'unsigned long' -- which are both u64 on LP64 targets to the same 'type', right?
I suppose it has been decided the security impact of this change is minimal?
I looked into this last year, and integer normalization reduced the number of unique type hashes in the kernel by ~1%, which should be fine.
Sami
Re: [PATCH 1/2] cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
Quoted 24 lines · Sami Tolvanen
Quoted 23 lines · Peter Zijlstra
Quoted 12 lines · Alice Ryhl
Introduce a
Kconfigoption for enabling the experimental option to normalize integer types. This ensures that integer types of the same size and signedness are considered compatible by the Control Flow Integrity sanitizer.This option exists for compatibility with Rust, as C and Rust do not have the same set of integer types. There are cases where C has two different integer types of the same size and alignment, but Rust only has one integer type of that size and alignment. When Rust calls into C functions using such types in their signature, this results in CFI failures.
Quoted 2 lines
This patch introduces a dedicated option for this because it is undesirable to have
CONFIG_RUSTaffectCC_FLAGSin this way.To be clear, any code compiled with this is incompatible with code compiled without this, as the function signatures will differ, right?
Specifically, it will map things like 'unsigned long long' and 'unsigned long' -- which are both u64 on LP64 targets to the same 'type', right?
Quoted 6 lines
Quoted 2 lines
I suppose it has been decided the security impact of this change is minimal?
I looked into this last year, and integer normalization reduced the number of unique type hashes in the kernel by ~1%, which should be fine.
Right, I didn't actually expect it to matter much either, but it would've made good Changelog content.
Alice Ryhl
reviewerRe: [PATCH 1/2] cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
In reply to Peter ZijlstraQuoted 14 lines · Peter Zijlstra
Quoted 12 lines · Alice Ryhl
Introduce a
Kconfigoption for enabling the experimental option to normalize integer types. This ensures that integer types of the same size and signedness are considered compatible by the Control Flow Integrity sanitizer.This option exists for compatibility with Rust, as C and Rust do not have the same set of integer types. There are cases where C has two different integer types of the same size and alignment, but Rust only has one integer type of that size and alignment. When Rust calls into C functions using such types in their signature, this results in CFI failures.
Quoted 5 lines
Quoted 2 lines
This patch introduces a dedicated option for this because it is undesirable to have
CONFIG_RUSTaffectCC_FLAGSin this way.To be clear, any code compiled with this is incompatible with code compiled without this, as the function signatures will differ, right?
That's correct.
Quoted 2 lines
Specifically, it will map things like 'unsigned long long' and 'unsigned long' -- which are both u64 on LP64 targets to the same 'type', right?
That's correct.
Quoted 2 lines
I suppose it has been decided the security impact of this change is minimal?
Yeah, see Sami's response.
Quoted 1 line
All in all, there is very little actual information provided here.
I'll make sure to include this info in the commit message of v2.
Alice
Re: [PATCH 1/2] cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
In reply to Alice RyhlQuoted 13 lines · Alice Ryhl
Introduce a
Kconfigoption for enabling the experimental option to normalize integer types. This ensures that integer types of the same size and signedness are considered compatible by the Control Flow Integrity sanitizer.This option exists for compatibility with Rust, as C and Rust do not have the same set of integer types. There are cases where C has two different integer types of the same size and alignment, but Rust only has one integer type of that size and alignment. When Rust calls into C functions using such types in their signature, this results in CFI failures.
Quoted 2 lines
This patch introduces a dedicated option for this because it is undesirable to have
CONFIG_RUSTaffectCC_FLAGSin this way.
Is there any case where we would want CFI_ICALL_NORMALIZE_INTEGERS when Rust is not enabled, then? If not, is the idea here to make this an explicit extra question in the config before enabling Rust? Or why wouldn't it be done automatically?
Thanks!
Cheers,
Miguel
Re: [PATCH 1/2] cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
Quoted 14 lines · Miguel Ojeda
Quoted 13 lines · Alice Ryhl
Introduce a
Kconfigoption for enabling the experimental option to normalize integer types. This ensures that integer types of the same size and signedness are considered compatible by the Control Flow Integrity sanitizer.This option exists for compatibility with Rust, as C and Rust do not have the same set of integer types. There are cases where C has two different integer types of the same size and alignment, but Rust only has one integer type of that size and alignment. When Rust calls into C functions using such types in their signature, this results in CFI failures.
Quoted 7 lines
Quoted 2 lines
This patch introduces a dedicated option for this because it is undesirable to have
CONFIG_RUSTaffectCC_FLAGSin this way.Is there any case where we would want
CFI_ICALL_NORMALIZE_INTEGERSwhen Rust is not enabled, then? If not, is the idea here to make this an explicit extra question in the config before enabling Rust? Or why wouldn't it be done automatically?
I suspect CFI_ICALL_NORMALIZE_INTEGERS breaks ABI, then again, Linux doesn't promise or preserve ABI except for the SYSCALL layer. So yeah, meh.
Alice Ryhl
reviewerRe: [PATCH 1/2] cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
In reply to Miguel OjedaQuoted 15 lines · Miguel Ojeda
Quoted 13 lines · Alice Ryhl
Introduce a
Kconfigoption for enabling the experimental option to normalize integer types. This ensures that integer types of the same size and signedness are considered compatible by the Control Flow Integrity sanitizer.This option exists for compatibility with Rust, as C and Rust do not have the same set of integer types. There are cases where C has two different integer types of the same size and alignment, but Rust only has one integer type of that size and alignment. When Rust calls into C functions using such types in their signature, this results in CFI failures.
Quoted 7 lines
Quoted 2 lines
This patch introduces a dedicated option for this because it is undesirable to have
CONFIG_RUSTaffectCC_FLAGSin this way.Is there any case where we would want
CFI_ICALL_NORMALIZE_INTEGERSwhen Rust is not enabled, then? If not, is the idea here to make this an explicit extra question in the config before enabling Rust? Or why wouldn't it be done automatically?
I'm adding this flag to make the bringup process for RUST easier.
I'm working on enabling RUST in a new branch. We're eventually going to have both RUST and CFI_ICALL_NORMALIZE_INTEGERS enabled in our build, but the path to getting there is complex and we would like to turn on CFI_ICALL_NORMALIZE_INTEGERS first, and then turn on RUST later. Both options are non-trivial to turn on and I want to disentangle them.
Alice
Re: [PATCH 1/2] cfi: add CONFIG_CFI_ICALL_NORMALIZE_INTEGERS
Quoted 9 lines · Alice Ryhl
I'm adding this flag to make the bringup process for RUST easier.
I'm working on enabling RUST in a new branch. We're eventually going to have both RUST and
CFI_ICALL_NORMALIZE_INTEGERSenabled in our build, but the path to getting there is complex and we would like to turn onCFI_ICALL_NORMALIZE_INTEGERSfirst, and then turn on RUST later. Both options are non-trivial to turn on and I want to disentangle them.
Would it be useful for other users/distros to do that two-stage approach as well?
In other words, if the intended end state is that everybody should enable this if Rust is enabled, and nobody should enable it if they don't care about Rust, then we should add this only if you think others will also need to do this step by step. The option or commit message could ideally explain more about this need/use case.
Cheers,
Miguel
Alice Ryhl
reviewerPATCH 2/2 rust: cfi: add support for CFI_CLANG with Rust
In reply to Alice RyhlFrom: Matthew Maurer <[email protected]>
Make it possible to use the Control Flow Integrity (CFI) sanitizer when Rust is enabled. Enabling CFI with Rust requires that CFI is configured to normalize integer types so that all integer types of the same size and signedness are compatible under CFI.
--- Makefile | 7 +++++++ init/Kconfig | 2 +- rust/Makefile | 2 +- scripts/generate_rust_target.rs | 1 + 4 files changed, 10 insertions(+), 2 deletions(-)
Makefile +7 -0
@@ -955,6 +955,13 @@ CC_FLAGS_CFI := -fsanitize=kcfi ifdef CONFIG_CFI_ICALL_NORMALIZE_INTEGERS CC_FLAGS_CFI += -fsanitize-cfi-icall-experimental-normalize-integers endif +ifdef CONFIG_RUST + # Always pass -Zsanitizer-cfi-normalize-integers as CONFIG_RUST depends + # on CONFIG_CFI_ICALL_NORMALIZE_INTEGERS. + RS_FLAGS_CFI := -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers + KBUILD_RUSTFLAGS += $(RS_FLAGS_CFI) + export RS_FLAGS_CFI +endif KBUILD_CFLAGS += $(CC_FLAGS_CFI) export CC_FLAGS_CFI endif
init/Kconfig +1 -1
@@ -1905,11 +1905,11 @@ config RUST bool "Rust support" depends on HAVE_RUST depends on RUST_IS_AVAILABLE - depends on !CFI_CLANG depends on !MODVERSIONS depends on !GCC_PLUGINS depends on !RANDSTRUCT depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE + depends on !CFI_CLANG || RUSTC_VERSION >= 107900 && CFI_ICALL_NORMALIZE_INTEGERS help Enables Rust support in the kernel.
rust/Makefile +1 -1
@@ -305,7 +305,7 @@ $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers.c FORCE quiet_cmd_exports = EXPORTS $@ cmd_exports = \ $(NM) -p --defined-only $< \ - | awk '/ (T|R|D) / {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ + | awk '$$2~/(T|R|D)/ && $$3!~/__cfi/ {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ $(obj)/exports_core_generated.h: $(obj)/core.o FORCE $(call if_changed,exports)
scripts/generate_rust_target.rs +1 -0
@@ -192,6 +192,7 @@ fn main() { } ts.push ("features" , features); ts.push ("llvm-target" ,"x86_64-linux-gnu" ); + ts.push ("supported-sanitizers" , ["kcfi" ]); ts.push ("target-pointer-width" ,"64" ); }else if cfg.has ("X86_32" ) {// This only works on UML, as i386 otherwise needs regparm support in rustc
Signature · 1 line
2.46.0.rc1.232.g9752f9e123-goog
Re: [PATCH 2/2] rust: cfi: add support for CFI_CLANG with Rust
Quoted 6 lines · Alice Ryhl
From: Matthew Maurer <[email protected]>
Make it possible to use the Control Flow Integrity (CFI) sanitizer when Rust is enabled. Enabling CFI with Rust requires that CFI is configured to normalize integer types so that all integer types of the same size and signedness are compatible under CFI.
I am assuming -- because I have to, because you're not actually saying anyting -- that this is fully compatible with the C version and all the fun and games we play with rewriting the function prologue for FineIBT and the like also work?
Quoted 74 lines
Signed-off-by Matthew Maurer <[email protected]>Co-developed-by Alice Ryhl <[email protected]>Signed-off-by Alice Ryhl <[email protected]>--- Makefile | 7 +++++++ init/Kconfig | 2 +- rust/Makefile | 2 +- scripts/generate_rust_target.rs | 1 + 4 files changed, 10 insertions(+), 2 deletions(-)Makefile +7
-0@@ -955,6 +955,13 @@ CC_FLAGS_CFI := -fsanitize=kcfi ifdef CONFIG_CFI_ICALL_NORMALIZE_INTEGERS CC_FLAGS_CFI += -fsanitize-cfi-icall-experimental-normalize-integers endif +ifdef CONFIG_RUST + # Always pass -Zsanitizer-cfi-normalize-integers as CONFIG_RUST depends + # on CONFIG_CFI_ICALL_NORMALIZE_INTEGERS. + RS_FLAGS_CFI := -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers + KBUILD_RUSTFLAGS += $(RS_FLAGS_CFI) + export RS_FLAGS_CFI +endif KBUILD_CFLAGS += $(CC_FLAGS_CFI) export CC_FLAGS_CFI endifinit/Kconfig +1
-1@@ -1905,11 +1905,11 @@ config RUST bool "Rust support" depends on HAVE_RUST depends on RUST_IS_AVAILABLE - depends on !CFI_CLANG depends on !MODVERSIONS depends on !GCC_PLUGINS depends on !RANDSTRUCT depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE + depends on !CFI_CLANG || RUSTC_VERSION >= 107900 && CFI_ICALL_NORMALIZE_INTEGERS help Enables Rust support in the kernel.rust/Makefile +1
-1@@ -305,7 +305,7 @@ $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers.c FORCE quiet_cmd_exports = EXPORTS $@ cmd_exports = \ $(NM) -p --defined-only $< \ - | awk '/ (T|R|D) / {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ + | awk '$$2~/(T|R|D)/ && $$3!~/__cfi/ {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ $(obj)/exports_core_generated.h: $(obj)/core.o FORCE $(call if_changed,exports)scripts/generate_rust_target.rs +1
-0@@ -192,6 +192,7 @@ fn main() { } ts.push ("features" , features); ts.push ("llvm-target" ,"x86_64-linux-gnu" ); + ts.push ("supported-sanitizers" , ["kcfi" ]); ts.push ("target-pointer-width" ,"64" ); }else if cfg.has ("X86_32" ) {// This only works on UML, as i386 otherwise needs regparm support in rustc Signature · 2 lines
-- 2.46.0.rc1.232.g9752f9e123-goog
Re: [PATCH 2/2] rust: cfi: add support for CFI_CLANG with Rust
Quoted 9 lines · Peter Zijlstra
Quoted 6 lines · Alice Ryhl
From: Matthew Maurer <[email protected]>
Make it possible to use the Control Flow Integrity (CFI) sanitizer when Rust is enabled. Enabling CFI with Rust requires that CFI is configured to normalize integer types so that all integer types of the same size and signedness are compatible under CFI.
Quoted 4 lines
I am assuming -- because I have to, because you're not actually saying anyting -- that this is fully compatible with the C version and all the fun and games we play with rewriting the function prologue for FineIBT and the like also work?
Rust uses the same LLVM backend for the actual code generation, so it should be fully compatible.
Sami
Re: [PATCH 2/2] rust: cfi: add support for CFI_CLANG with Rust
Quoted 10 lines · Sami Tolvanen
Quoted 9 lines · Peter Zijlstra
Quoted 6 lines · Alice Ryhl
From: Matthew Maurer <[email protected]>
Make it possible to use the Control Flow Integrity (CFI) sanitizer when Rust is enabled. Enabling CFI with Rust requires that CFI is configured to normalize integer types so that all integer types of the same size and signedness are compatible under CFI.
Quoted 7 lines
Quoted 4 lines
I am assuming -- because I have to, because you're not actually saying anyting -- that this is fully compatible with the C version and all the fun and games we play with rewriting the function prologue for FineIBT and the like also work?
Rust uses the same LLVM backend for the actual code generation, so it should be fully compatible.
Yes, but we also combine that with -fpatchable-function-entry= for a very specific effect, and I don't think I see the Rust thingy do that.
Alice Ryhl
reviewerRe: [PATCH 2/2] rust: cfi: add support for CFI_CLANG with Rust
Quoted 17 lines · Peter Zijlstra
Quoted 15 lines · Sami Tolvanen
Quoted 13 lines · Peter Zijlstra
Quoted 6 lines · Alice Ryhl
From: Matthew Maurer <[email protected]>
Make it possible to use the Control Flow Integrity (CFI) sanitizer when Rust is enabled. Enabling CFI with Rust requires that CFI is configured to normalize integer types so that all integer types of the same size and signedness are compatible under CFI.
I am assuming -- because I have to, because you're not actually saying anyting -- that this is fully compatible with the C version and all the fun and games we play with rewriting the function prologue for FineIBT and the like also work?
Quoted 5 lines
Quoted 2 lines
Rust uses the same LLVM backend for the actual code generation, so it should be fully compatible.
Yes, but we also combine that with -fpatchable-function-entry= for a very specific effect, and I don't think I see the Rust thingy do that.
Oh, you're right. I missed this because we're not using FineIBT, and when this patch was originally written we had not yet implemented a Rust equivalent to -fpatchable-function-entry=. However, that flag is now available as of rustc version 1.80.0, so it shouldn't be an issue. I'll fix this for v2 of this series.
Thanks for catching this!
As for whether it works other than that, I've been using this on my personal phone together with Rust Binder for several months, so it's well tested on arm64.
Alice
Re: [PATCH 2/2] rust: cfi: add support for CFI_CLANG with Rust
In reply to Alice RyhlQuoted 2 lines · Alice Ryhl
+
RS_FLAGS_CFI:= -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers
Before I forget: this should probably be RUSTC_... for consistency with the rest (and, in this case, these are flags, so it makes sense they target the particular compiler).
Cheers,
Miguel
Alice Ryhl
reviewerRe: [PATCH 2/2] rust: cfi: add support for CFI_CLANG with Rust
Quoted 8 lines · Miguel Ojeda
Quoted 2 lines · Alice Ryhl
+
RS_FLAGS_CFI:= -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integersBefore I forget: this should probably be
RUSTC_...for consistency with the rest (and, in this case, these are flags, so it makes sense they target the particular compiler).
Hmm. It seems like the existing variables containing rustc flags just use RUST not RUSTC in the name?
Alice
Re: [PATCH 2/2] rust: cfi: add support for CFI_CLANG with Rust
Quoted 3 lines · Alice Ryhl
Hmm. It seems like the existing variables containing rustc flags just use RUST not RUSTC in the name?
If you mean things like RUSTFLAGS, it was because the C side uses CFLAGS, but for the equivalent of CC_FLAGS or CLANG_FLAGS, I would say it should be RUSTC_FLAGS.
Cheers,
Miguel
Quoted 10 lines · On Tue, 30 Jul 2024 09:40:10 +0000 Alice Ryhl <[email protected]> wrote:
The control flow integrity (kCFI) sanitizer is an important sanitizer that is often used in production. This patch series makes it possible to use kCFI and Rust together.
The second patch in this series depends on the next version of [1], which Miguel will send soon. It also depends on [2].
Signed-off-by Alice Ryhl <[email protected]>
Both patches:
Quoted 18 lines
---
Alice Ryhl (1):
cfi: addCONFIG_CFI_ICALL_NORMALIZE_INTEGERSMatthew Maurer (1):
rust: cfi: add support forCFI_CLANGwith RustMakefile | 10 ++++++++++ arch/Kconfig | 11 +++++++++++ init/Kconfig | 2 +- rust/Makefile | 2 +- scripts/generate_rust_target.rs | 1 + 5 files changed, 24 insertions(+), 2 deletions(-)---
base-commit:8718bc07faa6ddf4f7335a12e4cdd4ffc796bbd8
change-id: 20240725-kcfi-c592898e2bfbBest regards,