This file is indexed.

/usr/share/systemtap/tapset/conversions.stp is in systemtap-common 1.6-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// conversions tapset
// Copyright (C) 2005-2010 Red Hat Inc.
// Copyright (C) 2007 Intel Corporation.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.

/**
 * sfunction kernel_string - Retrieves string from kernel memory
 * @addr: The kernel address to retrieve the string from
 *
 * Description: This function returns the null terminated C string
 * from a given kernel memory address. Reports an error on string
 * copy fault.
 */
function kernel_string:string (addr:long) %{ /* pure */
  char *destination = THIS->__retvalue;
  deref_string (destination, THIS->addr, MAXSTRINGLEN);
  if (0) {
deref_fault: /* branched to from deref_string() */
    snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
        "kernel string copy fault at 0x%p", (void *) (uintptr_t) THIS->addr);
    CONTEXT->last_error = CONTEXT->error_buffer;
  }
%}

/**
 * sfunction kernel_string2 - Retrieves string from kernel memory with alternative error string
 * @addr: The kernel address to retrieve the string from
 * @err_msg: The error message to return when data isn't available
 *
 * Description: This function returns the null terminated C string
 * from a given kernel memory address. Reports the given error message
 * on string copy fault.
 */
function kernel_string2:string (addr:long, err_msg:string) {
  try { return kernel_string(addr) } catch { return err_msg }
}

/**
 * sfunction kernel_string_n - Retrieves string of given length from kernel memory
 * @addr: The kernel address to retrieve the string from
 * @n: The maximum length of the string (if not null terminated)
 *
 * Description: Returns the C string of a maximum given length from a
 * given kernel memory address. Reports an error on string copy fault.
 */
function kernel_string_n:string (addr:long, n:long) %{ /* pure */
  char *destination = THIS->__retvalue;
  int64_t len = clamp_t(int64_t, THIS->n + 1, 1, MAXSTRINGLEN);
  deref_string (destination, THIS->addr, len);
  if (0) {
deref_fault: /* branched to from deref_string() */
    snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
        "kernel string copy fault at 0x%p", (void *) (uintptr_t) THIS->addr);
    CONTEXT->last_error = CONTEXT->error_buffer;
  }
%}

/**
 * sfunction kernel_long - Retrieves a long value stored in kernel memory
 * @addr: The kernel address to retrieve the long from
 *
 * Description: Returns the long value from a given kernel memory address.
 * Reports an error when reading from the given address fails.
 */
function kernel_long:long (addr:long) %{ /* pure */
  THIS->__retvalue = kread((long *) (intptr_t) THIS->addr);
  if (0) {
deref_fault: /* branched to from kread() */
    snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
        "kernel long copy fault at 0x%p", (void *) (uintptr_t) THIS->addr);
    CONTEXT->last_error = CONTEXT->error_buffer;
  }
%}

/**
 * sfunction kernel_int - Retrieves an int value stored in kernel memory
 * @addr: The kernel address to retrieve the int from
 *
 * Description: Returns the int value from a given kernel memory address.
 * Reports an error when reading from the given address fails.
 */
function kernel_int:long (addr:long) %{ /* pure */
  THIS->__retvalue = kread((int *) (intptr_t) THIS->addr);
  if (0) {
deref_fault: /* branched to from kread() */
    snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
        "kernel int copy fault at 0x%p", (void *) (uintptr_t) THIS->addr);
    CONTEXT->last_error = CONTEXT->error_buffer;
  }
%}

/**
 * sfunction kernel_short - Retrieves a short value stored in kernel memory
 * @addr: The kernel address to retrieve the short from
 *
 * Description: Returns the short value from a given kernel memory address.
 * Reports an error when reading from the given address fails.
 */
function kernel_short:long (addr:long) %{ /* pure */
  THIS->__retvalue = kread((short *) (intptr_t) THIS->addr);
  if (0) {
deref_fault: /* branched to from kread() */
    snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
        "kernel short copy fault at 0x%p", (void *) (uintptr_t) THIS->addr);
    CONTEXT->last_error = CONTEXT->error_buffer;
  }
%}

/**
 * sfunction kernel_char - Retrieves a char value stored in kernel memory
 * @addr: The kernel address to retrieve the char from
 *
 * Description: Returns the char value from a given kernel memory address.
 * Reports an error when reading from the given address fails.
 */
function kernel_char:long (addr:long) %{ /* pure */
  THIS->__retvalue = kread((char *) (intptr_t) THIS->addr);
  if (0) {
deref_fault: /* branched to from kread() */
    snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
        "kernel char copy fault at 0x%p", (void *) (uintptr_t) THIS->addr);
    CONTEXT->last_error = CONTEXT->error_buffer;
  }
%}

/**
 * sfunction kernel_pointer - Retrieves a pointer value stored in kernel memory
 * @addr: The kernel address to retrieve the pointer from
 *
 * Description: Returns the pointer value from a given kernel memory
 * address. Reports an error when reading from the given address
 * fails.
 */
function kernel_pointer:long (addr:long) %{ /* pure */
  THIS->__retvalue = (uintptr_t) kread((void **) (uintptr_t) THIS->addr);
  if (0) {
deref_fault: /* branched to from kread() */
    snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
        "kernel pointer copy fault at 0x%p", (void *) (uintptr_t) THIS->addr);
    CONTEXT->last_error = CONTEXT->error_buffer;
  }
%}