Project

General

Profile

Bug #1231 » 0001-Fix-plugin-dev.h-Disable-address-sanitizer-on-pointe.patch

Updated patch (v2) - Mathieu Desnoyers, 02/17/2020 08:14 PM

View differences:

include/babeltrace2/plugin/plugin-dev.h
2660 2660
	};								\
2661 2661
	static struct __bt_plugin_component_class_descriptor_attribute const * const __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_component_class_id##_##_attr_name##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_component_class_id##_##_attr_name
2662 2662

  
2663
/*
2664
 * Clang supports the no_sanitize variable attribute on global variables.
2665
 * GCC only supports the no_sanitize_address function attribute, which is
2666
 * not what we need.
2667
 */
2668
#if defined(__clang__)
2669
# if __has_feature(address_sanitizer)
2670
#  define __bt_plugin_variable_attribute_no_sanitize_address \
2671
	__attribute__((no_sanitize("address")))
2672
# else
2673
#  define __bt_plugin_variable_attribute_no_sanitize_address
2674
# endif
2675
#else
2676
#  define __bt_plugin_variable_attribute_no_sanitize_address
2677
#endif
2678

  
2663 2679
/*
2664 2680
 * Variable attributes for a plugin descriptor pointer to be added to
2665 2681
 * the plugin descriptor section (internal use).
2666 2682
 */
2667 2683
#ifdef __APPLE__
2668 2684
#define __BT_PLUGIN_DESCRIPTOR_ATTRS \
2669
	__attribute__((section("__DATA,btp_desc"), used))
2685
	__attribute__((section("__DATA,btp_desc"), used)) \
2686
	__bt_plugin_variable_attribute_no_sanitize_address
2670 2687

  
2671 2688
#define __BT_PLUGIN_DESCRIPTOR_BEGIN_SYMBOL \
2672 2689
	__start___bt_plugin_descriptors
......
2683 2700
#else
2684 2701

  
2685 2702
#define __BT_PLUGIN_DESCRIPTOR_ATTRS \
2686
	__attribute__((section("__bt_plugin_descriptors"), used))
2703
	__attribute__((section("__bt_plugin_descriptors"), used)) \
2704
	__bt_plugin_variable_attribute_no_sanitize_address
2687 2705

  
2688 2706
#define __BT_PLUGIN_DESCRIPTOR_BEGIN_SYMBOL \
2689 2707
	__start___bt_plugin_descriptors
......
2702 2720
 */
2703 2721
#ifdef __APPLE__
2704 2722
#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS \
2705
	__attribute__((section("__DATA,btp_desc_att"), used))
2723
	__attribute__((section("__DATA,btp_desc_att"), used)) \
2724
	__bt_plugin_variable_attribute_no_sanitize_address
2706 2725

  
2707 2726
#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL \
2708 2727
	__start___bt_plugin_descriptor_attributes
......
2719 2738
#else
2720 2739

  
2721 2740
#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS \
2722
	__attribute__((section("__bt_plugin_descriptor_attributes"), used))
2741
	__attribute__((section("__bt_plugin_descriptor_attributes"), used)) \
2742
	__bt_plugin_variable_attribute_no_sanitize_address
2723 2743

  
2724 2744
#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL \
2725 2745
	__start___bt_plugin_descriptor_attributes
......
2738 2758
 */
2739 2759
#ifdef __APPLE__
2740 2760
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS \
2741
	__attribute__((section("__DATA,btp_cc_desc"), used))
2761
	__attribute__((section("__DATA,btp_cc_desc"), used)) \
2762
	__bt_plugin_variable_attribute_no_sanitize_address
2742 2763

  
2743 2764
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_SYMBOL \
2744 2765
	__start___bt_plugin_component_class_descriptors
......
2755 2776
#else
2756 2777

  
2757 2778
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS \
2758
	__attribute__((section("__bt_plugin_component_class_descriptors"), used))
2779
	__attribute__((section("__bt_plugin_component_class_descriptors"), used)) \
2780
	__bt_plugin_variable_attribute_no_sanitize_address
2759 2781

  
2760 2782
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_SYMBOL \
2761 2783
	__start___bt_plugin_component_class_descriptors
......
2775 2797
 */
2776 2798
#ifdef __APPLE__
2777 2799
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS \
2778
	__attribute__((section("__DATA,btp_cc_desc_att"), used))
2800
	__attribute__((section("__DATA,btp_cc_desc_att"), used)) \
2801
	__bt_plugin_variable_attribute_no_sanitize_address
2779 2802

  
2780 2803
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL \
2781 2804
	__start___bt_plugin_component_class_descriptor_attributes
......
2792 2815
#else
2793 2816

  
2794 2817
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS \
2795
	__attribute__((section("__bt_plugin_component_class_descriptor_attributes"), used))
2818
	__attribute__((section("__bt_plugin_component_class_descriptor_attributes"), used)) \
2819
	__bt_plugin_variable_attribute_no_sanitize_address
2796 2820

  
2797 2821
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL \
2798 2822
	__start___bt_plugin_component_class_descriptor_attributes
2799
- 
(2-2/2)