--- /dev/null
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <time.h>
+
+int main (int argc, char *argv[])
+{
+ int res;
+ struct timespec ts;
+ uid_t uid1, uid2;
+
+ /* Give an invalid clockid_t on purpose so the vdso has to call
+ through to the kernel syscall. */
+ res = clock_gettime(6667, &ts);
+
+ uid1 = syscall(SYS_getuid);
+ uid2 = getuid();
+
+ return res + 1 + uid1 - uid2; /* -1 from clock_gettime + 1 == 0 */
+}
--- /dev/null
+# Make sure however we entered a syscall, we know the calling module name.
+# the task finder vma tracker should have recorded it.
+
+set test "vma_vdso"
+
+# Expect the following three syscalls
+set ::result_string {clock_gettime
+getuid
+getuid}
+
+# Force 64-bit (when necessary) to be sure of what we're testing.
+switch -regexp $::tcl_platform(machine) {
+ {^(x86_64|ppc64|s390x)$} { set arches [list "-m64"] }
+ default { set arches [list "default"] }
+}
+
+# Test 32-on-64 when available
+switch -regexp $::tcl_platform(machine) {
+ {^(x86_64|ppc64)$} { lappend arches "-m32" }
+ {^s390x$} { lappend arches "-m31" }
+}
+
+foreach arch $arches {
+ verbose "testing $test $arch"
+
+ set test_flags "additional_flags=-g"
+ set test_flags "$test_flags additional_flags=-lrt"
+
+ if {$arch != "default"} {
+ set test_flags "$test_flags additional_flags=$arch"
+ }
+
+ set res [target_compile $srcdir/$subdir/$test.c ${test}${arch}.exe executable "$test_flags"]
+ if { $res != "" } {
+ verbose "target_compile ${test}${arch} failed: $res" 2
+ fail "${test}.c compile ${arch}"
+ untested "${test}${arch}"
+ return
+ } else {
+ pass "${test}.c compile ${arch}"
+ }
+
+ # Test only when we are running an install test (can execute)
+ if {[installtest_p]} {
+ stap_run3 ${test}${arch} $srcdir/$subdir/$test.stp ./${test}${arch}.exe -c ./${test}${arch}.exe
+ } else {
+ untested "${test}${arch}"
+ }
+}
--- /dev/null
+/* Make sure however we entered a syscall, we know the calling module name.
+ the task finder vma tracker should have recorded it. */
+probe syscall.clock_gettime, syscall.getuid
+{
+ if (target() == pid())
+ {
+ if (umodname(uaddr()) != "<unknown>")
+ {
+ log(name);
+ }
+ else
+ {
+ printf("%s@%x unknown\n", name, uaddr());
+ }
+ }
+}