From 263180a2928105b7bab251e6e30e4a008356919a Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Fri, 29 Sep 2017 12:58:09 -0400 Subject: [PATCH] dtrace: ensure SDT stub function returns 0 The SDT stub function is used during the kernel boot process (prior to the patching of SDT probe points). Since it is used for both regular SDT probes and is-enabled SDT probes, it should return 0 to be a no-op before call patching takes place. Orabug: 26909775 Signed-off-by: Kris Van Hees Reviewed-by: Nick Alcock --- include/linux/sdt.h | 4 ++-- scripts/dtrace_sdt.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/sdt.h b/include/linux/sdt.h index 68a31cecd5f2..371449843c04 100644 --- a/include/linux/sdt.h +++ b/include/linux/sdt.h @@ -11,8 +11,8 @@ #include #define DTRACE_PROBE(name, ...) { \ - extern void __dtrace_probe_##name(__DTRACE_TYPE_APPLY_DEFAULT(__DTRACE_UINTPTR_EACH, void, ## __VA_ARGS__)); \ - __dtrace_probe_##name(__DTRACE_ARG_APPLY(__DTRACE_UINTCAST_EACH, ## __VA_ARGS__)); \ + extern int __dtrace_probe_##name(__DTRACE_TYPE_APPLY_DEFAULT(__DTRACE_UINTPTR_EACH, void, ## __VA_ARGS__)); \ + (void)__dtrace_probe_##name(__DTRACE_ARG_APPLY(__DTRACE_UINTCAST_EACH, ## __VA_ARGS__)); \ asm volatile(".pushsection _dtrace_sdt_names, \"a\", @progbits\n" \ ".ascii \"" __stringify(name) "\"\n" \ ".byte 0\n" \ diff --git a/scripts/dtrace_sdt.sh b/scripts/dtrace_sdt.sh index 156ccdd48bf0..ddf9559f918a 100755 --- a/scripts/dtrace_sdt.sh +++ b/scripts/dtrace_sdt.sh @@ -50,7 +50,8 @@ if [ "$opr" = "sdtstub" ]; then END { if (count) { if (arch == "x86" || arch == "x86_64") { - print "\tret"; + print "\txor %eax,%eax"; + print "\tretq"; } else if (arch == "sparc" || arch == "sparc64") { print "\tretl"; print "\tnop"; -- 2.50.1