@@ -3752,45 +3752,45 @@ functions intended for different purposes have distinct CFI identities.
37523752
37533753 // Header file - define convenience macros
37543754 #define __cfi_salt(s) __attribute__((cfi_salt(s)))
3755-
3755+
37563756 // Typedef for regular function pointers
37573757 typedef int (*fptr_t)(void);
3758-
3759- // Typedef for salted function pointers
3758+
3759+ // Typedef for salted function pointers
37603760 typedef int (*fptr_salted_t)(void) __cfi_salt("pepper");
3761-
3761+
37623762 struct widget_ops {
37633763 fptr_t init; // Regular CFI
37643764 fptr_salted_t exec; // Salted CFI
37653765 fptr_t cleanup; // Regular CFI
37663766 };
3767-
3767+
37683768 // Function implementations
37693769 static int widget_init(void) { return 0; }
37703770 static int widget_exec(void) __cfi_salt("pepper") { return 1; }
37713771 static int widget_cleanup(void) { return 0; }
3772-
3772+
37733773 static struct widget_ops ops = {
37743774 .init = widget_init, // OK - compatible types
37753775 .exec = widget_exec, // OK - both use "pepper" salt
37763776 .cleanup = widget_cleanup // OK - compatible types
37773777 };
3778-
3778+
37793779 // Using C++11 attribute syntax
37803780 void secure_callback(void) [[clang::cfi_salt("secure")]];
3781-
3781+
37823782 // This would cause a compilation error:
37833783 // fptr_t bad_ptr = widget_exec; // Error: incompatible types
37843784
37853785**Notes:**
37863786
37873787* The salt string can contain non-NULL ASCII characters, including spaces and
37883788 quotes
3789- * This attribute only applies to function types; using it on non-function
3789+ * This attribute only applies to function types; using it on non-function
37903790 types will generate a warning
3791- * All declarations and definitions of the same function must use identical
3791+ * All declarations and definitions of the same function must use identical
37923792 salt values
3793- * The attribute affects type compatibility during compilation and CFI hash
3793+ * The attribute affects type compatibility during compilation and CFI hash
37943794 generation during code generation
37953795 }];
37963796}
0 commit comments