This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH] powerpc: Change SDT argument constraint
- From: Sandipan Das <sandipan at linux dot vnet dot ibm dot com>
- To: systemtap at sourceware dot org
- Cc: naveen dot n dot rao at linux dot vnet dot ibm dot com, segher at kernel dot crashing dot org, mjw at redhat dot com, fche at redhat dot com
- Date: Thu, 5 Oct 2017 14:39:41 +0530
- Subject: [PATCH] powerpc: Change SDT argument constraint
- Authentication-results: sourceware.org; auth=none
With the 'o' memory constraint, any memory operand which
has an offsettable address is allowed. However, for some
architectures such as powerpc, this allows operands like
the ones shown below in the readelf output from Fedora 26
to be generated.
$ readelf -n /lib64/libc.so.6 | grep memory_mallopt_mmap_max -A2 -B2
stapsdt 0x0000006c NT_STAPSDT (SystemTap probe descriptors)
Provider: libc
Name: memory_mallopt_mmap_max
Location: 0x00000000000a0274, Base: 0x00000000001ccb90, Semaphore: 0x0000000000000000
Arguments: -4@9 -4@.LANCHOR0+44@toc@l(8) -4@.LANCHOR0+52@toc@l(7)
The second and third argument shown above are both having
operands which are pointers to static data anchors. Since
these static anchors are not included in the symbol table,
they cannot be resolved from the binary itself. So, such
arguments cannot be read via their corresponding markers.
Using the 'Z' memory constraint instead solves this issue
as it will only allow a memory operand that is an indexed
or indirect from a register.
So, for powerpc, we set STAP_SDT_ARG_CONSTRAINT to 'nZr'
but keep it as 'nor' for all other architectures.
Signed-off-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
---
includes/sys/sdt.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h
index f85045851..940f74483 100644
--- a/includes/sys/sdt.h
+++ b/includes/sys/sdt.h
@@ -84,8 +84,12 @@
# define _SDT_ARGFMT(no) %n[_SDT_S##no]@_SDT_ARGTMPL(_SDT_A##no)
# ifndef STAP_SDT_ARG_CONSTRAINT
+# if defined __powerpc__
+# define STAP_SDT_ARG_CONSTRAINT nZr
+# else
# define STAP_SDT_ARG_CONSTRAINT nor
# endif
+# endif
# define _SDT_STRINGIFY(x) #x
# define _SDT_ARG_CONSTRAINT_STRING(x) _SDT_STRINGIFY(x)
--
2.13.6