From: Todd Kjos tkjos@google.com
aosp inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4RCS8 CVE: NA
Reference: https://android.googlesource.com/kernel/common/+/e706f27c765b
---------------------------
Because of the multi-inclusion oddities of tracepoints, the multi-inclusion protection in vendor_hooks.h caused issues if more than 1 vendor hook header file with restricted vendor hooks defined were included with "CREATE_TRACE_POINTS" defined (redefinition of symbol errors).
The problem is fixed by removing the multiple-inclusion protection as is done for regular tracepoints.
Fixes: 7f62740112ef ("ANDROID: add support for vendor hooks") Bug: 163076069 Signed-off-by: Todd Kjos tkjos@google.com Change-Id: Ic177db1693a6a2db58f08917e9115c7e6c2971b6 Signed-off-by: Jialin Zhang zhangjialin11@huawei.com Reviewed-by: Wei Li liwei391@huawei.com Reviewed-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/trace/hooks/vendor_hooks.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/trace/hooks/vendor_hooks.h b/include/trace/hooks/vendor_hooks.h index 9d9ae21895dd..8a3fdb9222e5 100644 --- a/include/trace/hooks/vendor_hooks.h +++ b/include/trace/hooks/vendor_hooks.h @@ -1,7 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0 */
-#if !defined(_TRACE_VENDOR_HOOKS_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_VENDOR_HOOKS_H +/* + * Note: we intentionally omit include file ifdef protection + * This is due to the way trace events work. If a file includes two + * trace event headers under one "CREATE_TRACE_POINTS" the first include + * will override the DECLARE_RESTRICTED_HOOK and break the second include. + */
#include <linux/tracepoint.h>
@@ -13,6 +17,7 @@ #define DECLARE_RESTRICTED_HOOK(name, proto, args, cond) \ DEFINE_TRACE(name)
+ /* prevent additional recursion */ #undef TRACE_HEADER_MULTI_READ #else /* TRACE_HEADER_MULTI_READ */ @@ -61,6 +66,7 @@ } \ /* vendor hooks cannot be unregistered */ \
+#undef DECLARE_RESTRICTED_HOOK #define DECLARE_RESTRICTED_HOOK(name, proto, args, cond) \ __DECLARE_HOOK(name, PARAMS(proto), PARAMS(args), \ cond, \ @@ -68,5 +74,3 @@ PARAMS(__data, args))
#endif /* TRACE_HEADER_MULTI_READ */ - -#endif /* _TRACE_VENDOR_HOOKS_H */